Class Polygon

java.lang.Object
eu.mihosoft.vrl.v3d.Polygon

public final class Polygon extends Object
Represents a convex polygon. Each convex polygon has a shared property, which is shared between all polygons that are clones of each other or where split from the same polygon. This can be used to define per-polygon properties (such as surface color).
  • Field Details Link icon

    • vertices Link icon

      public final List<Vertex> vertices
      Polygon vertices
    • plane Link icon

      public final Plane plane
      Plane defined by this polygon. Note: uses first three vertices to define the plane.
  • Constructor Details Link icon

    • Polygon Link icon

      public Polygon(List<Vertex> vertices, PropertyStorage shared)
      Constructor. Creates a new polygon that consists of the specified vertices. Note: the vertices used to initialize a polygon must be coplanar and form a convex loop.
      Parameters:
      vertices - polygon vertices
      shared - shared property
    • Polygon Link icon

      public Polygon(List<Vertex> vertices)
      Constructor. Creates a new polygon that consists of the specified vertices. Note: the vertices used to initialize a polygon must be coplanar and form a convex loop.
      Parameters:
      vertices - polygon vertices
    • Polygon Link icon

      public Polygon(Vertex... vertices)
      Constructor. Creates a new polygon that consists of the specified vertices. Note: the vertices used to initialize a polygon must be coplanar and form a convex loop.
      Parameters:
      vertices - polygon vertices
  • Method Details Link icon

    • fromConcavePoints Link icon

      public static List<Polygon> fromConcavePoints(Vector3d... points)
      Decomposes the specified concave polygon into convex polygons.
      Parameters:
      points - the points that define the polygon
      Returns:
      the decomposed concave polygon (list of convex polygons)
    • fromConcavePoints Link icon

      public static List<Polygon> fromConcavePoints(List<Vector3d> points)
      Decomposes the specified concave polygon into convex polygons.
      Parameters:
      points - the points that define the polygon
      Returns:
      the decomposed concave polygon (list of convex polygons)
    • clone Link icon

      public Polygon clone()
      Overrides:
      clone in class Object
    • flip Link icon

      public Polygon flip()
      Flips this polygon.
      Returns:
      this polygon
    • flipped Link icon

      public Polygon flipped()
      Returns a flipped copy of this polygon. Note: this polygon is not modified.
      Returns:
      a flipped copy of this polygon
    • toStlString Link icon

      public String toStlString()
      Returns this polygon in STL string format.
      Returns:
      this polygon in STL string format
    • toStlString Link icon

      public StringBuilder toStlString(StringBuilder sb)
      Returns this polygon in STL string format.
      Parameters:
      sb - string builder
      Returns:
      the specified string builder
    • translate Link icon

      public Polygon translate(Vector3d v)
      Translates this polygon.
      Parameters:
      v - the vector that defines the translation
      Returns:
      this polygon
    • translated Link icon

      public Polygon translated(Vector3d v)
      Returns a translated copy of this polygon. Note: this polygon is not modified
      Parameters:
      v - the vector that defines the translation
      Returns:
      a translated copy of this polygon
    • transform Link icon

      public Polygon transform(Transform transform)
      Applies the specified transformation to this polygon. Note: if the applied transformation performs a mirror operation the vertex order of this polygon is reversed.
      Parameters:
      transform - the transformation to apply
      Returns:
      this polygon
    • transformed Link icon

      public Polygon transformed(Transform transform)
      Returns a transformed copy of this polygon. Note: if the applied transformation performs a mirror operation the vertex order of this polygon is reversed. Note: this polygon is not modified
      Parameters:
      transform - the transformation to apply
      Returns:
      a transformed copy of this polygon
    • fromPoints Link icon

      public static Polygon fromPoints(List<Vector3d> points, PropertyStorage shared)
      Creates a polygon from the specified point list.
      Parameters:
      points - the points that define the polygon
      shared - shared property storage
      Returns:
      a polygon defined by the specified point list
    • fromPoints Link icon

      public static Polygon fromPoints(List<Vector3d> points)
      Creates a polygon from the specified point list.
      Parameters:
      points - the points that define the polygon
      Returns:
      a polygon defined by the specified point list
    • fromPoints Link icon

      public static Polygon fromPoints(Vector3d... points)
      Creates a polygon from the specified points.
      Parameters:
      points - the points that define the polygon
      Returns:
      a polygon defined by the specified point list
    • getBounds Link icon

      public Bounds getBounds()
      Returns the bounds of this polygon.
      Returns:
      bouds of this polygon
    • contains Link icon

      public boolean contains(Vector3d p)
    • getIntersection Link icon

      public Intersection getIntersection(Straight line)
    • getIntersection Link icon

      public List<Line3d> getIntersection(Vector3d planePoint, Vector3d planeNormal)
    • contains Link icon

      public boolean contains(Polygon p)
    • getStorage Link icon

      public PropertyStorage getStorage()
      Returns:
      the shared