BowlerKernel
Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
eu.mihosoft.vrl.v3d.Polygon Class Reference
Collaboration diagram for eu.mihosoft.vrl.v3d.Polygon:
Collaboration graph
[legend]

Public Member Functions

 Polygon (List< Vertex > vertices, PropertyStorage shared, boolean allowDegenerate)
 
 Polygon (List< Vertex > vertices, PropertyStorage shared)
 
 Polygon (List< Vertex > vertices)
 
 Polygon (Vertex... vertices)
 
Polygon clone ()
 
Polygon flip ()
 
Polygon flipped ()
 
String toStlString ()
 
StringBuilder toStlString (StringBuilder sb)
 
Polygon translate (Vector3d v)
 
Polygon translated (Vector3d v)
 
Polygon transform (Transform transform)
 
Polygon transformed (Transform transform)
 
Bounds getBounds ()
 
boolean contains (Vector3d p)
 
boolean contains (Polygon p)
 
PropertyStorage getStorage ()
 
List< Vector3dgetPoints ()
 
Polygon movey (Number howFarToMove)
 
Polygon movez (Number howFarToMove)
 
Polygon movex (Number howFarToMove)
 
Polygon rotz (Number degreesToRotate)
 
Polygon roty (Number degreesToRotate)
 
Polygon rotx (Number degreesToRotate)
 
Polygon scalez (Number scaleValue)
 
Polygon scaley (Number scaleValue)
 
Polygon scalex (Number scaleValue)
 
Polygon scale (Number scaleValue)
 
boolean isValid ()
 
void setDegenerate (boolean degenerate)
 
boolean isDegenerate ()
 
ArrayList< VertexgetDegeneratePoints ()
 
Edge getLongEdge ()
 
ArrayList< Edgeedges ()
 

Static Public Member Functions

static List< PolygonfromConcavePoints (Vector3d... points)
 
static List< PolygonfromConcavePoints (List< Vector3d > points)
 
static List< VertexpruneDuplicatePoints (List< Vertex > incoming)
 
static Polygon fromPoints (List< Vector3d > points, PropertyStorage shared)
 
static Polygon fromPoints (List< Vector3d > points)
 
static Polygon fromPoints (Vector3d... points)
 
static Polygon fromPointsAllowDegenerate (List< Vector3d > vertices2)
 

Public Attributes

final List< Vertexvertices
 
final Plane plane
 

Private Member Functions

void validateAndInit (boolean allowDegenerate)
 

Static Private Member Functions

static Polygon fromPoints (List< Vector3d > points, PropertyStorage shared, Plane plane, boolean allowDegenerate)
 

Private Attributes

PropertyStorage shared
 
boolean valid = true
 
boolean degenerate =false
 

Detailed Description

Represents a convex polygon.

Each convex polygon has a

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).

Definition at line 51 of file Polygon.java.

Constructor & Destructor Documentation

◆ Polygon() [1/4]

eu.mihosoft.vrl.v3d.Polygon.Polygon ( List< Vertex vertices,
PropertyStorage  shared,
boolean  allowDegenerate 
)

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
verticespolygon vertices
sharedshared property

Definition at line 110 of file Polygon.java.

References eu.mihosoft.vrl.v3d.Plane.createFromPoints(), eu.mihosoft.vrl.v3d.Polygon.pruneDuplicatePoints(), eu.mihosoft.vrl.v3d.Polygon.shared, eu.mihosoft.vrl.v3d.Polygon.validateAndInit(), and eu.mihosoft.vrl.v3d.Polygon.vertices.

Referenced by eu.mihosoft.vrl.v3d.Polygon.clone(), and eu.mihosoft.vrl.v3d.Polygon.fromPoints().

Here is the call graph for this function:

◆ Polygon() [2/4]

eu.mihosoft.vrl.v3d.Polygon.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
verticespolygon vertices
sharedshared property

Definition at line 129 of file Polygon.java.

References eu.mihosoft.vrl.v3d.Polygon.shared, and eu.mihosoft.vrl.v3d.Polygon.vertices.

◆ Polygon() [3/4]

eu.mihosoft.vrl.v3d.Polygon.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
verticespolygon vertices

Definition at line 141 of file Polygon.java.

References eu.mihosoft.vrl.v3d.Plane.createFromPoints(), eu.mihosoft.vrl.v3d.Polygon.pruneDuplicatePoints(), eu.mihosoft.vrl.v3d.Polygon.validateAndInit(), and eu.mihosoft.vrl.v3d.Polygon.vertices.

Here is the call graph for this function:

◆ Polygon() [4/4]

eu.mihosoft.vrl.v3d.Polygon.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
verticespolygon vertices

Definition at line 209 of file Polygon.java.

References eu.mihosoft.vrl.v3d.Polygon.vertices.

Member Function Documentation

◆ clone()

Polygon eu.mihosoft.vrl.v3d.Polygon.clone ( )

◆ contains() [1/2]

boolean eu.mihosoft.vrl.v3d.Polygon.contains ( Polygon  p)

Contains.

Parameters
pthe p
Returns
true, if successful

Definition at line 518 of file Polygon.java.

References eu.mihosoft.vrl.v3d.Polygon.contains(), eu.mihosoft.vrl.v3d.Vertex.pos, and eu.mihosoft.vrl.v3d.Polygon.vertices.

Here is the call graph for this function:

◆ contains() [2/2]

boolean eu.mihosoft.vrl.v3d.Polygon.contains ( Vector3d  p)

Contains.

Parameters
pthe p
Returns
true, if successful

Definition at line 489 of file Polygon.java.

References eu.mihosoft.vrl.v3d.Polygon.vertices, eu.mihosoft.vrl.v3d.Vector3d.x(), and eu.mihosoft.vrl.v3d.Vector3d.y().

Referenced by eu.mihosoft.vrl.v3d.Polygon.contains().

Here is the call graph for this function:

◆ edges()

ArrayList<Edge> eu.mihosoft.vrl.v3d.Polygon.edges ( )

◆ flip()

Polygon eu.mihosoft.vrl.v3d.Polygon.flip ( )

Flips this polygon.

Returns
this polygon

Definition at line 230 of file Polygon.java.

References eu.mihosoft.vrl.v3d.Plane.flip(), eu.mihosoft.vrl.v3d.Polygon.plane, and eu.mihosoft.vrl.v3d.Polygon.vertices.

Referenced by eu.mihosoft.vrl.v3d.Polygon.flipped(), and eu.mihosoft.vrl.v3d.Polygon.transform().

Here is the call graph for this function:

◆ flipped()

Polygon eu.mihosoft.vrl.v3d.Polygon.flipped ( )

Returns a flipped copy of this polygon.

Note: this polygon is not modified.

Returns
a flipped copy of this polygon

Definition at line 248 of file Polygon.java.

References eu.mihosoft.vrl.v3d.Polygon.clone(), and eu.mihosoft.vrl.v3d.Polygon.flip().

Referenced by eu.mihosoft.vrl.v3d.Extrude.polygons(), and eu.mihosoft.vrl.v3d.Toroid.Toroid().

Here is the call graph for this function:

◆ fromConcavePoints() [1/2]

static List<Polygon> eu.mihosoft.vrl.v3d.Polygon.fromConcavePoints ( List< Vector3d points)
static

Decomposes the specified concave polygon into convex polygons.

Parameters
pointsthe points that define the polygon
Returns
the decomposed concave polygon (list of convex polygons)

Definition at line 94 of file Polygon.java.

References eu.mihosoft.vrl.v3d.ext.org.poly2tri.PolygonUtil.concaveToConvex(), and eu.mihosoft.vrl.v3d.Polygon.fromPoints().

Here is the call graph for this function:

◆ fromConcavePoints() [2/2]

static List<Polygon> eu.mihosoft.vrl.v3d.Polygon.fromConcavePoints ( Vector3d...  points)
static

Decomposes the specified concave polygon into convex polygons.

Parameters
pointsthe points that define the polygon
Returns
the decomposed concave polygon (list of convex polygons)

Definition at line 82 of file Polygon.java.

References eu.mihosoft.vrl.v3d.ext.org.poly2tri.PolygonUtil.concaveToConvex(), and eu.mihosoft.vrl.v3d.Polygon.fromPoints().

Here is the call graph for this function:

◆ fromPoints() [1/4]

static Polygon eu.mihosoft.vrl.v3d.Polygon.fromPoints ( List< Vector3d points)
static

Creates a polygon from the specified point list.

Parameters
pointsthe points that define the polygon
Returns
a polygon defined by the specified point list

Definition at line 397 of file Polygon.java.

References eu.mihosoft.vrl.v3d.Polygon.fromPoints().

Here is the call graph for this function:

◆ fromPoints() [2/4]

static Polygon eu.mihosoft.vrl.v3d.Polygon.fromPoints ( List< Vector3d points,
PropertyStorage  shared 
)
static

◆ fromPoints() [3/4]

static Polygon eu.mihosoft.vrl.v3d.Polygon.fromPoints ( List< Vector3d points,
PropertyStorage  shared,
Plane  plane,
boolean  allowDegenerate 
)
staticprivate

Creates a polygon from the specified point list.

Parameters
pointsthe points that define the polygon
sharedthe shared
planemay be null
Returns
a polygon defined by the specified point list

Definition at line 421 of file Polygon.java.

References eu.mihosoft.vrl.v3d.Vector3d.clone(), eu.mihosoft.vrl.v3d.Plane.normal, eu.mihosoft.vrl.v3d.Polygon.plane, eu.mihosoft.vrl.v3d.Polygon.Polygon(), eu.mihosoft.vrl.v3d.Polygon.shared, and eu.mihosoft.vrl.v3d.Polygon.vertices.

Here is the call graph for this function:

◆ fromPoints() [4/4]

static Polygon eu.mihosoft.vrl.v3d.Polygon.fromPoints ( Vector3d...  points)
static

Creates a polygon from the specified points.

Parameters
pointsthe points that define the polygon
Returns
a polygon defined by the specified point list

Definition at line 407 of file Polygon.java.

References eu.mihosoft.vrl.v3d.Polygon.fromPoints().

Here is the call graph for this function:

◆ fromPointsAllowDegenerate()

static Polygon eu.mihosoft.vrl.v3d.Polygon.fromPointsAllowDegenerate ( List< Vector3d vertices2)
static

Definition at line 410 of file Polygon.java.

References eu.mihosoft.vrl.v3d.Polygon.fromPoints().

Referenced by eu.mihosoft.vrl.v3d.STL.file().

Here is the call graph for this function:

◆ getBounds()

Bounds eu.mihosoft.vrl.v3d.Polygon.getBounds ( )

Returns the bounds of this polygon.

Returns
bouds of this polygon

Definition at line 443 of file Polygon.java.

References eu.mihosoft.vrl.v3d.Vertex.pos, eu.mihosoft.vrl.v3d.Polygon.vertices, eu.mihosoft.vrl.v3d.Vector3d.x(), eu.mihosoft.vrl.v3d.Vector3d.y(), and eu.mihosoft.vrl.v3d.Vector3d.z().

Here is the call graph for this function:

◆ getDegeneratePoints()

ArrayList<Vertex> eu.mihosoft.vrl.v3d.Polygon.getDegeneratePoints ( )

◆ getLongEdge()

Edge eu.mihosoft.vrl.v3d.Polygon.getLongEdge ( )

◆ getPoints()

List<Vector3d> eu.mihosoft.vrl.v3d.Polygon.getPoints ( )

◆ getStorage()

PropertyStorage eu.mihosoft.vrl.v3d.Polygon.getStorage ( )

◆ isDegenerate()

boolean eu.mihosoft.vrl.v3d.Polygon.isDegenerate ( )

◆ isValid()

boolean eu.mihosoft.vrl.v3d.Polygon.isValid ( )

Indicates whether this polyon is valid, i.e., if it

Returns

Definition at line 672 of file Polygon.java.

References eu.mihosoft.vrl.v3d.Polygon.valid.

◆ movex()

Polygon eu.mihosoft.vrl.v3d.Polygon.movex ( Number  howFarToMove)

Movex.

Parameters
howFarToMovethe how far to move
Returns
the csg

Definition at line 584 of file Polygon.java.

References eu.mihosoft.vrl.v3d.Polygon.transformed(), eu.mihosoft.vrl.v3d.Transform.translateX(), and eu.mihosoft.vrl.v3d.Transform.unity().

Here is the call graph for this function:

◆ movey()

Polygon eu.mihosoft.vrl.v3d.Polygon.movey ( Number  howFarToMove)

Movey.

Parameters
howFarToMovethe how far to move
Returns
the csg

Definition at line 562 of file Polygon.java.

References eu.mihosoft.vrl.v3d.Polygon.transformed(), eu.mihosoft.vrl.v3d.Transform.translateY(), and eu.mihosoft.vrl.v3d.Transform.unity().

Here is the call graph for this function:

◆ movez()

Polygon eu.mihosoft.vrl.v3d.Polygon.movez ( Number  howFarToMove)

Movez.

Parameters
howFarToMovethe how far to move
Returns
the csg

Definition at line 573 of file Polygon.java.

References eu.mihosoft.vrl.v3d.Polygon.transformed(), eu.mihosoft.vrl.v3d.Transform.translateZ(), and eu.mihosoft.vrl.v3d.Transform.unity().

Here is the call graph for this function:

◆ pruneDuplicatePoints()

static List<Vertex> eu.mihosoft.vrl.v3d.Polygon.pruneDuplicatePoints ( List< Vertex incoming)
static

Definition at line 149 of file Polygon.java.

Referenced by eu.mihosoft.vrl.v3d.Polygon.Polygon().

◆ rotx()

Polygon eu.mihosoft.vrl.v3d.Polygon.rotx ( Number  degreesToRotate)

Rotx.

Parameters
degreesToRotatethe degrees to rotate
Returns
the csg

Definition at line 618 of file Polygon.java.

References eu.mihosoft.vrl.v3d.Polygon.transformed().

Here is the call graph for this function:

◆ roty()

Polygon eu.mihosoft.vrl.v3d.Polygon.roty ( Number  degreesToRotate)

Roty.

Parameters
degreesToRotatethe degrees to rotate
Returns
the csg

Definition at line 607 of file Polygon.java.

References eu.mihosoft.vrl.v3d.Polygon.transformed().

Here is the call graph for this function:

◆ rotz()

Polygon eu.mihosoft.vrl.v3d.Polygon.rotz ( Number  degreesToRotate)

Rotz.

Parameters
degreesToRotatethe degrees to rotate
Returns
the csg

Definition at line 596 of file Polygon.java.

References eu.mihosoft.vrl.v3d.Polygon.transformed().

Here is the call graph for this function:

◆ scale()

Polygon eu.mihosoft.vrl.v3d.Polygon.scale ( Number  scaleValue)

Scale.

Parameters
scaleValuethe scale value
Returns
the csg

Definition at line 663 of file Polygon.java.

References eu.mihosoft.vrl.v3d.Polygon.transformed().

Here is the call graph for this function:

◆ scalex()

Polygon eu.mihosoft.vrl.v3d.Polygon.scalex ( Number  scaleValue)

Scalex.

Parameters
scaleValuethe scale value
Returns
the csg

Definition at line 652 of file Polygon.java.

References eu.mihosoft.vrl.v3d.Polygon.transformed().

Here is the call graph for this function:

◆ scaley()

Polygon eu.mihosoft.vrl.v3d.Polygon.scaley ( Number  scaleValue)

Scaley.

Parameters
scaleValuethe scale value
Returns
the csg

Definition at line 641 of file Polygon.java.

References eu.mihosoft.vrl.v3d.Polygon.transformed().

Here is the call graph for this function:

◆ scalez()

Polygon eu.mihosoft.vrl.v3d.Polygon.scalez ( Number  scaleValue)

Scalez.

Parameters
scaleValuethe scale value
Returns
the csg

Definition at line 630 of file Polygon.java.

References eu.mihosoft.vrl.v3d.Polygon.transformed().

Here is the call graph for this function:

◆ setDegenerate()

void eu.mihosoft.vrl.v3d.Polygon.setDegenerate ( boolean  degenerate)

◆ toStlString() [1/2]

String eu.mihosoft.vrl.v3d.Polygon.toStlString ( )

Returns this polygon in STL string format.

Returns
this polygon in STL string format

Definition at line 257 of file Polygon.java.

Referenced by eu.mihosoft.vrl.v3d.CSG.toStlString(), and eu.mihosoft.vrl.v3d.Polygon.validateAndInit().

◆ toStlString() [2/2]

StringBuilder eu.mihosoft.vrl.v3d.Polygon.toStlString ( StringBuilder  sb)

Returns this polygon in STL string format.

Parameters
sbstring builder
Returns
the specified string builder

Definition at line 268 of file Polygon.java.

References eu.mihosoft.vrl.v3d.Plane.normal, eu.mihosoft.vrl.v3d.Vector3d.toStlString(), and eu.mihosoft.vrl.v3d.Polygon.vertices.

Here is the call graph for this function:

◆ transform()

Polygon eu.mihosoft.vrl.v3d.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
transformthe transformation to apply
Returns
this polygon

Definition at line 341 of file Polygon.java.

References eu.mihosoft.vrl.v3d.Vector3d.cross(), eu.mihosoft.vrl.v3d.Plane.dist, eu.mihosoft.vrl.v3d.Vector3d.dot(), eu.mihosoft.vrl.v3d.Polygon.flip(), eu.mihosoft.vrl.v3d.Vector3d.minus(), eu.mihosoft.vrl.v3d.Plane.normal, and eu.mihosoft.vrl.v3d.Vector3d.normalized().

Referenced by eu.mihosoft.vrl.v3d.Polygon.transformed().

Here is the call graph for this function:

◆ transformed()

Polygon eu.mihosoft.vrl.v3d.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
transformthe transformation to apply
Returns
a transformed copy of this polygon

Definition at line 375 of file Polygon.java.

References eu.mihosoft.vrl.v3d.Polygon.clone(), and eu.mihosoft.vrl.v3d.Polygon.transform().

Referenced by eu.mihosoft.vrl.v3d.Polygon.movex(), eu.mihosoft.vrl.v3d.Polygon.movey(), eu.mihosoft.vrl.v3d.Polygon.movez(), eu.mihosoft.vrl.v3d.Extrude.polygons(), eu.mihosoft.vrl.v3d.Extrude.revolve(), eu.mihosoft.vrl.v3d.Polygon.rotx(), eu.mihosoft.vrl.v3d.Polygon.roty(), eu.mihosoft.vrl.v3d.Polygon.rotz(), eu.mihosoft.vrl.v3d.Polygon.scale(), eu.mihosoft.vrl.v3d.Polygon.scalex(), eu.mihosoft.vrl.v3d.Polygon.scaley(), eu.mihosoft.vrl.v3d.Polygon.scalez(), and eu.mihosoft.vrl.v3d.Toroid.Toroid().

Here is the call graph for this function:

◆ translate()

Polygon eu.mihosoft.vrl.v3d.Polygon.translate ( Vector3d  v)

Translates this polygon.

Parameters
vthe vector that defines the translation
Returns
this polygon

Definition at line 304 of file Polygon.java.

References eu.mihosoft.vrl.v3d.Vector3d.cross(), eu.mihosoft.vrl.v3d.Vector3d.minus(), eu.mihosoft.vrl.v3d.Plane.normal, and eu.mihosoft.vrl.v3d.Polygon.vertices.

Referenced by eu.mihosoft.vrl.v3d.Polygon.translated().

Here is the call graph for this function:

◆ translated()

Polygon eu.mihosoft.vrl.v3d.Polygon.translated ( Vector3d  v)

Returns a translated copy of this polygon.

Note: this polygon is not modified

Parameters
vthe vector that defines the translation
Returns
a translated copy of this polygon

Definition at line 327 of file Polygon.java.

References eu.mihosoft.vrl.v3d.Polygon.clone(), and eu.mihosoft.vrl.v3d.Polygon.translate().

Here is the call graph for this function:

◆ validateAndInit()

void eu.mihosoft.vrl.v3d.Polygon.validateAndInit ( boolean  allowDegenerate)
private

Member Data Documentation

◆ degenerate

boolean eu.mihosoft.vrl.v3d.Polygon.degenerate =false
private

◆ plane

final Plane eu.mihosoft.vrl.v3d.Polygon.plane

◆ shared

PropertyStorage eu.mihosoft.vrl.v3d.Polygon.shared
private

Shared property (can be used for shared color etc.).

Definition at line 58 of file Polygon.java.

Referenced by eu.mihosoft.vrl.v3d.Polygon.fromPoints(), eu.mihosoft.vrl.v3d.Polygon.getStorage(), and eu.mihosoft.vrl.v3d.Polygon.Polygon().

◆ valid

boolean eu.mihosoft.vrl.v3d.Polygon.valid = true
private

◆ vertices

final List<Vertex> eu.mihosoft.vrl.v3d.Polygon.vertices

The documentation for this class was generated from the following file: