|
JavaView® v2.00.008 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--jv.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 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 | |
protected boolean |
m_bClosed
Flag whether polygon is closed, i.e. last vertex is implicitly connected with an edge with the first vertex of the vertex array. |
protected boolean |
m_bShowEdgeColors
Flag whether edge colors are shown in display. |
protected boolean |
m_bShowEdgeLabels
Flag whether labels of edges are shown in display. |
protected boolean |
m_bShowEdgeNormals
Flag whether edge normals are shown in display. |
protected boolean |
m_bShowEdges
Flag whether polygon edges are shown in display. |
protected boolean |
m_bShowPolygonColors
Flag if local color of edges used in display, applied if individual edge coloring is available. |
protected boolean |
m_bShowPolygonEndArrow
Flag whether arrow is shown at last point of polygon. |
protected boolean |
m_bShowPolygonStartArrow
Flag whether arrow is shown at first point of polygon. |
protected boolean |
m_bShowTaggedEdges
Flag whether tagged polygon edges are shown in display. |
protected PdColor |
m_globalPolygonColor
Global color of polygons used in display, applied if no individual polygon coloring available. |
protected PuDouble |
m_globalPolygonSize
Flag if global size of edges used in display, applied if no individual edge sizes available. |
protected PdColor |
m_globalPolygonTagColor
Global color of tagged polygons used in display. |
protected boolean |
m_useGlobalPolygonSize
Flag if global size of edges used in display, applied if no individual edge sizes available. |
| Fields inherited from class jv.project.PgGeometry |
m_ambientProj, m_ambientSpace, m_authorInfo, m_bShowBndBox, m_bShowCenter, m_bShowing, m_bShowTitle, m_center, m_dim, m_dimOfSimplex, m_displayList, m_geometryInfo, m_labelAttribute, m_methodMenu, m_modelMatrix, m_title, m_version, m_versionType |
| Fields inherited from class jv.object.PsObject |
HAS_CONFIG_PANEL, HAS_INFO_PANEL, HAS_MATERIAL_PANEL, INSPECTOR_INFO, INSPECTOR_INFO_EXT, IS_DELETED, IS_FIXED, IS_SELECTED, IS_USED, m_infoPanel, m_name, m_panelList, m_parent, m_tag, m_updateList, 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 | |
boolean |
blend(double s,
PgPolygon a,
double t,
PgPolygon b)
Blend between two Polygons using this = s*a + t*b |
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(PgGeometry aGeom)
Copy instance variables by duplication, not by copying a reference. |
java.awt.Color |
getGlobalPolygonColor()
Get global polygon color which is used if no local colors are available. |
double |
getGlobalPolygonSize()
Get thickness in pixels of polygon when drawn in display. |
java.awt.Color |
getGlobalPolygonTagColor()
Get global color of tagged polygons. |
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. |
PiVector |
getPolygon()
Get indices of polygon as index vector. |
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 colorsis enabled. |
boolean |
isShowingEdgeLabels()
Determine whether showing of edge labels is enabled. |
boolean |
isShowingEdgeNormals()
Determine whether drawing of edge normalsis enabled. |
boolean |
isShowingEdges()
Determine whether drawing of edges of polygonis enabled. |
boolean |
isShowingPolygonColors()
Set flag to enable drawing of polygon colors. |
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. |
PdVector |
makeNormals()
Compute normals at vertices and approximate normal of enclosed patch as the mean of all vertex normals. |
void |
paint(PvGeometryIf dc)
Major rendering method fills an internal container class supplied by the display. |
void |
setClosed(boolean flag)
Set flag that polygon is closed. |
void |
setGlobalPolygonColor(java.awt.Color color)
Set global polygon color to be used if no local colors are available. |
void |
setGlobalPolygonSize(double size)
Set thickness in pixels of polygon when drawn in display. |
void |
setGlobalPolygonTagColor(java.awt.Color color)
Set global color of tagged polygons. |
void |
setJvx(PgJvxSrc src)
Fill this instance with data from a geometry source, for example, previously read from file. |
void |
showEdgeColors(boolean flag)
Set flag to enable drawing of edge colors. |
void |
showEdgeLabels(boolean flag)
Set flag to enable drawing of edge labels in display. |
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 |
showPolygonColors(boolean flag)
Set flag to enable drawing of polygon colors. |
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. |
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 showPolygonColors(boolean) |
void |
useGlobalPolygonSize(boolean flag)
Use global polygon size instead of sizing each edge individually. |
| Methods inherited from class jv.object.PsObject |
addInspector, addUpdateListener, clearTag, clone, clone, copy, getFather, getInfoPanel, getInspector, getName, getNumObjects, hasInspector, hasTag, hasUpdateListener, instanceOf, instanceOf, removeInspector, removeUpdateListener, setName, setParent, setTag, updatePanels |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface jv.project.PgGeometryIf |
getInfoPanel, getName, setName |
| Methods inherited from interface jv.object.PsUpdateIf |
getFather, setParent |
| Field Detail |
protected boolean m_bShowEdgeLabels
protected boolean m_bClosed
isClosed(),
setClosed(boolean)protected boolean m_bShowEdges
protected boolean m_bShowTaggedEdges
protected boolean m_bShowPolygonStartArrow
protected boolean m_bShowPolygonEndArrow
protected boolean m_bShowEdgeNormals
protected boolean m_bShowEdgeColors
protected boolean m_bShowPolygonColors
protected boolean m_useGlobalPolygonSize
protected PdColor m_globalPolygonColor
protected PdColor m_globalPolygonTagColor
protected PuDouble m_globalPolygonSize
| Constructor Detail |
public PgPolygon()
public PgPolygon(int aVertexDim)
| Method Detail |
public void init()
init in class PgPointSetpublic PgJvxSrc getJvx()
getJvx in class PgPointSetpublic void setJvx(PgJvxSrc src)
setJvx in class PgPointSetsrc - a geometry source used to fill this instance with data.public java.lang.Object clone()
null.
Tags of this object are not copied but maybe copied of subclasses.clone in class PgPointSet#copy(PgPolygon)public void copy(PgGeometry aGeom)
copy in class PgPointSetpublic java.lang.String toString()
toString in class PgPointSetpublic 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 void showPolygonColors(boolean flag)
public void useGlobalPolygonColor(boolean flag)
public void useGlobalPolygonSize(boolean flag)
public boolean isShowingEdgeLabels()
public boolean isShowingEdges()
public boolean isShowingEdgeNormals()
public boolean isShowingEdgeColors()
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 showEdgeColors(boolean flag)
public void showPolygonStartArrow(boolean flag)
public void showPolygonEndArrow(boolean flag)
public boolean update(java.lang.Object event)
update in class PgPointSetjv.object.PsUpdateIfevent - carries a lot of informationPsObject,
PsUpdateIf.getFather(),
PsUpdateIf.setParent(PsUpdateIf)public void paint(PvGeometryIf dc)
jv.project.PgGeometryIf for detailed information.paint in class PgPointSetPgGeometryIfpublic PiVector getPolygon()
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,
PgPolygon a,
double t,
PgPolygon b)
this = s*a + t*bs, - t weights of vertices of each Polygona, - b two Polygons used for blendingpublic PdVector makeNormals()
The returned patch normal is orthogonal to the plane of the patch and oriented such that the boundary runs counter-clockwise around the normal. This is
Much faster than finding plane using least square fit.
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 class PgGeometryrayBase - base point of ray eventually hitting the polygon setrayDir - direction point of ray eventually hitting the polygon set
|
JavaView® v2.00.008 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||