Skip to main content

I have many faces that I want to rotate around 3 axis to make them as flat as possible. See attached workspace. I get the SurfaceNormalCalculator and CenterPointExtractor. And planned to use the 3DRotator or the 3DAffiner to rotate around the centerpoint of the object to get it as "flat as possible. However I can not figure out the correct calculations!

Any help?

Hi @sigtill, the PlanaritiyFilter transformer (Expose Surface Normal: Yes) can be used to calculate the normal vector (_surfaceNromalX, Y, Z) of input 3D Polygon/Face. Then, I think the 3DRotator with these parameters rotates the geometry as your expected. Assuming the coordinates of the center point (_inside_x, y, z) have been extracted with the CenterPointExtractor.

Angle in Degrees: 90-@radToDeg(@atan2(@Value(_surfaceNormalZ),@hypot(@Value(_surfaceNormalX),@Value(_surfaceNormalY))))Rotate Along: Custom AxisCustom Axis of Rotation:Origin    X: @Value(_inside_x)    Y: @Value(_inside_y)    Z: @Value(_inside_z)Direction    X: @Value(_surfaceNormalY)    Y: -@Value(_surfaceNormalX)    Z: 0

See also the attached workspace example: rotatetoflat-2.fmw (2017.1.1.1)

Hope this helps.


Reply