|
JavaView© v3.95.000 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjv.object.PsObject
jv.project.PgGeometry
jv.geom.PgPointSet
jv.geom.PgPolygon
Base class for polygons given as consequtive list of polygon vertices.
The class interprets the vertices in the vertex array of its superclass
PgPointSet as consequtive points of a polygon. Therefore, this
class mainly consists of polygon properties, for example, polygon color,
additional to the geometric information contained in its superclass.
The dimension of all points is determined as argument of the constructor and cannot
be changed later. See PgPointSet for details about allocation and access.
A good starting point to obtain further insight are methods like computeEight(int)
(if source code access to JavaView is available), or the tutorial applets of JavaView.
PgPointSet,
Serialized Form| Field Summary | |
static int |
BINORMAL
|
static int |
CURVATURE_NORMAL
|
static int |
NORMAL
|
static int |
OFFSET_NORMAL
|
| Fields inherited from class jv.object.PsObject |
HAS_CONFIG_PANEL, HAS_INFO_PANEL, HAS_LABEL_PANEL, HAS_MATERIAL_PANEL, HAS_TEXTURE_PANEL, HAS_VECTOR_PANEL, INSPECTOR_INFO, INSPECTOR_INFO_EXT, IS_DELETED, IS_FIXED, IS_FOCUSSED, IS_PICKED, IS_SELECTED, IS_USED, NUM_TAGS |
| Constructor Summary | |
PgPolygon()
Constructor of a polygon in three-dimensional space. |
|
PgPolygon(int aVertexDim)
Constructor of a polygon set in a space of given dimension. |
|
| Method Summary | |
void |
assureEdgeColors()
Assures respectively allocates correct length of edge color array. |
void |
assureEdgeNormals()
Assures respectively allocates correct length of edge normal array. |
void |
assureEdgeSizes()
Assures respectively allocates correct length of edge size vector. |
boolean |
blend(double s,
PgGeometry ag,
double t,
PgGeometry bg)
Blend between two polygons using this = s*ag + t*bg. |
boolean |
checkTriangleCut(int vertexInd,
PdVector normal)
Given a simple closed, nearly planar polygon, then the function tests whether three successive points of the polygon form a triangle which can be cut off the polygon, i.e. the triangle does not contain any other vertex of the polygon. |
java.lang.Object |
clone()
Duplicate geometry by recursively cloning all instance variables except inspector panels and lists of registered listeners. |
void |
computeCircle(int numPoints,
double radius)
Compute circle centered at origin in xy-plane with given radius including vertex normals. |
void |
computeEight(int numPoints)
Compute figure eight in xy-plane with given radius including vertex normals. |
void |
copy(PsObject object)
Copy instance variables by duplication, not by copying a reference. |
void |
flipOrientation()
Change orientation of the polygon by inverting the order of vertices of the pointSet, i.e. the end point becomes the first point. |
java.awt.Color[] |
getEdgeColors()
Get color array for read and write access, but do not modify the size of any color vector. |
PdVector[] |
getEdgeNormals()
Get vertex normal array for read and write access, but do not modify the size of any normal vector. |
PiVector[] |
getEdges()
Get the array of vertex indices which define the polygon for readonly purpose. |
PdVector |
getEdgeSizes()
Get edge sizes for read and write access, but do not modify the length of the vector. |
int[] |
getFVector()
Compute F-vector that is the number of points, edges, faces, etc. |
java.awt.Color |
getGlobalEdgeColor()
Get global edge color which is used if no local colors are available. |
java.awt.Color |
getGlobalEdgeNormalColor()
Get global element color which is used if no local colors are available. |
double |
getGlobalEdgeNormalLength()
Get length factor of normal vectors when drawn in display. |
double |
getGlobalEdgeNormalSize()
Get thickness in pixels of normals when drawn in display. |
double |
getGlobalEdgeSize()
Get thickness in pixels of edge when drawn in display. |
java.awt.Color |
getGlobalEdgeTagColor()
Get global color of tagged edges. |
java.awt.Color |
getGlobalPolygonColor()
Deprecated. use getGlobalEdgeColor() |
double |
getGlobalPolygonSize()
Deprecated. use getGlobalEdgeSize() |
java.awt.Color |
getGlobalPolygonTagColor()
Deprecated. use getGlobalEdgeTagColor() |
PgJvxSrc |
getJvx()
Fills a geometry object with data from this instance, for example, to print to file. |
double |
getLength()
Compute geometric length of polygon as the sum of all edge lengths. |
double |
getLengthOfEdge(int edgeInd)
Compute length of given edge of polygon. |
int |
getNumEdges()
Get number of edges of polygon. |
boolean |
hasEdgeColors()
Check if edge colors have been allocated. |
boolean |
hasEdgeNormals()
Check if edge normals have been allocated. |
void |
init()
Initialize and reset instance variables after call to super.init(). |
PvPickEvent |
intersectionWithLine(PdVector rayBase,
PdVector rayDir)
Find intersection of polygon with a given ray. |
boolean |
isClosed()
Check whether polygon is closed, i.e.if endpoints are connected by additional edge. |
boolean |
isShowingEdgeColors()
Determine whether drawing of edge colors is enabled. |
boolean |
isShowingEdgeFromVertexColors()
Determines whether smooth edge coloring uses vertex colors at vertices, requires vertex colors. |
boolean |
isShowingEdgeLabels()
Determine whether showing of edge labels is enabled. |
boolean |
isShowingEdgeNormalArrow()
Determine whether drawing of arrow at edge normals is enabled. |
boolean |
isShowingEdgeNormals()
Determine whether drawing of edge normals is enabled. |
boolean |
isShowingEdges()
Determine whether drawing of edges of polygon is enabled. |
boolean |
isShowingEdgeSizes()
Determine whether drawing of edge sizes is enabled. |
boolean |
isShowingPolygonColors()
Deprecated. use isShowingEdgeColors() |
boolean |
isShowingPolygonEndArrow()
Determine whether drawing of arrow at last point of polygon is enabled. |
boolean |
isShowingPolygonStartArrow()
Determine whether drawing of arrow at first point of polygon is enabled. |
boolean |
isShowingSmoothEdgeColors()
Determines whether smooth coloring of edges is enabled, currently requires vertex colors. |
boolean |
isShowingSmoothLighting()
Determines whether smooth lighting is enabled, requires vertex normals. |
void |
makeBiNormals()
Compute binormals at vertices which are orthogonal to both adjacent edges. |
void |
makeCurvatureNormals()
Compute normals at vertices as edge bisectors with length equal to (Pi-vertexAngle). |
boolean |
makeEdgeColorsFromLength()
Create edge color from the polygon length ranging through hue rainbow. |
boolean |
makeEdgeColorsFromXYZ()
Create color from the edge position within its bounding box which is interpreted as RGB cube. |
boolean |
makeEdgeColorsFromZ()
Create color from the vertical z-height within its bounding box ranging from low blue to high red. |
boolean |
makeEdgeColorsFromZHue()
Create color from the vertical z-height within its bounding box ranging through hue rainbow. |
boolean |
makeEdgeFromVertexColors()
Create edge colors as average of the color of its two vertices. |
void |
makeNormals()
Deprecated. since JavaView 3.50.002, use makeVertexNormals(). |
void |
makeNormals(int type,
double length)
Compute normals at vertices which lie in the span of the adjacent edges. |
void |
makeOffsetNormals()
Compute normals at vertices as edge bisectors whose tip lies on an offset==1 curve. |
boolean |
makeVertexColorsFromLength()
Create vertex color from the polygon length ranging through hue rainbow. |
boolean |
makeVertexFromEdgeColors()
Create vertex colors as average of color of all adjacent edges. |
boolean |
makeVertexNormals()
Compute normals at vertices as edge bisectors with unit length. |
void |
paint(PvGeometryIf dc)
Major rendering method fills an internal container class supplied by the display. |
void |
removeEdgeColors()
Remove individual edge colors from a polygon and use the global polygon color instead. |
void |
removeEdgeNormals()
Remove local edge normals from a geometry. |
void |
removeEdgeSizes()
Remove edge sizes from a geometry. |
void |
setClosed(boolean flag)
Set flag that polygon is closed. |
void |
setDimOfVertices(int dim)
Set dimension of vertices. |
boolean |
setEdgeColor(int ind,
java.awt.Color aColor)
Copy new color to edge color at specified position in the color list |
void |
setEdgeColors(java.awt.Color[] color)
Assign edge colors of list to existing array of edge colors. |
boolean |
setEdgeNormal(int ind,
PdVector aNormal)
Copy new normal to edge normal at specified position in the normal list |
void |
setEdgeNormals(PdVector[] normal)
Copy edge normals of list to existing array of edge normals. |
void |
setEdgeSizes(PdVector size)
Copy edge sizes of list to existing array of edge sizes. |
void |
setGlobalEdgeColor(java.awt.Color color)
Set global edge color to be used if no local colors are available. |
void |
setGlobalEdgeNormalColor(java.awt.Color color)
Set global normal color to be used if no local colors are available. |
void |
setGlobalEdgeNormalLength(double length)
Get length factor of normal vectors when drawn in display. |
void |
setGlobalEdgeNormalSize(double size)
Get thickness in pixels of normals when drawn in display. |
void |
setGlobalEdgeSize(double size)
Set thickness in pixels of edge when drawn in display. |
void |
setGlobalEdgeTagColor(java.awt.Color color)
Set global color of tagged edges. |
void |
setGlobalPolygonColor(java.awt.Color color)
Deprecated. use setGlobalEdgeColor() |
void |
setGlobalPolygonSize(double size)
Deprecated. use setGlobalEdgeSizeColor() |
void |
setGlobalPolygonTagColor(java.awt.Color color)
Deprecated. use setGlobalEdgeTagColor() |
void |
setJvx(PgJvxSrc src)
Fill this instance with data from a geometry source, for example, previously read from file. |
void |
setNumVertices(int numVertices)
Allocate given number of vertices, and allocate normals, colors etc. |
void |
showEdgeColors(boolean flag)
Set flag to enable drawing of edge colors. |
void |
showEdgeFromVertexColors(boolean flag)
Set flag to enable smooth edge coloring using vertex colors at vertices, requires vertex colors. |
void |
showEdgeLabels(boolean flag)
Set flag to enable drawing of edge labels in display. |
void |
showEdgeNormalArrow(boolean flag)
Set flag to enable drawing of arrow at edge normals. |
void |
showEdgeNormals(boolean flag)
Set flag to enable drawing of edge normals. |
void |
showEdges(boolean flag)
Set flag to enable drawing of edges of polygon. |
void |
showEdgeSizes(boolean flag)
Set flag to enable drawing of edge sizes. |
void |
showPolygonColors(boolean flag)
Deprecated. use showEdgeColors(boolean) |
void |
showPolygonEndArrow(boolean flag)
Set flag to enable drawing of arrow at last point of polygons. |
void |
showPolygonStartArrow(boolean flag)
Set flag to enable drawing of arrow at first point of polygons. |
void |
showSmoothEdgeColors(boolean flag)
Set flag to enable smooth coloring of edges, currently requires vertex colors. |
void |
showSmoothLighting(boolean flag)
Set flag to enable smooth lighting, requires vertex normals. |
java.lang.String |
toString()
Create a multi-line string representation with detailed information about all instance variables. |
PiVector[] |
triangulate()
Given a simple closed, nearly planar polygon, then the method triangulates the patch by successively removing the vertex with the smallest interior angle. |
boolean |
update(java.lang.Object event)
Update the class whenever a child has changed. |
void |
useGlobalPolygonColor(boolean flag)
Deprecated. use showEdgeColors(boolean) |
| Methods inherited from class jv.object.PsObject |
addInspector, addUpdateListener, assureInspector, clearTag, clone, clone, getFather, getInfoPanel, getInspector, getName, getNumObjects, getSymbol, hasInspector, hasTag, hasUpdateListener, instanceOf, instanceOf, newInspector, newInspector, removeInspector, removeInspector, removeUpdateListener, setName, setParent, setSymbol, setTag, updatePanels |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface jv.project.PgGeometryIf |
assureInspector, getInfoPanel, getName, hasTag, setName |
| Methods inherited from interface jv.object.PsUpdateIf |
getFather, setParent |
| Field Detail |
public static final int NORMAL
public static final int BINORMAL
public static final int OFFSET_NORMAL
public static final int CURVATURE_NORMAL
| Constructor Detail |
public PgPolygon()
public PgPolygon(int aVertexDim)
| Method Detail |
public void init()
init in class PgPointSetpublic PgJvxSrc getJvx()
getJvx in interface PgGeometryIfgetJvx in class PgPointSetpublic void setJvx(PgJvxSrc src)
setJvx in interface PgGeometryIfsetJvx in class PgPointSetsrc - a geometry source used to fill this instance with data.public java.lang.Object clone()
null.
clone in interface PgGeometryIfclone in class PgPointSetcopy(PsObject)public void copy(PsObject object)
The argument was changed from PgGeometry to PsObject since there were problems in J/Link which preferred to use jv.object.PsObject#copy(PsObject) instead of jv.project.PgGeometry#copy(PsObject).
copy in class PgPointSetclone()public java.lang.String toString()
toString in interface PgGeometryIftoString in class PgPointSetpublic void setNumVertices(int numVertices)
PgPointSet
setNumVertices in class PgPointSetpublic void setDimOfVertices(int dim)
setDimOfVertices in class PgPointSetpublic int getNumEdges()
Currently, there is no method setNumEdges since the number is implicitly defined by the number of vertices. This behaviour may change in the future.
setNumVertices(int)public java.awt.Color getGlobalEdgeColor()
public java.awt.Color getGlobalEdgeTagColor()
public double getGlobalEdgeSize()
public void setGlobalEdgeColor(java.awt.Color color)
public void setGlobalEdgeTagColor(java.awt.Color color)
public void setGlobalEdgeSize(double size)
public java.awt.Color getGlobalPolygonColor()
public java.awt.Color getGlobalPolygonTagColor()
public double getGlobalPolygonSize()
public void setGlobalPolygonColor(java.awt.Color color)
public void setGlobalPolygonTagColor(java.awt.Color color)
public void setGlobalPolygonSize(double size)
public java.awt.Color getGlobalEdgeNormalColor()
public double getGlobalEdgeNormalLength()
public double getGlobalEdgeNormalSize()
public void setGlobalEdgeNormalColor(java.awt.Color color)
public void setGlobalEdgeNormalLength(double length)
public void setGlobalEdgeNormalSize(double size)
public void showPolygonColors(boolean flag)
public void useGlobalPolygonColor(boolean flag)
public boolean isShowingEdgeLabels()
public boolean isShowingEdges()
public boolean isShowingEdgeNormals()
public boolean isShowingEdgeNormalArrow()
public boolean isShowingEdgeColors()
public boolean isShowingEdgeSizes()
public boolean isShowingPolygonStartArrow()
public boolean isShowingPolygonEndArrow()
public boolean isShowingPolygonColors()
public void showEdgeLabels(boolean flag)
public void showEdges(boolean flag)
public void showEdgeNormals(boolean flag)
public void showEdgeNormalArrow(boolean flag)
public void showEdgeColors(boolean flag)
public void showEdgeSizes(boolean flag)
public void showPolygonStartArrow(boolean flag)
public void showPolygonEndArrow(boolean flag)
public java.awt.Color[] getEdgeColors()
public boolean hasEdgeColors()
assureEdgeColors()public boolean hasEdgeNormals()
assureEdgeNormals()public void removeEdgeColors()
Showing of edge colors must be switched off explicitly using
showEdgeColors(boolean).
public void setEdgeColors(java.awt.Color[] color)
color - array with new edge colors
public boolean setEdgeColor(int ind,
java.awt.Color aColor)
ind - index of edgeaColor - color to be copied to color list
public void assureEdgeColors()
public PdVector[] getEdgeNormals()
public void removeEdgeNormals()
Showing of edge normals must be switched off explicitly using
showEdgeColors(boolean).
public void setEdgeNormals(PdVector[] normal)
normal - array with new edge normals
public boolean setEdgeNormal(int ind,
PdVector aNormal)
ind - index of edgeaNormal - normal to be copied to normal list
public void assureEdgeNormals()
public PdVector getEdgeSizes()
public void removeEdgeSizes()
Showing of edge sizes must be switched off explicitly using
showEdgeSizes(boolean).
public void setEdgeSizes(PdVector size)
Showing of edge sizes must be switched on in order to be visible.
size - array with new edge size for all polygonspublic void assureEdgeSizes()
public PiVector[] getEdges()
public boolean update(java.lang.Object event)
update in interface PsUpdateIfupdate in class PgPointSetpublic void paint(PvGeometryIf dc)
jv.project.PgGeometryIf for detailed information.
paint in interface PgGeometryIfpaint in class PgPointSetPgGeometryIfpublic double getLengthOfEdge(int edgeInd)
public double getLength()
isClosed()public boolean isClosed()
setClosed(boolean)public void setClosed(boolean flag)
flag - true closes polygonsisClosed()public void computeEight(int numPoints)
numPoints - Discretization of polygon
public void computeCircle(int numPoints,
double radius)
numPoints - Discretization of polygonradius - Radius of circle
public boolean blend(double s,
PgGeometry ag,
double t,
PgGeometry bg)
this = s*ag + t*bg.
blend in interface PgGeometryIfblend in class PgPointSets - weight of vertices of first geometryag - first geometry used for blendingt - weight of vertices of second geometrybg - second geometry used for blending
public boolean makeVertexNormals()
This method correctly handles polygons with sequences of parallel edges and multiple vertices.
makeVertexNormals in class PgPointSetpublic void makeNormals()
public void makeBiNormals()
This method correctly handles polygons with sequences of parallel edges and multiple vertices.
public void makeOffsetNormals()
This method correctly handles polygons with sequences of parallel edges and multiple vertices.
public void makeCurvatureNormals()
This method correctly handles polygons with sequences of parallel edges and multiple vertices.
public void makeNormals(int type,
double length)
This method correctly handles polygons with sequences of parallel edges and multiple vertices.
public boolean checkTriangleCut(int vertexInd,
PdVector normal)
Remark: this condition is only valid of the projection of the polygon onto a plane orthogonal to the normal of the polygon is a simple closed curve with no self-intersections.
Fuer den Test wird abgefragt, ob die uebrigen Eckpunkte des Polygons im Innern des vom Dreieck p1,p2,p3 und der Normalen orient gebildeten Prismas liegt. Wenn alle Punkte ausserhalb liegen, so verlaeuft Linie im Innern d. Polygons.
vertexInd - index of middle vertex which might be cut offnormal - normal of polygon, used as orientation, i.e. polygon runs counter-clockwise around normalpublic PiVector[] triangulate()
ToDo: But until now it cannot handle situations where an edge introduced by removing a vertex may intersect the polygon somewhere else. To solve this problem the above method checkTriangleCut must be employed.
public PvPickEvent intersectionWithLine(PdVector rayBase,
PdVector rayDir)
intersectionWithLine in interface PgGeometryIfintersectionWithLine in class PgPointSetrayBase - base point of ray eventually hitting the polygon setrayDir - direction point of ray eventually hitting the polygon set
public int[] getFVector()
getFVector in class PgPointSetpublic void flipOrientation()
flipOrientation in class PgPointSetpublic boolean makeEdgeColorsFromXYZ()
public boolean makeEdgeColorsFromZ()
public boolean makeEdgeColorsFromZHue()
public boolean isShowingSmoothLighting()
public void showSmoothLighting(boolean flag)
public boolean isShowingSmoothEdgeColors()
public void showSmoothEdgeColors(boolean flag)
public boolean isShowingEdgeFromVertexColors()
public void showEdgeFromVertexColors(boolean flag)
public boolean makeEdgeFromVertexColors()
public boolean makeVertexFromEdgeColors()
public boolean makeEdgeColorsFromLength()
public boolean makeVertexColorsFromLength()
|
JavaView© v3.95.000 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||