Class SimpleFacetDefinition

java.lang.Object
org.apache.commons.geometry.io.euclidean.threed.SimpleFacetDefinition
All Implemented Interfaces:
FacetDefinition
Direct Known Subclasses:
BinaryStlFacetDefinition

public class SimpleFacetDefinition extends Object implements FacetDefinition
Simple FacetDefinition implementation that stores a list of vertices and optional normal.
  • Field Details

    • vertices

      private final List<Vector3D> vertices
      Facet vertices.
    • normal

      private final Vector3D normal
      Facet normal; may be null.
  • Constructor Details

    • SimpleFacetDefinition

      public SimpleFacetDefinition(List<Vector3D> vertices)
      Construct a new instance with the given vertices and no defined normal.
      Parameters:
      vertices - facet vertices
      Throws:
      IllegalArgumentException - if vertices contains fewer than 3 elements
    • SimpleFacetDefinition

      public SimpleFacetDefinition(List<Vector3D> vertices, Vector3D normal)
      Construct a new instance with the given vertices and normal.
      Parameters:
      vertices - facet vertices
      normal - facet normal; may be null
      Throws:
      IllegalArgumentException - if vertices contains fewer than 3 elements
  • Method Details

    • getVertices

      public List<Vector3D> getVertices()
      Get the facet vertices.
      Specified by:
      getVertices in interface FacetDefinition
      Returns:
      facet vertices
    • getNormal

      public Vector3D getNormal()
      Get the normal defined for the facet or null if one has not been explicitly specified. No guarantees are made regarding the properties of the normal or its relationship to the vertices.
      Specified by:
      getNormal in interface FacetDefinition
      Returns:
      the defined normal for the facet or null if one has not been explicitly specified
    • toString

      public String toString()
      Overrides:
      toString in class Object