Class PgPolygon
- java.lang.Object
-
- jv.object.PsObject
-
- jv.project.PgGeometry
-
- jv.geom.PgPointSet
-
- jv.geom.PgPolygon
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, PsUpdateIf, PgGeometryIf
- Direct Known Subclasses:
- PgBezierCurve, PgBndPolygon, PgCircle, PgCircleF, PgCurveF, PgFunction, PgParmCurve, PgPlotF, PgPointF, PgPolygonOnElementSet, PgSegmentF
public class PgPolygon extends PgPointSet
Base class for polygons given as consecutive list of polygon vertices. The class interprets the vertices in the vertex array of its superclassPgPointSetas consecutive 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
PgPointSetfor 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- Author:
- Konrad Polthier
- Version:
- 22.09.15, 3.30 revised (kp) Getting and setting of smooth edge colors corrected.
04.07.06, 3.20 revised (kp) Length of edgeColor, edgeSize etc. is now m_maxNumEdges.
22.10.05, 3.10 revised (kp) Method merge() implemented.
26.04.03, 3.00 revised (kp) Global revision including implementation of colors and normals.
22.03.02, 2.60 revised (ur) Internationalization.
07.07.00, 2.50 revised (kp) Edge methods added and jvx exchange.
02.04.00, 2.00 revised (kp) PdColor replaced with Color in lists.
00.00.98, 1.00 created (kp)
-
-
Field Summary
Fields Modifier and Type Field and Description static intBINORMALstatic intCURVATURE_NORMALstatic intNORMALstatic intOFFSET_NORMAL-
Fields inherited from class jv.object.PsObject
HAS_BOUNDARY_PANEL, 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, BLEND_ALPHA, BLEND_MATERIAL, BLEND_REPLACE, FILTER_DIRECT, FILTER_LINEAR, FILTER_QUADRATIC, 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, PERIODIC_BOTH, PERIODIC_HEIGHT, PERIODIC_NONE, PERIODIC_WIDTH, PROJ_KLEIN_BALL, PROJ_PARALLEL, PROJ_POINCARE_BALL, PROJ_STEREOGRAPHIC, PROJ_UPPER_HALFSPACE, SIDE_BACK, SIDE_BOTH, SIDE_FRONT, SIDE_NONE
-
-
Constructor Summary
Constructors Constructor and Description 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
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method and Description voidassureEdgeColors()Assures respectively allocates correct length of edge color array.voidassureEdgeNormals()Assures respectively allocates correct length of edge normal array.voidassureEdgeSizes()Assures respectively allocates correct length of edge size vector.booleanblend(double s, PgGeometry ag, double t, PgGeometry bg)Blend between two polygons usingthis = s*ag + t*bg.booleancheckTriangleCut(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.Objectclone()Duplicate geometry by recursively cloning all instance variables except inspector panels and lists of registered listeners.voidcomputeCircle(int numPoints, double radius)Compute circle centered at origin in xy-plane with given radius including vertex normals.voidcomputeEight(int numPoints)Compute figure eight in xy-plane with given radius including vertex normals.voidcopy(PsObject object)Copy instance variables by duplication, not by copying a reference.voidflipOrientation()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.PdVectorgetEdgeSizes()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.ColorgetGlobalEdgeColor()Get global edge color which is used if no local colors are available.java.awt.ColorgetGlobalEdgeNormalColor()Get global element color which is used if no local colors are available.doublegetGlobalEdgeNormalLength()Get length factor of normal vectors when drawn in display.doublegetGlobalEdgeNormalSize()Get thickness in pixels of normals when drawn in display.doublegetGlobalEdgeSize()Get thickness in pixels of edge when drawn in display.java.awt.ColorgetGlobalEdgeTagColor()Get global color of tagged edges.java.awt.ColorgetGlobalPolygonColor()Deprecated.use getGlobalEdgeColor()doublegetGlobalPolygonSize()Deprecated.use getGlobalEdgeSize()java.awt.ColorgetGlobalPolygonTagColor()Deprecated.use getGlobalEdgeTagColor()PgJvxSrcgetJvx()Fills a geometry object with data from this instance, for example, to print to file.doublegetLength()Compute geometric length of polygon as the sum of all edge lengths.doublegetLengthOfEdge(int edgeInd)Compute length of given edge of polygon.intgetNumEdges()Get number of edges of polygon.booleanhasEdgeColors()Check if edge colors have been allocated.booleanhasEdgeNormals()Check if edge normals have been allocated.voidinit()Initialize and reset instance variables after call to super.init().PvPickEventintersectionWithLine(PdVector rayBaseWorld, PdVector rayDirWorld)Find intersection of polygon with a given ray.booleanisClosed()Check whether polygon is closed, i.e.if endpoints are connected by additional edge.booleanisShowingEdgeColorFromVertices()Determines whether smooth edge coloring uses vertex colors at vertices, requires vertex colors.booleanisShowingEdgeColors()Determine whether drawing of edge colors is enabled.booleanisShowingEdgeFromVertexColors()Deprecated.since JavaView 3.96.031, use #isShowingEdgeColorFromVertices()booleanisShowingEdgeLabels()Determine whether showing of edge labels is enabled.booleanisShowingEdgeNormalArrow()Determine whether drawing of arrow at edge normals is enabled.booleanisShowingEdgeNormals()Determine whether drawing of edge normals is enabled.booleanisShowingEdges()Determine whether drawing of edges of polygon is enabled.booleanisShowingEdgeSizes()Determine whether drawing of edge sizes is enabled.booleanisShowingPolygonColors()Deprecated.use isShowingEdgeColors()booleanisShowingPolygonEndArrow()Determine whether drawing of arrow at last point of polygon is enabled.booleanisShowingPolygonStartArrow()Determine whether drawing of arrow at first point of polygon is enabled.booleanisShowingSmoothEdgeColors()Determines whether smooth coloring of edges is enabled, currently requires vertex colors.booleanisShowingSmoothLighting()Determines whether smooth lighting is enabled, requires vertex normals.voidmakeBiNormals()Compute binormals at vertices which are orthogonal to both adjacent edges.voidmakeCurvatureNormals()Compute normals at vertices as edge bisectors with length equal to (Pi-vertexAngle).booleanmakeEdgeColorsFromLength()Create edge color from the polygon length ranging through hue rainbow.booleanmakeEdgeColorsFromXYZ()Create color from the edge position within its bounding box which is interpreted as RGB cube.booleanmakeEdgeColorsFromZ()Create color from the vertical z-height within its bounding box ranging from low blue to high red.booleanmakeEdgeColorsFromZHue()Create color from the vertical z-height within its bounding box ranging through hue rainbow.booleanmakeEdgeFromVertexColors()Create edge colors as average of the color of its two vertices.voidmakeNormals()Deprecated.since JavaView 3.50.002, use makeVertexNormals().voidmakeNormals(int type, double length)Compute normals at vertices which lie in the span of the adjacent edges.voidmakeOffsetNormals()Compute normals at vertices as edge bisectors whose tip lies on an offset==1 curve.booleanmakeVertexColorsFromLength()Create vertex color from the polygon length ranging through hue rainbow.booleanmakeVertexFromEdgeColors()Create vertex colors as average of color of all adjacent edges.booleanmakeVertexNormals()Compute normals at vertices as edge bisectors with unit length.booleanmerge(PgGeometryIf aGeom)Merge polygon with current object and store union of both objects in 'this'.voidpaint(PvGeometryIf dc)Major rendering method fills an internal container class supplied by the display.voidremoveEdgeColors()Remove individual edge colors from a polygon and use the global polygon color instead.voidremoveEdgeNormals()Remove local edge normals from a geometry.voidremoveEdgeSizes()Remove edge sizes from a geometry.int[]removeMarkedVertices()Remove vertices marked with tag PsObject#IS_DELETED from polygons.voidsetClosed(boolean flag)Set flag that polygon is closed.voidsetDimOfVertices(int dim)Set dimension of vertices.booleansetEdgeColor(int ind, java.awt.Color aColor)Copy new color to edge color at specified position in the color listvoidsetEdgeColors(java.awt.Color[] color)Assign edge colors of list to existing array of edge colors.booleansetEdgeNormal(int ind, PdVector aNormal)Copy new normal to edge normal at specified position in the normal listvoidsetEdgeNormals(PdVector[] normal)Copy edge normals of list to existing array of edge normals.voidsetEdgeSizes(PdVector size)Copy edge sizes of list to existing array of edge sizes.voidsetGlobalEdgeColor(java.awt.Color color)Set global edge color to be used if no local colors are available.voidsetGlobalEdgeNormalColor(java.awt.Color color)Set global normal color to be used if no local colors are available.voidsetGlobalEdgeNormalLength(double length)Get length factor of normal vectors when drawn in display.voidsetGlobalEdgeNormalSize(double size)Get thickness in pixels of normals when drawn in display.voidsetGlobalEdgeSize(double size)Set thickness in pixels of edge when drawn in display.voidsetGlobalEdgeTagColor(java.awt.Color color)Set global color of tagged edges.voidsetGlobalPolygonColor(java.awt.Color color)Deprecated.use setGlobalEdgeColor()voidsetGlobalPolygonSize(double size)Deprecated.use setGlobalEdgeSize()voidsetGlobalPolygonTagColor(java.awt.Color color)Deprecated.use setGlobalEdgeTagColor()voidsetJvx(PgJvxSrc src)Fill this instance with data from a geometry source, for example, previously read from file.voidsetNumVertices(int numVertices)Adjust the number of vertices of the polygon.voidshowEdgeColorFromVertices(boolean flag)Set flag to enable smooth edge coloring using vertex colors at vertices, requires vertex colors.voidshowEdgeColors(boolean flag)Set flag to enable drawing of edge colors.voidshowEdgeFromVertexColors(boolean flag)Deprecated.since JavaView 3.96.031, use #showEdgeColorFromVertices(boolean)voidshowEdgeLabels(boolean flag)Set flag to enable drawing of edge labels in display.voidshowEdgeNormalArrow(boolean flag)Set flag to enable drawing of arrow at edge normals.voidshowEdgeNormals(boolean flag)Set flag to enable drawing of edge normals.voidshowEdges(boolean flag)Set flag to enable drawing of edges of polygon.voidshowEdgeSizes(boolean flag)Set flag to enable drawing of edge sizes.voidshowPolygonColors(boolean flag)Deprecated.use showEdgeColors(boolean)voidshowPolygonEndArrow(boolean flag)Set flag to enable drawing of arrow at last point of polygons.voidshowPolygonStartArrow(boolean flag)Set flag to enable drawing of arrow at first point of polygons.voidshowSmoothEdgeColors(boolean flag)Set flag to enable smooth coloring of edges, currently requires vertex colors.voidshowSmoothLighting(boolean flag)Set flag to enable smooth lighting, requires vertex normals.java.lang.StringtoString()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.booleanupdate(java.lang.Object event)Update the class whenever a child has changed.voiduseGlobalPolygonColor(boolean flag)Deprecated.use showEdgeColors(boolean)-
Methods inherited from class jv.geom.PgPointSet
addGeometryItem, addVectorField, addVertex, applyAmbientMatrix, applyModelingMatrix, assureVertexColors, assureVertexNormals, assureVertexSizes, assureVertexTextures, clearTagVertex, computeCone, computeCylinder, computeDisk, computePlane, computeRotation, computeSnail, computeSphere, computeTorus, copySelect, getAmbientBounds, getBounds, getCenterOfBndBox, getCenterOfGravity, getDimOfColors, getDimOfTextures, getDimOfVectors, getEulerCharacteristic, getGlobalVectorColor, getGlobalVectorLength, getGlobalVectorSize, getGlobalVertexColor, getGlobalVertexNormalColor, getGlobalVertexNormalLength, getGlobalVertexNormalSize, getGlobalVertexSize, getGlobalVertexTagColor, getIndexOfVectorField, getMarkedVertices, 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, makeVertexColorsFromNormal, makeVertexColorsFromXYZ, makeVertexColorsFromZ, makeVertexColorsFromZHue, makeVertexTextureFromBndBox, makeVertexTextureFromCylinder, makeVertexTextureFromSphere, makeVertexTextureFromUV, projectFromAmbientSpace, projectToSphere, reflect, removeAllVectorFields, removeHiddenVectorFields, 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, setMaxNumVertices, 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, convertWorldToModel, 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:
initin classPgPointSet
-
getJvx
public PgJvxSrc getJvx()
Fills a geometry object with data from this instance, for example, to print to file.- Specified by:
getJvxin interfacePgGeometryIf- Overrides:
getJvxin classPgPointSet- 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:
setJvxin interfacePgGeometryIf- Overrides:
setJvxin classPgPointSet- Parameters:
src- a geometry source used to fill this instance with data.- Version:
- 17.11.01, 1.10 revised (kp) Update globalPolygonSize even if 0.
-
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 tonull.- Specified by:
clonein interfacePgGeometryIf- Overrides:
clonein classPgPointSet- See Also:
copy(PsObject)- Version:
- 11.12.04, 1.20 revised (kp) Missing clone of edge, edgeNormal and edgeColor added.
05.07.00, 1.00 created (kp)
-
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:
copyin classPgPointSet- See Also:
clone()- Version:
- 24.01.05, 1.50 revised (kp) Copy all other instance variables like colors and normals.
08.11.02, 1.10 revised (kp) Argument changed to PsObject from PgGeometry.
-
toString
public java.lang.String toString()
Create a multi-line string representation with detailed information about all instance variables.- Specified by:
toStringin interfacePgGeometryIf- Overrides:
toStringin classPgPointSet
-
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:
setDimOfVerticesin classPgPointSet- Version:
- 11.11.04, 1.00 created (kp)
-
setNumVertices
public void setNumVertices(int numVertices)
Adjust the number of vertices of the polygon.Internally the number of edges are updated.
- Overrides:
setNumVerticesin classPgPointSet
-
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).- 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 setGlobalEdgeSize()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
- Version:
- 26.04.03, 1.00 created (kp)
-
getGlobalEdgeNormalLength
public double getGlobalEdgeNormalLength()
Get length factor of normal vectors when drawn in display.- Since:
- JavaView 2.69
- Version:
- 26.04.03, 1.00 created (kp)
-
getGlobalEdgeNormalSize
public double getGlobalEdgeNormalSize()
Get thickness in pixels of normals when drawn in display.- Since:
- JavaView 2.69
- Version:
- 26.04.03, 1.00 created (kp)
-
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
- Version:
- 26.04.03, 1.00 created (kp)
-
setGlobalEdgeNormalLength
public void setGlobalEdgeNormalLength(double length)
Get length factor of normal vectors when drawn in display.- Since:
- JavaView 2.69
- Version:
- 26.04.03, 1.00 created (kp)
-
setGlobalEdgeNormalSize
public void setGlobalEdgeNormalSize(double size)
Get thickness in pixels of normals when drawn in display.- Since:
- JavaView 2.69
- Version:
- 26.04.03, 1.00 created (kp)
-
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 edgeaColor- 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 edgeaNormal- 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
- Version:
- 07.02.04, 1.00 created (kp)
-
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
- Version:
- 07.02.04, 1.00 created (kp)
-
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
- Version:
- 07.02.04, 1.00 created (kp)
-
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
- Version:
- 07.02.04, 1.00 created (kp)
-
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
- Version:
- 26.04.03, 1.00 created (kp)
-
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:
updatein interfacePsUpdateIf- Overrides:
updatein classPgPointSet- Parameters:
event- carries a lot of information- Returns:
- true if event has been handled, otherwise false
- See Also:
PsObject.setParent(PsUpdateIf),PsObject.getFather(),PsObject.addUpdateListener(PsUpdateIf)
-
paint
public void paint(PvGeometryIf dc)
Major rendering method fills an internal container class supplied by the display. Seejv.project.PgGeometryIffor detailed information.- Specified by:
paintin interfacePgGeometryIf- Overrides:
paintin classPgPointSet- See Also:
PgGeometryIf
-
getLengthOfEdge
public double getLengthOfEdge(int edgeInd)
Compute length of given edge of polygon.- Since:
- JavaView 3.12.002
- Author:
- Konrad Polthier
- Version:
- 18.03.04, 1.00 created (kp)
-
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-truecloses polygons- See Also:
isClosed()- Version:
- 07.07.00, 1.10 revised (kp) Just set a flag, no longer allocated additional vertex.
-
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 polygonradius- Radius of circle
-
removeMarkedVertices
public int[] removeMarkedVertices()
Remove vertices marked with tag PsObject#IS_DELETED from polygons. It is neccessary to keep a valid polygon set after removal of vertices in the superclass.- Overrides:
removeMarkedVerticesin classPgPointSet- Returns:
- array with indices of new positions of vertices
- See Also:
PgPointSet.removeMarkedVertices()- Version:
- 23.10.05, 1.00 created (kp) From PgPointSet#removeMarkedVertices().
-
merge
public boolean merge(PgGeometryIf aGeom)
Merge polygon with current object and store union of both objects in 'this'. Number of points and polygons is the sum of both objects unless last vertex of this polygon is PuMath.EPS close to first vertex of argument polygon, which would be identified.Polygon will not be closed, even if it was closed before.
The merged geometry will have local colors allocated and assignd if
1. both the global color of both geometries are different, or 2. either geometry has local colors.If local colors are allocated but one of the geometries does not have local colors then its local colors are be assumed to be its global color. The merged geometry will show globalVertexColors if1. the global color of both geometries is the same, and 2. both geometries are showing the global color.In all other cases the merged geometry will show local colors. The global color of the merged geometry is never changed.- Specified by:
mergein interfacePgGeometryIf- Overrides:
mergein classPgPointSet- Parameters:
aGeom- Polygon set to be merged into 'this'- Returns:
trueif method was successfull- Author:
- Konrad Polthier
- Version:
- 22.10.05, 1.00 created (kp)
-
blend
public boolean blend(double s, PgGeometry ag, double t, PgGeometry bg)Blend between two polygons usingthis = s*ag + t*bg.- Specified by:
blendin interfacePgGeometryIf- Overrides:
blendin classPgPointSet- Parameters:
s- weight of vertices of first geometryag- first geometry used for blendingt- weight of vertices of second geometrybg- second geometry used for blending- Returns:
- true on success
- Author:
- Konrad Polthier
- Version:
- 10.11.01, 2.00 revised (kp) Interpolation of material properties enabled.
31.12.97, 1.00 created (kp)
-
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:
makeVertexNormalsin classPgPointSet- Author:
- Konrad Polthier
- Version:
- 31.07.04, 3.00 revised (kp) Renamed to makeVertexNormals() from makeNormals().
09.06.01, 2.00 revised (kp) Full revision to incorporate all degenerate cases.
08.06.01, 1.00 created (kp) Created from former version of makeBiNormals().
-
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.
- Author:
- Konrad Polthier
- Version:
- 08.06.01, 1.00 revised (kp)
08.06.01, 1.00 created (kp) Method simply calls makeNormals()
-
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.
- Author:
- Konrad Polthier
- Version:
- 08.06.01, 1.00 revised (kp)
08.06.01, 1.00 created (kp) Method simply calls makeNormals()
-
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.
- Author:
- Konrad Polthier
- Version:
- 08.06.01, 1.00 revised (kp)
08.06.01, 1.00 created (kp) Method simply calls makeNormals()
-
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.
- Author:
- Konrad Polthier
- Version:
- 15.07.05, 2.30 revised (kp) Bug with 2d normals removed, vectors now remain 2d.
15.02.05, 2.20 revised (ep) Bug with 2d straight segments removed.
22.11.01, 2.10 revised (kp) Bug with polygons of three vertices removed.
09.06.01, 2.00 revised (kp) Full revision to incorporate all degenerate cases.
08.06.01, 1.00 created (kp) Created from former version of makeBiNormals().
-
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 offnormal- normal of polygon, used as orientation, i.e. polygon runs counter-clockwise around normal- Author:
- Konrad Polthier
- Version:
- 10.6.98, 1.10 revised (kp) for Java.
10.6.90, 1.00 created (kp) Original Fortran version "chckct.f"
-
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.
- Author:
- Konrad Polthier
- Version:
- 12.02.01, 1.20 revised (kp) Remove usage of normal vectors used in PgUtil.triangulate.
10.06.98, 1.10 revised (kp) Rewritten for Java.
10.06.90, 1.00 created (kp) Original Fortran version "triplg.f".
-
intersectionWithLine
public PvPickEvent intersectionWithLine(PdVector rayBaseWorld, PdVector rayDirWorld)
Find intersection of polygon with a given ray. Closest polygon edge is located. Method is used for interactive picking. Base and direction of ray must be given in 3D world coordinates.- Specified by:
intersectionWithLinein interfacePgGeometryIf- Overrides:
intersectionWithLinein classPgPointSet- Parameters:
rayBaseWorld- 3D base point of ray eventually hitting the surface.rayDirWorld- 3D direction vector of ray eventually hitting the surface.- Returns:
- full information about hit element, barycentric coordinates etc.
- Author:
- Konrad Polthier
- Version:
- 04.09.06, 2.31 revised (kp) Bary now contains element index.
01.04.06, 2.30 revised (kp) Conversion of world to model coordinate move to this method from PvDisplay.
15.02.05, 2.20 revised (kp) Use horizontal distance, diameter constraint removed.
25.03.01, 2.10 revised (kp) Use point on geometry as vertex, use rayBase as viewBase.
04.03.01, 2.00 revised (kp) Rewritten intersectionWithLine() to handle vertices in dim 2 and 3.
02.12.00, 1.10 revised (kp) Use minDist as distance, use rayBase as vertex.
02.12.00, 1.00 created (kp) From similar method PgPolygonSet.
-
getFVector
public int[] getFVector()
Compute F-vector that is the number of points, edges, faces, etc.- Overrides:
getFVectorin classPgPointSet- Version:
- 21.12.02, 1.20 revised (kp) Calculation corrected which came from a cut-and-paste error.
20.12.01, 1.10 revised (kp) Renamed to getFVector() from getEulerNumbers().
04.11.01, 1.00 created (kp)
-
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:
flipOrientationin classPgPointSet- Author:
- Konrad Polthier
- Version:
- 22.11.01, 1.00 created (kp)
-
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
- Author:
- Konrad Polthier
- Version:
- 26.04.03, 1.00 created (kp)
-
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
- Author:
- Konrad Polthier
- Version:
- 16.04.05, 1.20 revised (kp) Both colors flipped to better sync with Maple.
26.04.03, 1.00 created (kp)
-
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
- Author:
- Konrad Polthier
- Version:
- 17.04.05, 1.20 revised (kp) Expand color spectrum to [magenta,red] from [blue,red].
26.04.03, 1.00 created (kp)
-
isShowingSmoothLighting
public boolean isShowingSmoothLighting()
Determines whether smooth lighting is enabled, requires vertex normals.- Since:
- JavaView 2.69
- Version:
- 26.04.03, 1.00 created (kp)
-
showSmoothLighting
public void showSmoothLighting(boolean flag)
Set flag to enable smooth lighting, requires vertex normals.- Since:
- JavaView 2.69
- Version:
- 26.04.03, 1.00 created (kp)
-
isShowingSmoothEdgeColors
public boolean isShowingSmoothEdgeColors()
Determines whether smooth coloring of edges is enabled, currently requires vertex colors.- Since:
- JavaView 2.69
- Version:
- 26.04.03, 1.00 created (kp)
-
showSmoothEdgeColors
public void showSmoothEdgeColors(boolean flag)
Set flag to enable smooth coloring of edges, currently requires vertex colors.- Since:
- JavaView 2.69
- Version:
- 26.04.03, 1.00 created (kp)
-
isShowingEdgeColorFromVertices
public boolean isShowingEdgeColorFromVertices()
Determines whether smooth edge coloring uses vertex colors at vertices, requires vertex colors.- Since:
- JavaView 2.69
- Version:
- 26.04.03, 1.00 created (kp)
-
showEdgeColorFromVertices
public void showEdgeColorFromVertices(boolean flag)
Set flag to enable smooth edge coloring using vertex colors at vertices, requires vertex colors.- Since:
- JavaView 2.69
- Version:
- 26.04.03, 1.00 created (kp)
-
isShowingEdgeFromVertexColors
public boolean isShowingEdgeFromVertexColors()
Deprecated. since JavaView 3.96.031, use #isShowingEdgeColorFromVertices()Determines whether smooth edge coloring uses vertex colors at vertices, requires vertex colors.- Since:
- JavaView 2.69
- Version:
- 26.04.03, 1.00 created (kp)
-
showEdgeFromVertexColors
public void showEdgeFromVertexColors(boolean flag)
Deprecated. since JavaView 3.96.031, use #showEdgeColorFromVertices(boolean)Set flag to enable smooth edge coloring using vertex colors at vertices, requires vertex colors.- Since:
- JavaView 2.69
- Version:
- 26.04.03, 1.00 created (kp)
-
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
- Author:
- Konrad Polthier
- Version:
- 24.04.03, 1.00 created (kp)
-
makeVertexFromEdgeColors
public boolean makeVertexFromEdgeColors()
Create vertex colors as average of color of all adjacent edges. Edge colors must be available.- Since:
- JavaView 2.69
- Author:
- Konrad Polthier
- Version:
- 24.04.03, 1.00 created (kp)
-
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
- Author:
- Konrad Polthier
- Version:
- 02.05.03, 1.00 created (kp)
-
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
- Author:
- Konrad Polthier
- Version:
- 02.05.03, 1.00 created (kp)
-
-
"