Class FacetDefinitions


  • public final class FacetDefinitions
    extends java.lang.Object
    Class containing static methods that operate on FacetDefinition instances.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private FacetDefinitions()
      Utility class; no instantiation.
    • Constructor Detail

      • FacetDefinitions

        private FacetDefinitions()
        Utility class; no instantiation.
    • Method Detail

      • toPolygon

        public static ConvexPolygon3D toPolygon​(java.util.Collection<Vector3D> vertices,
                                                Vector3D normal,
                                                org.apache.commons.numbers.core.Precision.DoubleEquivalence precision)
        Construct a ConvexPolygon3D from the given facet vertices and optional normal. If the normal is non-null, this method attempts to honor it by making the polygon point in a similar (but not necessarily equal) direction, reversing the order of vertices if needed.
        Parameters:
        vertices - facet vertices
        normal - facet normal; may be null
        precision - precision context used for floating point comparisons
        Returns:
        convex polygon constructed from the vertices and normal
        Throws:
        java.lang.IllegalArgumentException - if a valid convex polygon cannot be constructed
      • toPolygon

        public static ConvexPolygon3D toPolygon​(FacetDefinition facet,
                                                org.apache.commons.numbers.core.Precision.DoubleEquivalence precision)
        Construct a ConvexPolygon3D from the vertices of the given facet. This method attempts to honor any normal defined for the facet by making the polygon point in a similar (but not necessarily equal) direction by reversing the order of vertices if needed.
        Parameters:
        facet - facet to convert to a polygon instance
        precision - precision context used for floating point comparisons
        Returns:
        convex polygon constructed from the facet
        Throws:
        java.lang.NullPointerException - if either argument is null
        java.lang.IllegalArgumentException - if a valid convex polygon cannot be constructed