I have a polygon where every vertex/point (don’t know the correct termonology) has a xyz coordinate. I would like to create a buffer where the buffer size depends on the z-coordinate. Couldn’t figure it out how to do it. Anyone who can help me figure this out?

Page 1 / 1

Not sure if I understand what you want. If you want to convert the polygon to points and then buffer the points by z value steps are:

Chopper to get individual points from polygon.

CoordinateExtractor to get _z from points.

Bufferer to buffer points. Choose _z for Buffer Distance.

If the points need to be connected back into one geometry, you can use the HullAccumulator to do this.

Thank you for your swift reply :)

To clarify, let’s say that I have this shape, called “base shape”:

If I use the bufferer transformer and set it to, say -10 meters, I get the orange line:

What I’m looking for, is to use the z-value at each “point” to get the green line:

Hope that sheds some light at what I’m looking for. I’ll try your solution and see what that gives me, thank you once again :)

Thanks, a drawing like this always helps understanding the question :)

Hello, what an interesting question. The drawing helps a lot! I think we want to extract all vertices, calculate a centerpoint (using a CenterPointReplacer) and move all vertices distance z towards the centerpoint. Then we can rebuild the polygon using an AreaBuilder.

Moving the coordinates z meters towards the centerpoint is going to be the hard part. Is your coordinate system in meters?

Hello, what an interesting question. The drawing helps a lot! I think we want to extract all vertices, calculate a centerpoint (using a CenterPointReplacer) and move all vertices distance z towards the centerpoint. Then we can rebuild the polygon using an AreaBuilder.

Moving the coordinates z meters towards the centerpoint is going to be the hard part. Is your coordinate system in meters?

I think this can be done using a Scaler? Or OffsetCurveGenerator.

I think this can be done using a Scaler? Or OffsetCurveGenerator.

I don't see any options in either the Scaler nor the OffsetCurveGenerator that allow for vertex-precise scaling of polygons. But I am using 2019.1, so I could be missing some functionality there. I was thinking of something like this:

And then use the _angle attribute from the NeighborFinder combined with the z attribute to figure out the new x and y coordinates of each vertex. Then stitch it all back together using an AreaBuilder.

But if the Scaler route works, that is probably more viable.

This is how I solved it:

Geometry to attribute.

Explode polygon to points.

Extract Z from points.

Generate vertex id’s.

Restore polygon from attribute.

Offset polygon based on Z.

Explode polygons to points.

Merge both sets of points so you have the corresponding vertice id and z value.

Create polygon from points.

Moving the coordinates z meters towards the centerpoint is going to be the hard part. Is your coordinate system in meters?

Yes it is

This is how I solved it:

Geometry to attribute.

Explode polygon to points.

Extract Z from points.

Generate vertex id’s.

Restore polygon from attribute.

Offset polygon based on Z.

Explode polygons to points.

Merge both sets of points so you have the corresponding vertice id and z value.

Create polygon from points.

Wow, what a solution :)

Although when I run it with my own data I run in to this error message:

OffsetCurveGenerator_offsetter (TeeFactory): OffsetCurveGenerator_offsetter: @Buffer2 -- Parameter 'Buffer2' must be a floating point number -- 'BufferWidth' is not valid

Tester_FAILED_-1_84_Player (RecorderFactory): OffsetCurveGenerator_offsetter: @Buffer2 -- Parameter 'Buffer2' must be a floating point number -- 'BufferWidth' is not valid

Any idea what is happening there? Upon further inspection the flow doesn’t seem to behave correctly before this error message occurs. If you feel like it, please see attached file for the areas I’m working on.

If you do look at the data, you can try to use a buffer size of say 5% of the z-value of each vertex as an example. Or whatevery you feel like :)

I also managed to complete my workflow. I calculated the new coordinates of each vertex using these formulas:

x_moved = x + z * cos(degToRad(angle)) y_moved = y + z * sin(degToRad(angle))

Haven't done anything this close to high school trigonometry in quite a while, so I might have made a little error somewhere, please be mindful of this

Have a nice day!

The shapes you attached are 2D, so it is missing the 3rd coordinate you wanted to use to shift the points :)

I think @joepk his idea is better than mine.

I also managed to complete my workflow. I calculated the new coordinates of each vertex using these formulas:

x_moved = x + z * cos(degToRad(angle)) y_moved = y + z * sin(degToRad(angle))

Haven't done anything this close to high school trigonometry in quite a while, so I might have made a little error somewhere, please be mindful of this

Have a nice day!

As an alternative, draw a line from the point to the centerpoint, then use a Snipper to snip to a point on the line using the _z value.

I also managed to complete my workflow. I calculated the new coordinates of each vertex using these formulas:

x_moved = x + z * cos(degToRad(angle)) y_moved = y + z * sin(degToRad(angle))

Haven't done anything this close to high school trigonometry in quite a while, so I might have made a little error somewhere, please be mindful of this

Have a nice day!

I think I have missed something, This workspace will perform an inward buffer with positive Z-values and an outward buffer with negative Z-values. I think you have to add a -1 to the formulas somewhere:

x_moved = x + (-1 * z * cos(degToRad(angle))) y_moved = y + (-1 * z * sin(degToRad(angle)))

The shapes you attached are 2D, so it is missing the 3rd coordinate you wanted to use to shift the points :)

I think @joepk his idea is better than mine.

I’m sorry for the error. zipped the wrong files… :(

Thank you both for your effort and help! Much appreciated!

Nice to see these different approaches. I came up with yet another solution, that does not use the centerpoint of the polygon. Instead it bisects the inner angles of the original polygon (and it also works when the buffer distance is 0).