JavaView© v3.95.000

jv.geom
Class PgPolygon

java.lang.Object
  extended byjv.object.PsObject
      extended byjv.project.PgGeometry
          extended byjv.geom.PgPointSet
              extended byjv.geom.PgPolygon
All Implemented Interfaces:
java.lang.Cloneable, PgGeometryIf, PsUpdateIf, java.io.Serializable
Direct Known Subclasses:
PgBezierCurve, PgBndPolygon, PgParmCurve

public class PgPolygon
extends PgPointSet

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.

See Also:
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
 
Fields inherited from interface jv.project.PgGeometryIf
AMBIENT_H2_HYPERBOLIC, AMBIENT_H3_HYPERBOLIC, AMBIENT_H4_HYPERBOLIC, AMBIENT_PROJECTIONS, AMBIENT_R1_EUCLIDEAN, AMBIENT_R2_EUCLIDEAN, AMBIENT_R3_EUCLIDEAN, AMBIENT_R4_EUCLIDEAN, AMBIENT_R5_EUCLIDEAN, AMBIENT_S1_SPHERE, AMBIENT_S2_SPHERE, AMBIENT_S3_SPHERE, AMBIENT_S4_SPHERE, AMBIENT_SPACES, HAS_METHOD_MENU, INSPECTOR_CONTROL, INSPECTOR_CONTROL_EXT, INSPECTOR_MATERIAL, INSPECTOR_MATERIAL_EXT, INSPECTOR_TEXTURE, INSPECTOR_TEXTURE_EXT, LABEL_BASE, LABEL_CENTER, LABEL_HEAD, LABEL_MIDDLE, LABEL_TAIL, LABEL_TOP, m_numLabelTypes, METHOD_EXT, PROJ_KLEIN_BALL, PROJ_PARALLEL, PROJ_POINCARE_BALL, PROJ_STEREOGRAPHIC, PROJ_UPPER_HALFSPACE
 
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.geom.PgPointSet
addVectorField, addVertex, applyAmbientMatrix, applyModelingMatrix, assureVertexColors, assureVertexNormals, assureVertexSizes, assureVertexTextures, clearTagVertex, computeCone, computeCylinder, computeDisk, computePlane, computeRotation, computeSnail, computeSphere, computeTorus, getAmbientBounds, getBounds, getCenterOfBndBox, getCenterOfGravity, getDimOfColors, getDimOfTextures, getDimOfVectors, getEulerCharacteristic, getGlobalVectorColor, getGlobalVectorLength, getGlobalVectorSize, getGlobalVertexColor, getGlobalVertexNormalColor, getGlobalVertexNormalLength, getGlobalVertexNormalSize, getGlobalVertexSize, getGlobalVertexTagColor, getIndexOfVectorField, getMarkedVertices, getMaxNumVertices, getNumVectorFields, getNumVertices, getSelectedVectorField, getShininess, getSpecularColor, getTexture, getTextureImage, getTextureImageName, getTransparency, getVectorField, getVectorField, getVertex, getVertexColor, getVertexColors, getVertexNormal, getVertexNormals, getVertexSize, getVertexSizes, getVertexTexture, getVertexTextures, getVertices, hasTagVertex, hasVertex, hasVertex, hasVertexColors, hasVertexNormals, hasVertexSizes, hasVertexTextures, isDefaultLabelEnabled, isEnabledIndexLabels, isShowingIndices, isShowingSingleVectorField, isShowingTaggedVertices, isShowingTransparency, isShowingVectorArrow, isShowingVectorArrows, isShowingVectorColors, isShowingVectorField, isShowingVectorFields, isShowingVertexColors, isShowingVertexLabels, isShowingVertexNormalArrow, isShowingVertexNormals, isShowingVertexOutline, isShowingVertexSizes, isShowingVertexTexture, isShowingVertices, makeColorFromVectorLength, makeQuadrVertexTexture, makeVertexColorsFromXYZ, makeVertexColorsFromZ, makeVertexColorsFromZHue, makeVertexTextureFromBndBox, makeVertexTextureFromCylinder, makeVertexTextureFromSphere, makeVertexTextureFromUV, merge, projectFromAmbientSpace, projectToSphere, reflect, removeAllVectorFields, removeHiddenVectorFields, removeMarkedVertices, removeTexture, removeVectorField, removeVertex, removeVertexColors, removeVertexNormals, removeVertexSizes, scale, scale, selectVectorField, setCenterOfBndBox, setDefaultLabelEnabled, setDimOfColors, setDimOfTextures, setDimOfVectors, setEnabledIndexLabels, setGlobalVectorColor, setGlobalVectorLength, setGlobalVectorSize, setGlobalVertexColor, setGlobalVertexNormalColor, setGlobalVertexNormalLength, setGlobalVertexNormalSize, setGlobalVertexSize, setGlobalVertexSize, setGlobalVertexTagColor, setShininess, setSpecularColor, setState, setTagVertex, setTexture, setTextureImage, setTextureImageName, setTransparency, setVertex, setVertex, setVertex, setVertex, setVertexColor, setVertexColors, setVertexNormal, setVertexNormals, setVertexSize, setVertexSizes, setVertexTexture, setVertexTextures, setVertices, showIndices, showSingleVectorField, showTaggedVertices, showTransparency, showVectorArrow, showVectorArrows, showVectorColors, showVectorField, showVectorFields, showVertexColors, showVertexLabels, showVertexNormalArrow, showVertexNormals, showVertexOutline, showVertexSizes, showVertexTexture, showVertices, translate
 
Methods inherited from class jv.project.PgGeometry
addDisplay, addElement, addPolygon, clearTagElement, clearTagPolygon, fillMethodMenu, fillMethodMenu, getAmbientInvMatrix, getAmbientMatrix, getAmbientProjection, getAmbientSpace, getAuthorInfo, getAuthors, getCenter, getCenterOfElement, getControlPanel, getDiameter, getDimOfSimplex, getDimOfVertices, getDisplayList, getDisplays, getElement, getGeometryInfo, getLabelAttribute, getLabelColor, getLabelFont, getLabelSize, getLabelStyle, getMaterialPanel, getModelMatrix, getPolygon, getState, getTitle, getType, getVersion, getVersionType, hasAmbientMatrix, hasDisplay, hasModelMatrix, hasTagElement, hasTagPolygon, isConfigurable, isEnabledInstanceSharing, isShowingBndBox, isShowingCenter, isShowingName, isShowingTitle, isVisible, removeDisplay, removeElement, removeMethodMenus, removePolygon, setAmbientMatrix, setAmbientProjection, setAmbientSpace, setAuthorInfo, setAuthors, setCenter, setDimOfSimplex, setElement, setEnabledInstanceSharing, setGeometryInfo, setLabelAttribute, setLabelAttribute, setLabelColor, setLabelFont, setLabelSize, setLabelStyle, setModelMatrix, setPolygon, setTagElement, setTagPolygon, setTitle, setType, setVersion, setVersionType, setVisible, showBndBox, showCenter, showName, showTitle
 
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

NORMAL

public static final int NORMAL
See Also:
Constant Field Values

BINORMAL

public static final int BINORMAL
See Also:
Constant Field Values

OFFSET_NORMAL

public static final int OFFSET_NORMAL
See Also:
Constant Field Values

CURVATURE_NORMAL

public static final int CURVATURE_NORMAL
See Also:
Constant Field Values
Constructor Detail

PgPolygon

public PgPolygon()
Constructor of a polygon in three-dimensional space.


PgPolygon

public PgPolygon(int aVertexDim)
Constructor of a polygon set in a space of given dimension.

Method Detail

init

public void init()
Initialize and reset instance variables after call to super.init().

Overrides:
init in class PgPointSet

getJvx

public PgJvxSrc getJvx()
Fills a geometry object with data from this instance, for example, to print to file.

Specified by:
getJvx in interface PgGeometryIf
Overrides:
getJvx in class PgPointSet
Returns:
src a geometry source to be filled with data from this instance.

setJvx

public void setJvx(PgJvxSrc src)
Fill this instance with data from a geometry source, for example, previously read from file.

Specified by:
setJvx in interface PgGeometryIf
Overrides:
setJvx in class PgPointSet
Parameters:
src - a geometry source used to fill this instance with data.

clone

public java.lang.Object clone()
Duplicate geometry by recursively cloning all instance variables except inspector panels and lists of registered listeners. The parent relationship is maintained only within this class but not to external classes. In general, all links of the clone to external objects are set to null.

Specified by:
clone in interface PgGeometryIf
Overrides:
clone in class PgPointSet
See Also:
copy(PsObject)

copy

public void copy(PsObject object)
Copy instance variables by duplication, not by copying a reference.

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

Overrides:
copy in class PgPointSet
See Also:
clone()

toString

public java.lang.String toString()
Create a multi-line string representation with detailed information about all instance variables.

Specified by:
toString in interface PgGeometryIf
Overrides:
toString in class PgPointSet

setNumVertices

public void setNumVertices(int numVertices)
Description copied from class: PgPointSet
Allocate given number of vertices, and allocate normals, colors etc. if they already exist. Internally, there may exist more vertices than requested serving as buffer and to reduce allocation times.

Overrides:
setNumVertices in class PgPointSet

setDimOfVertices

public void setDimOfVertices(int dim)
Set dimension of vertices. Make rare use, and try to assign dimension of vertices already in the constructor.

Overrides:
setDimOfVertices in class PgPointSet

getNumEdges

public int getNumEdges()
Get number of edges of polygon. If polygon is closed then the number is equal to number of vertices of the pointSet. If the polygon is not closed then the number is equal to (number of vertices-1).

Currently, there is no method setNumEdges since the number is implicitly defined by the number of vertices. This behaviour may change in the future.

See Also:
setNumVertices(int)

getGlobalEdgeColor

public java.awt.Color getGlobalEdgeColor()
Get global edge color which is used if no local colors are available.


getGlobalEdgeTagColor

public java.awt.Color getGlobalEdgeTagColor()
Get global color of tagged edges.


getGlobalEdgeSize

public double getGlobalEdgeSize()
Get thickness in pixels of edge when drawn in display.


setGlobalEdgeColor

public void setGlobalEdgeColor(java.awt.Color color)
Set global edge color to be used if no local colors are available.


setGlobalEdgeTagColor

public void setGlobalEdgeTagColor(java.awt.Color color)
Set global color of tagged edges.


setGlobalEdgeSize

public void setGlobalEdgeSize(double size)
Set thickness in pixels of edge when drawn in display.


getGlobalPolygonColor

public java.awt.Color getGlobalPolygonColor()
Deprecated. use getGlobalEdgeColor()

Get global polygon color which is used if no local colors are available.


getGlobalPolygonTagColor

public java.awt.Color getGlobalPolygonTagColor()
Deprecated. use getGlobalEdgeTagColor()

Get global color of tagged polygons.


getGlobalPolygonSize

public double getGlobalPolygonSize()
Deprecated. use getGlobalEdgeSize()

Get thickness in pixels of polygon when drawn in display.


setGlobalPolygonColor

public void setGlobalPolygonColor(java.awt.Color color)
Deprecated. use setGlobalEdgeColor()

Set global polygon color to be used if no local colors are available.


setGlobalPolygonTagColor

public void setGlobalPolygonTagColor(java.awt.Color color)
Deprecated. use setGlobalEdgeTagColor()

Set global color of tagged polygons.


setGlobalPolygonSize

public void setGlobalPolygonSize(double size)
Deprecated. use setGlobalEdgeSizeColor()

Set thickness in pixels of polygon when drawn in display.


getGlobalEdgeNormalColor

public java.awt.Color getGlobalEdgeNormalColor()
Get global element color which is used if no local colors are available.

Since:
JavaView 2.69

getGlobalEdgeNormalLength

public double getGlobalEdgeNormalLength()
Get length factor of normal vectors when drawn in display.

Since:
JavaView 2.69

getGlobalEdgeNormalSize

public double getGlobalEdgeNormalSize()
Get thickness in pixels of normals when drawn in display.

Since:
JavaView 2.69

setGlobalEdgeNormalColor

public void setGlobalEdgeNormalColor(java.awt.Color color)
Set global normal color to be used if no local colors are available.

Since:
JavaView 2.69

setGlobalEdgeNormalLength

public void setGlobalEdgeNormalLength(double length)
Get length factor of normal vectors when drawn in display.

Since:
JavaView 2.69

setGlobalEdgeNormalSize

public void setGlobalEdgeNormalSize(double size)
Get thickness in pixels of normals when drawn in display.

Since:
JavaView 2.69

showPolygonColors

public void showPolygonColors(boolean flag)
Deprecated. use showEdgeColors(boolean)

Set flag to enable drawing of polygon colors.


useGlobalPolygonColor

public void useGlobalPolygonColor(boolean flag)
Deprecated. use showEdgeColors(boolean)

Set flag of using global polygon color instead of coloring each polygon individually.


isShowingEdgeLabels

public boolean isShowingEdgeLabels()
Determine whether showing of edge labels is enabled.


isShowingEdges

public boolean isShowingEdges()
Determine whether drawing of edges of polygon is enabled.


isShowingEdgeNormals

public boolean isShowingEdgeNormals()
Determine whether drawing of edge normals is enabled.


isShowingEdgeNormalArrow

public boolean isShowingEdgeNormalArrow()
Determine whether drawing of arrow at edge normals is enabled.


isShowingEdgeColors

public boolean isShowingEdgeColors()
Determine whether drawing of edge colors is enabled.


isShowingEdgeSizes

public boolean isShowingEdgeSizes()
Determine whether drawing of edge sizes is enabled.


isShowingPolygonStartArrow

public boolean isShowingPolygonStartArrow()
Determine whether drawing of arrow at first point of polygon is enabled.


isShowingPolygonEndArrow

public boolean isShowingPolygonEndArrow()
Determine whether drawing of arrow at last point of polygon is enabled.


isShowingPolygonColors

public boolean isShowingPolygonColors()
Deprecated. use isShowingEdgeColors()

Set flag to enable drawing of polygon colors.


showEdgeLabels

public void showEdgeLabels(boolean flag)
Set flag to enable drawing of edge labels in display.


showEdges

public void showEdges(boolean flag)
Set flag to enable drawing of edges of polygon.


showEdgeNormals

public void showEdgeNormals(boolean flag)
Set flag to enable drawing of edge normals.


showEdgeNormalArrow

public void showEdgeNormalArrow(boolean flag)
Set flag to enable drawing of arrow at edge normals.


showEdgeColors

public void showEdgeColors(boolean flag)
Set flag to enable drawing of edge colors.


showEdgeSizes

public void showEdgeSizes(boolean flag)
Set flag to enable drawing of edge sizes.


showPolygonStartArrow

public void showPolygonStartArrow(boolean flag)
Set flag to enable drawing of arrow at first point of polygons.


showPolygonEndArrow

public void showPolygonEndArrow(boolean flag)
Set flag to enable drawing of arrow at last point of polygons.


getEdgeColors

public java.awt.Color[] getEdgeColors()
Get color array for read and write access, but do not modify the size of any color vector. Also note, that the actual size of the color array may be larger than m_numVertices for efficiency reasons. Therefore, do not make use of the length of the array.


hasEdgeColors

public boolean hasEdgeColors()
Check if edge colors have been allocated.

See Also:
assureEdgeColors()

hasEdgeNormals

public boolean hasEdgeNormals()
Check if edge normals have been allocated.

See Also:
assureEdgeNormals()

removeEdgeColors

public void removeEdgeColors()
Remove individual edge colors from a polygon and use the global polygon color instead.

Showing of edge colors must be switched off explicitly using showEdgeColors(boolean).


setEdgeColors

public void setEdgeColors(java.awt.Color[] color)
Assign edge colors of list to existing array of edge colors. Length of argument list must be equal or larger than getNumEdges(). All edge colors are assigned.

Parameters:
color - array with new edge colors

setEdgeColor

public boolean setEdgeColor(int ind,
                            java.awt.Color aColor)
Copy new color to edge color at specified position in the color list

Parameters:
ind - index of edge
aColor - color to be copied to color list
Returns:
boolean false, if index out of range, or argument missing

assureEdgeColors

public void assureEdgeColors()
Assures respectively allocates correct length of edge color array. Length of array is equal to length of edge array.


getEdgeNormals

public PdVector[] getEdgeNormals()
Get vertex normal array for read and write access, but do not modify the size of any normal vector. Also note, that the actual size of the color may be larger than m_numVertices for efficiency reasons. Therefore, do not make use of the length of the array.


removeEdgeNormals

public void removeEdgeNormals()
Remove local edge normals from a geometry.

Showing of edge normals must be switched off explicitly using showEdgeColors(boolean).


setEdgeNormals

public void setEdgeNormals(PdVector[] normal)
Copy edge normals of list to existing array of edge normals. Length of argument list must be equal or larger than getNumEdges(). All edge normals are copied. The dimension of all argument normals must be equal to getDimOfVectors() of the geometry.

Parameters:
normal - array with new edge normals

setEdgeNormal

public boolean setEdgeNormal(int ind,
                             PdVector aNormal)
Copy new normal to edge normal at specified position in the normal list

Parameters:
ind - index of edge
aNormal - normal to be copied to normal list
Returns:
boolean false, if index out of range, or argument missing

assureEdgeNormals

public void assureEdgeNormals()
Assures respectively allocates correct length of edge normal array. Length of array is equal to length of edge array. Dimension of normal vectors is equal to dimension of vertices.


getEdgeSizes

public PdVector getEdgeSizes()
Get edge sizes for read and write access, but do not modify the length of the vector. Also note, that the actual size of the vector may be larger than m_numVertices for efficiency reasons. Therefore, do not make use of the length of the array.

Since:
JavaView 3.09

removeEdgeSizes

public void removeEdgeSizes()
Remove edge sizes from a geometry.

Showing of edge sizes must be switched off explicitly using showEdgeSizes(boolean).

Since:
JavaView 3.09

setEdgeSizes

public void setEdgeSizes(PdVector size)
Copy edge sizes of list to existing array of edge sizes. Length of argument list must be equal or larger than getNumEdges(). All edge sizes are copied.

Showing of edge sizes must be switched on in order to be visible.

Parameters:
size - array with new edge size for all polygons
Since:
JavaView 3.09

assureEdgeSizes

public void assureEdgeSizes()
Assures respectively allocates correct length of edge size vector. Length of vector is equal to length of edge array. Dimension of size vector is equal to maximal number of vertices.

Since:
JavaView 3.09

getEdges

public PiVector[] getEdges()
Get the array of vertex indices which define the polygon for readonly purpose. Also note, that the actual size of the array may be larger than m_numEdges+1 for efficiency reasons. Therefore, do not make use of the length of the array.

Since:
JavaView 2.69

update

public boolean update(java.lang.Object event)
Update the class whenever a child has changed. Method is usually invoked from the children.

Specified by:
update in interface PsUpdateIf
Overrides:
update in class PgPointSet

paint

public void paint(PvGeometryIf dc)
Major rendering method fills an internal container class supplied by the display. See jv.project.PgGeometryIf for detailed information.

Specified by:
paint in interface PgGeometryIf
Overrides:
paint in class PgPointSet
See Also:
PgGeometryIf

getLengthOfEdge

public double getLengthOfEdge(int edgeInd)
Compute length of given edge of polygon.

Since:
JavaView 3.12.002

getLength

public double getLength()
Compute geometric length of polygon as the sum of all edge lengths. If polygon is closed then the distance of the first and last vertex is added to the polygon length.

Returns:
length of polygon
See Also:
isClosed()

isClosed

public boolean isClosed()
Check whether polygon is closed, i.e.if endpoints are connected by additional edge.

Returns:
flag whether polygon is closed.
See Also:
setClosed(boolean)

setClosed

public void setClosed(boolean flag)
Set flag that polygon is closed. In the previous version 1.00 an additional vertex might have been allocated. This version just sets a flag.

Parameters:
flag - true closes polygons
See Also:
isClosed()

computeEight

public void computeEight(int numPoints)
Compute figure eight in xy-plane with given radius including vertex normals.

Parameters:
numPoints - Discretization of polygon

computeCircle

public void computeCircle(int numPoints,
                          double radius)
Compute circle centered at origin in xy-plane with given radius including vertex normals.

Parameters:
numPoints - Discretization of polygon
radius - Radius of circle

blend

public boolean blend(double s,
                     PgGeometry ag,
                     double t,
                     PgGeometry bg)
Blend between two polygons using this = s*ag + t*bg.

Specified by:
blend in interface PgGeometryIf
Overrides:
blend in class PgPointSet
Parameters:
s - weight of vertices of first geometry
ag - first geometry used for blending
t - weight of vertices of second geometry
bg - second geometry used for blending
Returns:
true on success

makeVertexNormals

public boolean makeVertexNormals()
Compute normals at vertices as edge bisectors with unit length. All normals are oriented to show to the same side of the polygon as the first normal which is non-degenerate.

This method correctly handles polygons with sequences of parallel edges and multiple vertices.

Overrides:
makeVertexNormals in class PgPointSet

makeNormals

public void makeNormals()
Deprecated. since JavaView 3.50.002, use makeVertexNormals().

Compute normals at vertices as edge bisectors with unit length.


makeBiNormals

public void makeBiNormals()
Compute binormals at vertices which are orthogonal to both adjacent edges. All binormals lie in the span of the two edges of a vertex and all binormals have the same orientation as the normal vector of the enclosed patch surface.

This method correctly handles polygons with sequences of parallel edges and multiple vertices.


makeOffsetNormals

public void makeOffsetNormals()
Compute normals at vertices as edge bisectors whose tip lies on an offset==1 curve. All normals are oriented to show to the same side of the polygon as the first normal which is non-degenerate.

This method correctly handles polygons with sequences of parallel edges and multiple vertices.


makeCurvatureNormals

public void makeCurvatureNormals()
Compute normals at vertices as edge bisectors with length equal to (Pi-vertexAngle). All normals are oriented to show to the same side of the polygon as the first normal which is non-degenerate.

This method correctly handles polygons with sequences of parallel edges and multiple vertices.


makeNormals

public void makeNormals(int type,
                        double length)
Compute normals at vertices which lie in the span of the adjacent edges. All normals are oriented to show to the same side of the polygon as the first normal which is non-degenerate.

This method correctly handles polygons with sequences of parallel edges and multiple vertices.


checkTriangleCut

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

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.

Parameters:
vertexInd - index of middle vertex which might be cut off
normal - normal of polygon, used as orientation, i.e. polygon runs counter-clockwise around normal

triangulate

public 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. The method can handle non-convex polygons.

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.

Returns:
Array of vectors each containing the vertex indices of a triangle.

intersectionWithLine

public PvPickEvent intersectionWithLine(PdVector rayBase,
                                        PdVector rayDir)
Find intersection of polygon with a given ray. Closest polygon edge is located. Method is used for interactive picking.

Specified by:
intersectionWithLine in interface PgGeometryIf
Overrides:
intersectionWithLine in class PgPointSet
Parameters:
rayBase - base point of ray eventually hitting the polygon set
rayDir - direction point of ray eventually hitting the polygon set
Returns:
full information about hit polygon, barycentric coordinates etc.

getFVector

public int[] getFVector()
Compute F-vector that is the number of points, edges, faces, etc.

Overrides:
getFVector in class PgPointSet

flipOrientation

public 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. The superclass multiplies each normal vector with -1.

Overrides:
flipOrientation in class PgPointSet

makeEdgeColorsFromXYZ

public boolean makeEdgeColorsFromXYZ()
Create color from the edge position within its bounding box which is interpreted as RGB cube. If dimension of vertices is smaller than three then only the first vertex components are used in the color computation.

Since:
JavaView 2.69

makeEdgeColorsFromZ

public boolean makeEdgeColorsFromZ()
Create color from the vertical z-height within its bounding box ranging from low blue to high red. If dimension of vertices is smaller than three then the highest vertex component is used instead of the z-component in the color computation.

Since:
JavaView 2.69

makeEdgeColorsFromZHue

public boolean makeEdgeColorsFromZHue()
Create color from the vertical z-height within its bounding box ranging through hue rainbow. If dimension of vertices is smaller than three then the highest vertex component are used instead of the z-component in the color computation.

Since:
JavaView 2.69

isShowingSmoothLighting

public boolean isShowingSmoothLighting()
Determines whether smooth lighting is enabled, requires vertex normals.

Since:
JavaView 2.69

showSmoothLighting

public void showSmoothLighting(boolean flag)
Set flag to enable smooth lighting, requires vertex normals.

Since:
JavaView 2.69

isShowingSmoothEdgeColors

public boolean isShowingSmoothEdgeColors()
Determines whether smooth coloring of edges is enabled, currently requires vertex colors.

Since:
JavaView 2.69

showSmoothEdgeColors

public void showSmoothEdgeColors(boolean flag)
Set flag to enable smooth coloring of edges, currently requires vertex colors.

Since:
JavaView 2.69

isShowingEdgeFromVertexColors

public boolean isShowingEdgeFromVertexColors()
Determines whether smooth edge coloring uses vertex colors at vertices, requires vertex colors.

Since:
JavaView 2.69

showEdgeFromVertexColors

public void showEdgeFromVertexColors(boolean flag)
Set flag to enable smooth edge coloring using vertex colors at vertices, requires vertex colors.

Since:
JavaView 2.69

makeEdgeFromVertexColors

public boolean makeEdgeFromVertexColors()
Create edge colors as average of the color of its two vertices. Vertex colors must be available.

Since:
JavaView 2.69

makeVertexFromEdgeColors

public boolean makeVertexFromEdgeColors()
Create vertex colors as average of color of all adjacent edges. Edge colors must be available.

Since:
JavaView 2.69

makeEdgeColorsFromLength

public boolean makeEdgeColorsFromLength()
Create edge color from the polygon length ranging through hue rainbow. If polygon is closed then both end points have the same color red, otherwise color ranges from red to bluish.

Since:
JavaView 2.70

makeVertexColorsFromLength

public boolean makeVertexColorsFromLength()
Create vertex color from the polygon length ranging through hue rainbow. If polygon is closed then both end points have the same color red, otherwise color ranges from red to bluish.

Since:
JavaView 2.70

JavaView© v3.95.000

The software JavaView© is copyright protected. All Rights Reserved.