In the 3D modeled buildings, some normal vectors on the exterior walls are pointing to the right while others are pointing to the left. How can I identify and reverse the vectors that are pointing to the right, so that they all point to the left?
I attached sample buildings.
I think this is a bit of an unsolved puzzle. A polygon on it’s own has no context - In this dataset for example when each surface is looked at on it’s own there is no way to tell what the correct orientation is.
In FME the way to try and solve this is to collect the geometry into a CompositeSurface or Solid. Once you have a CompositeSurface or Solid you can then use the GeometryValidator to test for Surface Orientation, Solid Boundaries and Solid Orientation. if an error in orientation is detected then a repair can be attempted. It’s fairly common that FME is unable to fully repair an object
You can read more about the GeometryValidator here.https://docs.safe.com/fme/html/FME-Form-Documentation/FME-Transformers/Transformers/geometryvalidator.htm - It’s important to note that certain tests require that other issues not be present. It can be that you will need to use multiple GeometryValidators in a workflow.
Here is workflow I have used in the past to try and repair surfaces which have been incorrectly oriented.
- Make sure that all your polygons are single areas. You can use a deaggregator to make sure there are no multi polygons.
- Make sure all your polygons are planar. You can use the GeometryValidator and check for Non-Planar surfaces
- If any come out of the repaired port then FME will have performed a triangulation on the surface. You wlll need to once again Deaggregate the result.
- Use a FaceReplacor to convert the polygons to Faces. (all of your polygons should be now planar so none should get rejected).
- Now you should have a collection of faces which are planar, Use a GeometryValidator to check for Self intersecting 2D (You may also want to check for Degenerate/Corrupt, nans, and Null geoms at the same time. Make sure that if you do that you but Self Intersecting 2D at the bottom of the list. FME will perform the operations in order.
- If any features get Repaired there is a change that FME has modified the goemetry of the face. some feature may now be lines, or points (or null). Use a GeometryFilter to filter these out.
- Another repair option is face is cut and converted into a CompositeSurface. Run any repaired features through a Deaggregator being sure to set Split Composites to true. You will now be back to a collection of Faces which should be both planer and contain no self intersections.
- Now we can begin to start building the Solid. Start by running all the features through an Aggregator. Be sure to use the GroupBy option to make sure use an appropriate ID if you have multiple buildings or parts which should be treated as individual solids/Features. Your output here should be just one feature per Building/Part
- Verify that your resulting feature(s) have geometry with is a MultiSurface, i.e., not an Aggregate. Ideally we will have a homogeneous collection.
- Use a GeometryCoercer to convert these MultiSurface features into a CompositeSurface. Anything that comes out of the Unchanged port should be reviewed for non-multi surface geometries.
- Add another GeometryCoercer to convert these CompositeSurfaces into brep solids.
- Now that we have Solids we should be able to fix the orientation of the surfaces in the solids. Add another GeometryValidator and check for (in this order) Invalid Solid Voids, Invalid Solid Boundaries, Surface Orientation, Solid Orientation.
- The output of this is likely to contain a mixture of Passed, Repaired and Failed Features. It’s not uncommon for FME to partially repair features depending on the data.
- Make a copy of the GeometryValidator and run the Failed and Repaired features through it again.
- Again, it’s quite possible that the features still remain unrepaired, however, an inspection of the geometry might show a pretty decent result.
Let me know how you get on or if you have any other questions about the workflow.