public class Polygon3D extends java.lang.Object implements Draw3DDefaults
AMBIENT_LIGHT_ON, ARROW_POINT_HEIGHT, ARROW_POINT_RADIUS, ARROW_RADIUS, AV_POINT_DIVISIONS, AXIS_LENGTH, AXIS_RADIUS, BACKGROUND_COLOR, BOUNDRY_RADIUS, CAMERA_FAR_CLIP, CAMERA_INITIAL_DISTANCE, CAMERA_INITIAL_X_ANGLE, CAMERA_INITIAL_Y_ANGLE, CAMERA_NEAR_CLIP, CONE_DIVISIONS, CUMULATE_DEFAULT, CUMULATE_MANUAL_DEFAULT, CYLINDER_DIVISIONS, DEFAULT_ORIGIN, EDGE_RADIUS, EPSILON, LABEL_FONT, LABEL_FONT_SIZE, LINE_RADIUS, MIN_MAX_X, MIN_MAX_Y, MIN_MAX_Z, MOUSE_SPEED, OVAL_DIVISIONS, POINT_LIGHT_1_X, POINT_LIGHT_1_Y, POINT_LIGHT_1_Z, POINT_LIGHT_2_X, POINT_LIGHT_2_Y, POINT_LIGHT_2_Z, POINT_LIGHT_ON, POINT_SIZE, ROTATION_SPEED, SCENE_HEIGHT, SCENE_WIDTH, SCROLL_DELTA, SCROLL_FACTOR, SHOW_AXES, SHOW_BOUNDARY_CUBE, SHOW_DEFAULT_GRID, SHOW_TICK_MARKS, SHOW_X_Y_ONLY, SHOW_Z_AXIS_UP, SPHERE_DIVISIONS, TICK_MARK_LENGTH, TICK_MARK_RADIUS, VECTOR_POINT_HEIGHT, VECTOR_POINT_RADIUS, VECTOR_RADIUS, VERTEX_SIZE
Constructor and Description |
---|
Polygon3D(javafx.geometry.Point3D[] v)
Constructs a Polygon3D object given a Point3d[] Array containing polygon vertices.
|
Polygon3D(javafx.geometry.Point3D[] v,
boolean drawEdges,
boolean drawVertices,
boolean drawVertexLabels)
Constructs a Polygon3D object given a Point3d[] Array containing the polygon vertices,
drawEdges flag, drawVertices flag, drawVertexLabels, and PhongMaterial.
|
Polygon3D(javafx.geometry.Point3D[] v,
javafx.scene.paint.PhongMaterial m)
Constructs a Polygon3D object given a Point3d[] Array containing the polygon vertices
and PhongMaterial.
|
Polygon3D(java.lang.String lineString)
Constructs a Polygon3D object given specification of the parameters
in Save Data File format.
|
Modifier and Type | Method and Description |
---|---|
void |
changeXYZ(double x,
double y,
double z)
Modifies each vertex xyz coordinate tuple by adding to it the x, y, and z parameter values,
updating the v array set of Polygon vertices.
|
boolean |
checkLeft(javafx.geometry.Point3D a,
javafx.geometry.Point3D b,
javafx.geometry.Point3D c)
Provides an indication when traversing the Point3D Polygon vertices from a to b to c,
as to whether the path turns left or right when going from the side ab to vertex c.
|
int |
findLongestComponent()
Finds the "main plane", i.e.
|
Triangle3D[] |
findPolygonTriangles(int[][] tri) |
javafx.scene.shape.CullFace |
getCullFace()
Gets the Polygon CullFace property
|
double |
getD()
Returns the d coefficient of the plane equation of the Polygon
ax + by + cz = d
|
boolean |
getDrawEdges()
Gets the Polygon drawEdges flag
|
javafx.scene.shape.DrawMode |
getDrawMode()
Gets the Polygon DrawMode property
|
boolean |
getDrawVertexLabels()
Gets the Polygon drawVertexLabels flag
|
boolean |
getDrawVertices()
Gets the Polygon drawVertices flag
|
javafx.scene.paint.PhongMaterial |
getEdgeMaterial()
Gets the Polygon edgeMaterial property
|
javafx.scene.paint.PhongMaterial |
getMaterial()
Gets the Polygon PhongMaterial property
|
Vector3D |
getNormal()
Gets the normal vector for the Plane of the Polygon
|
double |
getP()
Returns the distance to the origin from the plane of the Triangle
|
Vector3D |
getUnitNormal()
Gets the unit normal vector for the plane of the Polygon based on its vertices
|
javafx.geometry.Point3D[] |
getV()
Gets the Point3D array of vertices defining the Polygon
|
double |
getVolumeSign()
Gets the volumeSign field for the Polygon.
|
boolean |
isConvexPoly()
Provides an indication as to whether the Polygon specified by the Point3D array, v,
of vertices is convex
|
int |
isInAxisPlane()
Provides an indication as to whether the Polygon determined by Point3D array v
lies in a plane determined by the coordinate axes.
|
boolean |
isPlanar()
Provides an indication as to whether the Point3D array v contains a set of Polygon
vertices that lie in the plane specified by coordinates a, b, c, d.
|
double |
meanX(javafx.geometry.Point3D[] vi)
Returns the mean x coordinate value from the provided set of Polygon vertices.
|
double |
meanY(javafx.geometry.Point3D[] vi)
Returns the mean y coordinate value from the provided set of Polygon vertices.
|
double |
meanZ(javafx.geometry.Point3D[] vi)
Returns the mean z coordinate value from the provided set of Polygon vertices.
|
java.lang.String |
outString()
Returns a String containing all Polygon3D values for saving to a data file.
|
void |
reverse()
Reverses the order of vertices in array v
|
void |
scale(double d)
Modifies each vertex xyz coordinate tuple by multiplying it by the d parameter value,
updating the v array set of Polygon vertices.
|
void |
setCullFace(javafx.scene.shape.CullFace cf)
Sets the Polygon CullFace property
|
void |
setDrawEdges(boolean b)
Sets the Polygon drawEdges flag
|
void |
setDrawMode(javafx.scene.shape.DrawMode dm)
Sets the Polygon DrawMode property
|
void |
setDrawVertexLabels(boolean b)
Sets the Polygon drawVertexLabels flag
|
void |
setDrawVertices(boolean b)
Sets the Polygon drawVertices flag
|
void |
setEdgeMaterial(javafx.scene.paint.PhongMaterial edgeMaterial)
Sets the Polygon edgeMaterial property
|
void |
setMaterial(javafx.scene.paint.PhongMaterial m)
Sets the Polygon PhongMaterial property
|
void |
setOrientation()
Sets the volumeSign field value that indicates the orientation of the Polygon
based on the z-axis coordinate value of the unit normal vector and the sign
of the coefficient d.
|
void |
setX(double a,
double b,
double c,
double d)
Given a set of y and z coordinates, this method computes a corresponding x coordinate
resulting in an update to v, the array of Polygon vertices.
|
void |
setY(double a,
double b,
double c,
double d)
Given a set of x and z coordinates, this method computes a corresponding y coordinate
resulting in an update to v, the array of Polygon vertices.
|
void |
setZ(double a,
double b,
double c,
double d)
Given a set of x and y coordinates, this method computes a corresponding z coordinate
resulting in an update to v, the array of Polygon vertices.
|
void |
sortVertices()
Sorts the array of vertices v
Adapted from: Gernot Hoffman, Cube Plane Intersection, http://docs-hoffmann.de/cubeplane12112006.pdf
|
java.lang.String |
toString()
Returns a String for printing all Polygon3D values
|
int[][] |
triangulateConvexPolygon()
Triangulate convex polygon
|
int[][] |
triangulatePolygon()
Triangulate polygon defined by the Point3D[] v array of polygon vertices in counter clockwise order.
|
double |
volume(javafx.geometry.Point3D a,
javafx.geometry.Point3D b,
javafx.geometry.Point3D c)
Returns the volume of the tetrahedron with vertices a, b, c, and d (the origin
at 0,0,0).
|
public Polygon3D(javafx.geometry.Point3D[] v)
v
- Point3D[] Array containing the polygon verticespublic Polygon3D(javafx.geometry.Point3D[] v, javafx.scene.paint.PhongMaterial m)
v
- Point3D[] Array containing the polygon verticesm
- PhongMaterial determining polygon colorpublic Polygon3D(javafx.geometry.Point3D[] v, boolean drawEdges, boolean drawVertices, boolean drawVertexLabels)
v
- Point3D[] Array containing the polygon verticesdrawEdges
- Flag indicating to draw polygon edgesdrawVertices
- Flag indicating to draw polygon verticesdrawVertexLabels
- Flag indicating to draw polygon vertex labelspublic Polygon3D(java.lang.String lineString)
lineString
- Polygon: format data stringpublic javafx.geometry.Point3D[] getV()
public boolean getDrawEdges()
public void setDrawEdges(boolean b)
b
- drawEdges valuepublic boolean getDrawVertices()
public void setDrawVertices(boolean b)
b
- drawVertices valuepublic boolean getDrawVertexLabels()
public void setDrawVertexLabels(boolean b)
b
- drawVertexLabels valuepublic javafx.scene.paint.PhongMaterial getMaterial()
public void setMaterial(javafx.scene.paint.PhongMaterial m)
m
- PhongMaterial property of the Polygonpublic javafx.scene.paint.PhongMaterial getEdgeMaterial()
public void setEdgeMaterial(javafx.scene.paint.PhongMaterial edgeMaterial)
edgeMaterial
- PhongMaterial value for drawing polygon edgespublic javafx.scene.shape.DrawMode getDrawMode()
public void setDrawMode(javafx.scene.shape.DrawMode dm)
dm
- DrawMode property of the Polygonpublic javafx.scene.shape.CullFace getCullFace()
public void setCullFace(javafx.scene.shape.CullFace cf)
cf
- CullFace property of the Polygonpublic Vector3D getNormal()
public Vector3D getUnitNormal()
public double getD()
public double getP()
public void setOrientation()
public double getVolumeSign()
public void setX(double a, double b, double c, double d)
a
- Double value of the a coefficient of the plane equationb
- Double value of the b coefficient of the plane equationc
- Double value of the c coefficient of the plane equationd
- Double value of the d coefficient of the plane equationpublic void setY(double a, double b, double c, double d)
a
- Double value of the a coefficient of the plane equationb
- Double value of the b coefficient of the plane equationc
- Double value of the c coefficient of the plane equationd
- Double value of the d coefficient of the plane equationpublic void setZ(double a, double b, double c, double d)
a
- Double value of the a coefficient of the plane equationb
- Double value of the b coefficient of the plane equationc
- Double value of the c coefficient of the plane equationd
- Double value of the d coefficient of the plane equationpublic void changeXYZ(double x, double y, double z)
x
- Double value to be added to each vertex x coordinate valuey
- Double value to be added to each vertex y coordinate valuez
- Double value to be added to each vertex z coordinate valuepublic void scale(double d)
d
- Double value to be multiplied times each x, y, z coordinate value of the verticespublic void reverse()
public void sortVertices()
public int findLongestComponent()
public double meanX(javafx.geometry.Point3D[] vi)
vi
- Point3D array of verticespublic double meanY(javafx.geometry.Point3D[] vi)
vi
- Point3D array of verticespublic double meanZ(javafx.geometry.Point3D[] vi)
vi
- Point3D array of verticespublic boolean isPlanar()
public int isInAxisPlane()
public boolean isConvexPoly()
public boolean checkLeft(javafx.geometry.Point3D a, javafx.geometry.Point3D b, javafx.geometry.Point3D c)
a
- Point3D Polygon vertexb
- Point3D Polygon vertexc
- Point3D Polygon vertexpublic double volume(javafx.geometry.Point3D a, javafx.geometry.Point3D b, javafx.geometry.Point3D c)
a
- Point3D specifying vertex a of the tetrahedronb
- Point3D specifying vertex b of the tetrahedronc
- Point3D specifying vertex c of the tetrahedronpublic Triangle3D[] findPolygonTriangles(int[][] tri)
public int[][] triangulateConvexPolygon()
public int[][] triangulatePolygon()
public java.lang.String outString()
public java.lang.String toString()
toString
in class java.lang.Object