Class PgPolygonSet
- java.lang.Object
-
- jv.object.PsObject
-
- jv.project.PgGeometry
-
- jv.geom.PgPointSet
-
- jv.geom.PgPolygonSet
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, PsUpdateIf, PgGeometryIf
- Direct Known Subclasses:
- PgPolygonSetOnElementSet
public class PgPolygonSet extends PgPointSet
Basic class for collections of lines and polygons. The class contains an array with polygons, each polygon is given by a list of vertex indices in the vertex array of its superclassPgPointSet. Each polygon may have a different number of vertices.The dimension of all points is determined as argument of the constructor and cannot be changed later. See
PgPointSetfor details about allocation and access.The number of vertices per polygon may be the same for all polygons of the polygon set, and assigned using the method
setDimOfPolygons(int num). Or, the size of polygons may differ in which casegetDimOfPolygons()==-1, which is the default case. The advantage of the first case is, that the class is able to do more memory allocations automatically.There exist several utility functions to allocate and modify the number of polygons, for example,
allocatessetNumPolygons(int num)numpolygons. Internally, there exists a cache to reduce the number of actual memory allocations. The size of the cache is managed by protected methods.Whenever the number of polygons is changed, the class automatically adjusts the size of those polygon properties which are currently in use, i.e. whose array is not
null.Applications may modify the entries of an polygon and of polygon properties by direct method calls such as
which sets the polygon with index ind equal to the components of a vector v by copying. Alternatively, if an application modifies a larger number of polygons then the application may prefer to obtain the polygon array from the polygon set and directly modify the arraysetPolygon(int ind, PiVector v)PiVector [] polygon = polygonSet.The same choice is available for arrays containing polygon properties. Note, that the actual size of the polygon array may be larger than m_numPolygons efficiency reasons. Therefore, do not use polygon.length but use getNumPolygons().getPolygons(); for (int i=0; i<pointSet.getNumPolygons(); i++) polygon[i].copy(v);This class contains mainly basic methods for memory allocation and access to instance variables. Geometric methods operating on polygon sets such as computing a specific surface or computing the intersection of two surfaces are available in special workshop classes as extensions outside the base JavaView packages.
A good starting to obtain further insight are methods like
PgPolygon.computeEight(int)(if source code access to JavaView is available), or the tutorial applets of JavaView.- See Also:
- Serialized Form
- Author:
- Konrad Polthier
- Version:
- 22.09.15, 2.90 revised (kp) Getting and setting of smooth edge colors corrected.
18.04.10, 2.80 revised (kp) Instance sharing implemented.
11.07.02, 2.70 revised (kp) Explicit methods for removal of colors and normals added.
22.03.02, 2.60 revised (ur) Internationalization.
21.07.00, 2.50 revised (kp) Global properties of normals split into vertex and element part.
02.04.00, 2.00 revised (kp) PdColor replaced with Color in lists.
04.10.99, 1.10 revised (ur) m_dimOfPolygons added.
23.09.99, 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 PgPolygonSet()Constructor of a polygon set in three-dimensional space.PgPolygonSet(int aVertexDim)Constructor of a polygon set in a space of given dimension.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method and Description intaddPolygon(PiVector poly)Add new polygon to the end of the polygon list.booleanapplyModelingMatrix()Multiply the modeling matrix to all vertices and vectors.booleanassureDimOfPolygons()Assure correctness of value m_dimOfPolygons specifying the number of vertices per polygon.voidassurePolygonColors()Assures respectively allocates correct length of polygon color array.voidassurePolygonNormals()Assures respectively allocates correct length of polygon normal array.voidassurePolygonSizes()Assures respectively allocates correct length of polygon size vector.booleanblend(double s, PgGeometry ag, double t, PgGeometry bg)Blend between two polygon sets usingthis = s*ag + t*bg.voidclearTagPolygon(int ind, int aTag)Clear a single tag of a polygon.java.lang.Objectclone()Duplicate geometry by recursively cloning all instance variables except inspector panels and lists of registered listeners.static PgPolygonSetconvert(PgPolygon poly)Convert a PgPolygon into a PgPolygonSet.voidcopy(PsObject object)Copy instance variables by duplication, not by copying a reference.voidcopyPolygonSet(PgPolygonSet geom)Copy instance variables of this class but not of the superclass.voidflipOrientation()Change orientation of the polygon, i.e. the end point becomes the first point.intgetDimOfPolygons()Retrieve number of vertices per polygon, if it is the same for all polygons, otherwise return -1.int[]getFVector()Compute F-vector that is the number of points, edges, faces, etc.java.awt.ColorgetGlobalPolygonColor()Get global polygon color which is used if no local colors are available.java.awt.ColorgetGlobalPolygonNormalColor()Get global element color which is used if no local colors are available.doublegetGlobalPolygonNormalLength()Get length factor of normal vectors when drawn in display.doublegetGlobalPolygonNormalSize()Get thickness in pixels of normals when drawn in display.doublegetGlobalPolygonSize()Get thickness in pixels of polygon when drawn in display.java.awt.ColorgetGlobalPolygonTagColor()Get global color of tagged polygons.PgJvxSrcgetJvx()Fills a geometry object with data from this instance, for example, to print to file.doublegetLength()Compute total length of all polygons.doublegetLengthOfPolygon(int ind)Compute length of a single polygon with given index.intgetMaxDimOfPolygons()Get maximal number of vertices appearing in a polygon.intgetMaxNumPolygons()Get total length of allocated polygon array.intgetNumEdges()Calculate total number of edges of all polygons.intgetNumPolygons()Get number of polygons in vertex array.PiVectorgetPolygon(int ind)Get a reference to an individual polygon array with vertex indices.PgPolygongetPolygonAsPgPolygon(int polyId)Get the specified polygon from a polygon set as PgPolygon.java.awt.ColorgetPolygonColor(int ind)Get a reference to an individual polygon color.java.awt.Color[]getPolygonColors()Get color array for read and write access, but do not modify the size of any color vector.PdVectorgetPolygonNormal(int ind)Get a reference to an individual polygon normal.PdVector[]getPolygonNormals()Get polygon normal array for read and write access, but do not modify the size of any normal vector.PiVector[]getPolygons()Get polygon array for read and write access.doublegetPolygonSize(int ind)Get size of a single polygon.PdVectorgetPolygonSizes()Get polygon size array for read and write access.PdVector[]getPolygonVertices(int ind)Get an array with pointers to all vertices of an polygon.intgetPolygonWithVertex(int vertexInd)Find first polygon referencing a given vertex.doublegetVertexAngle(int ind, int locInd)Compute angle at vertex of polygon.booleanhasPolygonColors()Check if polygon colors have been allocated.booleanhasPolygonNormals()Check if polygon normals have been allocated.booleanhasPolygonSizes()Check if polygon sizes have been allocated.booleanhasTagPolygon(int ind, int aTag)Check whether polygon has given tag.voidinit()Initialize and reset instance variables after call to super.init().PvPickEventintersectionWithLine(PdVector rayBaseWorld, PdVector rayDirWorld)Find intersection of polygon set with a given ray.booleanisClosed(int ind)Check whether polygon is closed, i.e.if endpoints are identical.booleanisShowingEdgeColorFromVertices()Determines whether smooth edge coloring uses vertex colors at vertices, requires vertex colors.booleanisShowingEdgeFromVertexColors()Deprecated.since JavaView 3.96.031, use #isShowingEdgeColorFromVertices()booleanisShowingEdgeLabels()Determine whether showing of edge labels is enabled.booleanisShowingPolygonColors()Set flag to enable drawing of polygon colors.booleanisShowingPolygonEndArrow()Determines whether drawing of arrow at last point of polygon is enabled.booleanisShowingPolygonLabels()Determine whether showing of polygon labels is enabled.booleanisShowingPolygonNormalArrow()Determines whether drawing of arrow of polygon normals is enabled.booleanisShowingPolygonNormals()Set flag to enable drawing of polygon normals.booleanisShowingPolygons()Set flag to enable drawing of polygons.booleanisShowingPolygonSizes()Set flag to enable usage of polygon sizes.booleanisShowingPolygonStartArrow()Determines whether drawing of arrow at first point of polygon is enabled.booleanisShowingSmoothEdgeColors()Determines whether smooth coloring of polygons is enabled, currently requires vertex colors.booleanisShowingSmoothLighting()Determines whether smooth lighting is enabled, requires vertex normals.booleanisShowingTaggedPolygons()Determine whether showing of tagged polygons is enabled.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).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.booleanmakePolygonColorsFromLength()Create polygon color from the polygon length ranging through hue rainbow.booleanmakePolygonColorsFromXYZ()Create color from the edge position within its bounding box which is interpreted as RGB cube.booleanmakePolygonColorsFromZ()Create color from the vertical z-height within its bounding box ranging from low blue to high red.booleanmakePolygonColorsFromZHue()Create color from the vertical z-height within its bounding box ranging through hue rainbow.booleanmakePolygonFromVertexColors()Create polygon colors as average of the color of its vertices.booleanmakeVertexColorsFromLength()Create vertex color from the polygon length ranging through hue rainbow.booleanmakeVertexFromPolygonColors()Create vertex colors as average of color of all adjacent polygons.booleanmakeVertexNormals()Compute normals at vertices as edge bisectors with unit length.booleanmerge(PgGeometryIf aGeom)Merge polygon set 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.int[]removeMarkedPolygons()Remove all polygons which have been markedPsObject.IS_DELETED.int[]removeMarkedVertices()Remove vertices marked with tag PsObject#IS_DELETED from polygons.int[]removePolygon(int ind)Remove polygon with given index, and decrement index of all polygons with higher index.voidremovePolygonColors()Remove local polygon colors from a geometry and use global polygon color instead.voidremovePolygonNormals()Remove local polygon normals from a geometry.voidremovePolygonSizes()Remove polygon sizes from a geometry.booleanremoveUnusedVertices()Remove all points not referenced by polygons.booleansetClosed(int ind, boolean flag)Close a polygon such that first and last vertex are identical.voidsetDimOfColors(int aSize)Let all colors have same number of componentsaSize!voidsetDimOfPolygons(int aSize)Let all polygons have same number of verticesaSize!voidsetDimOfVectors(int aSize)Let all vectors have same number of vectorsaSize!voidsetDimOfVertices(int dim)Set dimension of vertices.voidsetGlobalPolygonColor(java.awt.Color color)Set global polygon color to be used if no local colors are available.voidsetGlobalPolygonNormalColor(java.awt.Color color)Set global normal color to be used if no local colors are available.voidsetGlobalPolygonNormalLength(double length)Get length factor of normal vectors when drawn in display.voidsetGlobalPolygonNormalSize(double size)Get thickness in pixels of normals when drawn in display.voidsetGlobalPolygonSize(double size)Set thickness in pixels of polygon when drawn in display.voidsetGlobalPolygonTagColor(java.awt.Color color)Set global color of tagged polygons.voidsetJvx(PgJvxSrc src)Fill this instance with data from a geometry source, for example, previously read from file.voidsetMaxNumPolygons(int numPolygons)Allocate given number of polygons, and allocate normals, colors etc.voidsetNumPolygons(int numPolygons)Allocate given number of polygons, and allocate normals, colors etc.voidsetPolygon(int ind, int a, int b)Copy new vertex indices to polygon at specified position in the polygon list.booleansetPolygon(int ind, PiVector aPolygon)Set index vector of polygon with given index.booleansetPolygonColor(int ind, java.awt.Color aColor)Copy new color to polygon color at specified position in the color listvoidsetPolygonColors(java.awt.Color[] color)Copy polygon colors of list to existing array of polygon colors.booleansetPolygonNormal(int ind, PdVector aNormal)Copy new normal to polygon normal at specified position in the normal listvoidsetPolygonNormals(PdVector[] normal)Copy polygon normals of list to existing array of polygon normals.voidsetPolygons(PiVector[] polygon)Copy all polygons of polygon list to existing array of polygons.booleansetPolygonSize(int ind, double size)Set the thickness of the given polygon.voidsetPolygonSizes(PdVector size)Copy polygon sizes of list to existing array of polygon sizes.booleansetPolygonVertices(int ind, PdVector[] vArray)Copy new polygon vertices to polygon at specified position in the polygon list.voidsetSizeOfPolygon(int ind, int aSize)Set number of vertices of a specific polygon.voidsetTagPolygon(int ind, int aTag)Set a tag of a polygon.voidshowEdgeColorFromVertices(boolean flag)Set flag to enable smooth edge coloring using vertex colors at vertices, requires vertex 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.voidshowPolygonColors(boolean flag)Set flag to enable drawing of polygon colors.voidshowPolygonEndArrow(boolean flag)Set flag to enable drawing of arrow at last point of polygons.voidshowPolygonLabels(boolean flag)Set flag to enable drawing of polygon labels in display.voidshowPolygonNormalArrow(boolean flag)Set flag to enable drawing of arrow of polygon normal.voidshowPolygonNormals(boolean flag)Set flag to enable drawing of polygon normals.voidshowPolygons(boolean flag)Set flag to enable drawing of polygons.voidshowPolygonSizes(boolean flag)Set flag to enable usage of individual polygon sizes.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.voidshowTaggedPolygons(boolean flag)Set flag to enable drawing of tagged polygons.java.lang.StringtoString()Create a multi-line string representation with detailed information about all instance variables.PiVector[]triangulate()The method triangulates the polygon patches 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 showPolygonColors(boolean)-
Methods inherited from class jv.geom.PgPointSet
addGeometryItem, addVectorField, addVertex, applyAmbientMatrix, 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, setDimOfTextures, setEnabledIndexLabels, setGlobalVectorColor, setGlobalVectorLength, setGlobalVectorSize, setGlobalVertexColor, setGlobalVertexNormalColor, setGlobalVertexNormalLength, setGlobalVertexNormalSize, setGlobalVertexSize, setGlobalVertexSize, setGlobalVertexTagColor, setMaxNumVertices, setNumVertices, 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, clearTagElement, 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, getState, getTitle, getType, getVersion, getVersionType, hasAmbientMatrix, hasDisplay, hasModelMatrix, hasTagElement, isConfigurable, isEnabledInstanceSharing, isShowingBndBox, isShowingCenter, isShowingName, isShowingTitle, isVisible, removeDisplay, removeElement, removeMethodMenus, setAmbientMatrix, setAmbientProjection, setAmbientSpace, setAuthorInfo, setAuthors, setCenter, setDimOfSimplex, setElement, setEnabledInstanceSharing, setGeometryInfo, setLabelAttribute, setLabelAttribute, setLabelColor, setLabelFont, setLabelSize, setLabelStyle, setModelMatrix, setTagElement, 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
-
PgPolygonSet
public PgPolygonSet()
Constructor of a polygon set in three-dimensional space.
-
PgPolygonSet
public PgPolygonSet(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.
-
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:
- 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:
- 08.11.02, 1.10 revised (kp) Argument changed to PsObject from PgGeometry.
-
copyPolygonSet
public void copyPolygonSet(PgPolygonSet geom)
Copy instance variables of this class but not of the superclass.- Version:
- 24.01.05, 1.10 revised (kp) Copy polygon sizes.
-
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
-
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)
-
applyModelingMatrix
public boolean applyModelingMatrix()
Multiply the modeling matrix to all vertices and vectors. The modeling matrix of this geometry is set to the identity matrix.- Overrides:
applyModelingMatrixin classPgPointSet- Returns:
trueif operation was applied successfully.- Since:
- JavaView 2.36
- Version:
- 04.09.02, 1.00 created (kp)
-
getGlobalPolygonColor
public java.awt.Color getGlobalPolygonColor()
Get global polygon color which is used if no local colors are available.
-
getGlobalPolygonTagColor
public java.awt.Color getGlobalPolygonTagColor()
Get global color of tagged polygons.
-
getGlobalPolygonSize
public double getGlobalPolygonSize()
Get thickness in pixels of polygon when drawn in display.
-
getGlobalPolygonNormalColor
public java.awt.Color getGlobalPolygonNormalColor()
Get global element color which is used if no local colors are available.
-
getGlobalPolygonNormalLength
public double getGlobalPolygonNormalLength()
Get length factor of normal vectors when drawn in display.
-
getGlobalPolygonNormalSize
public double getGlobalPolygonNormalSize()
Get thickness in pixels of normals when drawn in display.
-
setGlobalPolygonColor
public void setGlobalPolygonColor(java.awt.Color color)
Set global polygon color to be used if no local colors are available.
-
setGlobalPolygonTagColor
public void setGlobalPolygonTagColor(java.awt.Color color)
Set global color of tagged polygons.
-
setGlobalPolygonSize
public void setGlobalPolygonSize(double size)
Set thickness in pixels of polygon when drawn in display.
-
setGlobalPolygonNormalColor
public void setGlobalPolygonNormalColor(java.awt.Color color)
Set global normal color to be used if no local colors are available.
-
setGlobalPolygonNormalLength
public void setGlobalPolygonNormalLength(double length)
Get length factor of normal vectors when drawn in display.
-
setGlobalPolygonNormalSize
public void setGlobalPolygonNormalSize(double size)
Get thickness in pixels of normals when drawn in display.
-
addPolygon
public int addPolygon(PiVector poly)
Add new polygon to the end of the polygon list. Method just callssetPolygon(numPolygons, PiVector).- Specified by:
addPolygonin interfacePgGeometryIf- Overrides:
addPolygonin classPgGeometry- Parameters:
poly- polygon to be added to polygon list- Returns:
- index of added polygon in polygon list
- Version:
- 17.07.02, 2.20 revised (kp) Increase total size by 20 percent.
12.10.00, 2.10 revised (ep) First set correct number of polygons then call methodsetPolygon(...).
07.07.00, 2.00 revised (kp) Method addPolygon(PiVector,int) removed since insert should also move other instance variables.
27.08.99, 1.00 created (sk)
-
getPolygons
public PiVector[] getPolygons()
Get polygon array for read and write access. Also note, that the actual size of the array may be larger than m_numPolygons for efficiency reasons. Therefore, do not use length of array.
-
getPolygonColors
public java.awt.Color[] getPolygonColors()
Get color array for read and write access, but do not modify the size of any color vector.
-
getPolygonNormals
public PdVector[] getPolygonNormals()
Get polygon normal array for read and write access, but do not modify the size of any normal vector.
-
getPolygonSizes
public PdVector getPolygonSizes()
Get polygon size array for read and write access.
-
isShowingEdgeLabels
public boolean isShowingEdgeLabels()
Determine whether showing of edge labels is enabled.
-
isShowingPolygonLabels
public boolean isShowingPolygonLabels()
Determine whether showing of polygon labels is enabled.
-
isShowingPolygons
public boolean isShowingPolygons()
Set flag to enable drawing of polygons.
-
isShowingPolygonColors
public boolean isShowingPolygonColors()
Set flag to enable drawing of polygon colors.
-
isShowingPolygonNormals
public boolean isShowingPolygonNormals()
Set flag to enable drawing of polygon normals.
-
isShowingPolygonSizes
public boolean isShowingPolygonSizes()
Set flag to enable usage of polygon sizes.
-
isShowingPolygonNormalArrow
public boolean isShowingPolygonNormalArrow()
Determines whether drawing of arrow of polygon normals is enabled.
-
isShowingPolygonStartArrow
public boolean isShowingPolygonStartArrow()
Determines whether drawing of arrow at first point of polygon is enabled.
-
isShowingPolygonEndArrow
public boolean isShowingPolygonEndArrow()
Determines whether drawing of arrow at last point of polygon is enabled.
-
isShowingTaggedPolygons
public boolean isShowingTaggedPolygons()
Determine whether showing of tagged polygons is enabled.
-
showTaggedPolygons
public void showTaggedPolygons(boolean flag)
Set flag to enable drawing of tagged polygons.
-
showEdgeLabels
public void showEdgeLabels(boolean flag)
Set flag to enable drawing of edge labels in display.
-
showPolygonLabels
public void showPolygonLabels(boolean flag)
Set flag to enable drawing of polygon labels in display.
-
showPolygons
public void showPolygons(boolean flag)
Set flag to enable drawing of polygons.
-
showPolygonColors
public void showPolygonColors(boolean flag)
Set flag to enable drawing of polygon colors.
-
showPolygonNormals
public void showPolygonNormals(boolean flag)
Set flag to enable drawing of polygon normals.
-
showPolygonSizes
public void showPolygonSizes(boolean flag)
Set flag to enable usage of individual polygon sizes.
-
showPolygonNormalArrow
public void showPolygonNormalArrow(boolean flag)
Set flag to enable drawing of arrow of polygon normal.
-
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.
-
useGlobalPolygonColor
public void useGlobalPolygonColor(boolean flag)
Deprecated. use showPolygonColors(boolean)Set flag of using global polygon color instead of coloring each polygon individually.
-
getMaxNumPolygons
public int getMaxNumPolygons()
Get total length of allocated polygon array. Usually, only a subset is filled with data. Method is for internal use, see getNumPolygons() for daily work.
-
setMaxNumPolygons
public void setMaxNumPolygons(int numPolygons)
Allocate given number of polygons, and allocate normals, colors etc. if they already exist. All polygon allocation is done in this method. Method should not be called directly unless a specific allocation is required. Usually, a user would specify the number of elements via setNumPolygons().- Version:
- 18.04.10, 2.10 revised (kp) Call assure-methods to sync with PgElementSet and remove duplicate allocation code.
18.04.10, 2.10 revised (kp) Instance sharing implemented.
14.03.06, 2.00 revised (kp) Method made public to allow better control of allocations.
-
getNumPolygons
public int getNumPolygons()
Get number of polygons in vertex array. Note, that the actual size of the polygon array may be larger for efficiency reasons. Therefore, do not use m_polygon.length.
-
setNumPolygons
public void setNumPolygons(int numPolygons)
Allocate given number of polygons, and allocate normals, colors etc. if they already exist. Internally, there may exist more polygons than requested serving as buffer and to reduce allocation times.- Version:
- 18.04.10, 1.80 revised (kp) Invocation of setMaxNumPolygon adjusted to PgElementSet#setNumElements.
11.12.04, 1.70 revised (kp) No longer update dimOfPolygons if numPolygons is reduced.
05.08.04, 1.60 revised (kp) No action if same number is requested.
28.06.03, 1.50 revised (kp) Update dimOfPolygons when numPolygons is reduced.
-
setSizeOfPolygon
public void setSizeOfPolygon(int ind, int aSize)Set number of vertices of a specific polygon. Polygon must exist already, and index of polygon must be in range [0,m_numPolygons-1]. Method may modify instance variable m_dimOfPolygons.- Parameters:
ind- Index of polygon.aSize- Number of vertices given polygon.- See Also:
setNumPolygons(int)- Version:
- 30.03.01 1.50 revised (kp) Synchronized with PgElementSet#setDimOfElement(int).
04.10.99 1.10 revised (kp) Now run until maxNumPolygons when changing dim.
04.10.99 1.00 created (kp)
-
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)
-
setDimOfPolygons
public void setDimOfPolygons(int aSize)
Let all polygons have same number of verticesaSize!=0, or individualaSize=-1. It is more efficient to call method beforesetNumPolygons().- Parameters:
aSize- Number of vertices for all polygons.- See Also:
setNumPolygons(int)- Version:
- 30.03.01 1.50 revised (kp) Synchronized with PgElementSet#setDimOfElements.
04.10.99 1.10 revised (kp) Now run until maxNumPolygons when changing dim.
04.10.99 1.00 created (kp)
-
getMaxDimOfPolygons
public int getMaxDimOfPolygons()
Get maximal number of vertices appearing in a polygon. Method returns the same value as getDimOfPolygons() if all polygons have the same size.- Since:
- JavaView 2.84.000
- See Also:
getDimOfPolygons()- Version:
- 28.06.03, 1.00 created (kp)
-
getDimOfPolygons
public int getDimOfPolygons()
Retrieve number of vertices per polygon, if it is the same for all polygons, otherwise return -1. Note: this check does not include the size of polygons with index in {m_numPolygons, m_maxNumPolygons-1}.- See Also:
setDimOfPolygons(int)
-
assureDimOfPolygons
public boolean assureDimOfPolygons()
Assure correctness of value m_dimOfPolygons specifying the number of vertices per polygon.- Returns:
- true if m_dimOfPolygons had the correct value. Note: this check does not include the size of polygons with index in {m_numPolygons, m_maxNumPolygons-1}.
- See Also:
setDimOfPolygons(int)
-
setDimOfColors
public void setDimOfColors(int aSize)
Let all colors have same number of componentsaSize!=0.- Overrides:
setDimOfColorsin classPgPointSet- Parameters:
aSize- Number of components of each color vector.
-
setDimOfVectors
public void setDimOfVectors(int aSize)
Let all vectors have same number of vectorsaSize!=0. It is more efficient to call method beforesetNumVertices().- Overrides:
setDimOfVectorsin classPgPointSet- Parameters:
aSize- Number of coordinates of each vertex.- See Also:
PgPointSet.setDimOfVectors(int)
-
hasPolygonColors
public boolean hasPolygonColors()
Check if polygon colors have been allocated.- See Also:
assurePolygonColors()
-
hasPolygonNormals
public boolean hasPolygonNormals()
Check if polygon normals have been allocated.- See Also:
assurePolygonNormals()
-
hasPolygonSizes
public boolean hasPolygonSizes()
Check if polygon sizes have been allocated.- See Also:
assurePolygonSizes()
-
assurePolygonColors
public void assurePolygonColors()
Assures respectively allocates correct length of polygon color array. Length of array is equal to length of polygon array.
-
assurePolygonNormals
public void assurePolygonNormals()
Assures respectively allocates correct length of polygon normal array. Length of array is equal to length of polygon array. Dimension of normal vectors is equal to dimension of vertices.
-
assurePolygonSizes
public void assurePolygonSizes()
Assures respectively allocates correct length of polygon size vector. Length of vector is equal to length of polygon array. Dimension of size vector is equal to maximal number of vertices.- Since:
- JavaView 3.09
- Version:
- 07.02.04, 1.00 created (kp)
-
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
-
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.Polygons with no or one remaining vertex are removed.
- Overrides:
removeMarkedVerticesin classPgPointSet- Returns:
- array with indices of new positions of vertices
- See Also:
PgPointSet.removeMarkedVertices()- Version:
- 17.11.00, 1.10 revised (kp) Remove polygons with less than two vertices.
20.07.00, 1.00 created (kp) From PgElementSet#removeMarkedVertices().
-
removePolygon
public int[] removePolygon(int ind)
Remove polygon with given index, and decrement index of all polygons with higher index. Method just marks polygon with tagPsObject.IS_DELETEDand invokesremoveMarkedPolygons().- Specified by:
removePolygonin interfacePgGeometryIf- Overrides:
removePolygonin classPgGeometry- Parameters:
ind- index of polygon to be removed- Returns:
- array with indices of new positions of polygons
- Author:
- Konrad Polthier
- Version:
- 20.07.00, 1.00 revised (kp)
20.07.00, 1.00 created (kp) From PgElementSet#removeElement(int).
-
removeMarkedPolygons
public int[] removeMarkedPolygons()
Remove all polygons which have been markedPsObject.IS_DELETED. First, the method computes where each polygon is moved to, then all polygon data is moved and the references to the polygon in bnd curves is changed. This routine is O(n).Method assumes that there exist no references to marked polygons. Otherwise application of this method would lead to unpredictable results.
- Returns:
- array with indices of new positions of polygons
- Author:
- Konrad Polthier
- Version:
- 22.04.17, 1.20 revised (kp) Missing update of m_polygonSize added.
19.01.05, 1.10 revised (kp) Remove affected vectors from vectorFields.
20.07.00, 1.00 created (kp) From PgElementSet#removeMarkedElements().
-
removeUnusedVertices
public boolean removeUnusedVertices()
Remove all points not referenced by polygons. First, the method computes where each point is moved to, then all point data is moved and the vertex indices are changed. This routine is O(n).- Returns:
trueif method was successful- Author:
- Konrad Polthier
- Version:
- 19.01.05, 1.10 revised (kp) Remove affected vectors from vectorFields.
23.09.99, 1.00 created (kp)
-
merge
public boolean merge(PgGeometryIf aGeom)
Merge polygon set with current object and store union of both objects in 'this'. Number of points and polygons is the sum of both objects.The merged geometry will 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:
- 12.09.02, 1.20 revised (kp) Merging of colors revised.
22.07.00, 1.10 revised (kp) Argument changed to class PgGeometryIf.
01.06.99, 1.01 revised (kp) Added missing assurePolygonNormals(), -Colors()
10.12.97, 1.00 created (kp)
-
getPolygonWithVertex
public int getPolygonWithVertex(int vertexInd)
Find first polygon referencing a given vertex.- Author:
- Konrad Polthier
- Version:
- 03.09.99, 1.00 revised (kp)
03.09.99, 1.00 created (kp)
-
clearTagPolygon
public void clearTagPolygon(int ind, int aTag)Clear a single tag of a polygon. For possible tags seePvGeometryIf.- Specified by:
clearTagPolygonin interfacePgGeometryIf- Overrides:
clearTagPolygonin classPgGeometry
-
hasTagPolygon
public boolean hasTagPolygon(int ind, int aTag)Check whether polygon has given tag. For possible tags seePvGeometryIf.- Specified by:
hasTagPolygonin interfacePgGeometryIf- Overrides:
hasTagPolygonin classPgGeometry
-
setTagPolygon
public void setTagPolygon(int ind, int aTag)Set a tag of a polygon. For possible tags seePvGeometryIf.- Specified by:
setTagPolygonin interfacePgGeometryIf- Overrides:
setTagPolygonin classPgGeometry
-
getPolygonVertices
public PdVector[] getPolygonVertices(int ind)
Get an array with pointers to all vertices of an polygon. Vertices appear in the array in the same order as in the polygon.- Returns:
- Array with vertices, or null if vertices are not available.
- Author:
- Konrad Polthier
- Version:
- 08.06.99, 1.01 revised (kp) Cousin method removed allowing to pass vector array as argument.
12.12.97, 1.00 created (kp)
-
getPolygon
public PiVector getPolygon(int ind)
Get a reference to an individual polygon array with vertex indices.- Specified by:
getPolygonin interfacePgGeometryIf- Overrides:
getPolygonin classPgGeometry- Parameters:
ind- index of polygon to be returned- Returns:
- Vector with indices, or null if index out of range.
-
getPolygonAsPgPolygon
public PgPolygon getPolygonAsPgPolygon(int polyId)
Get the specified polygon from a polygon set as PgPolygon. TODO: The missing material properties should be copied to the new polygon.- Author:
- Matthias Nieser
- Version:
- 18.10.06, 1.00 created (mn)
-
setPolygonVertices
public boolean setPolygonVertices(int ind, PdVector[] vArray)Copy new polygon vertices to polygon at specified position in the polygon list. Destination polygon must already exists.- Parameters:
ind- index of polygonvArray- array with new coordinates of polygon vertices- Returns:
- boolean false, if index out of range, or argument missing
-
setPolygon
public void setPolygon(int ind, int a, int b)Copy new vertex indices to polygon at specified position in the polygon list. Number of polygons is increased if required. Dimension of polygons is adjusted if necessary.- Parameters:
ind- index of polygona- index of first vertex of new polygon edgeb- index of second vertex of new polygon edge- Version:
- 30.03.01, 1.00 created (kp)
-
setPolygon
public boolean setPolygon(int ind, PiVector aPolygon)Set index vector of polygon with given index. Copy new polygon to polygon at specified position in the polygon list. Number of polygons is increased if required. Size of polygon is adjusted if too small or too large.- Specified by:
setPolygonin interfacePgGeometryIf- Overrides:
setPolygonin classPgGeometry- Parameters:
ind- index of polygonaPolygon- array with indices of new polygon- Returns:
- false, if index out of range, or argument missing
-
getPolygonColor
public java.awt.Color getPolygonColor(int ind)
Get a reference to an individual polygon color.- Returns:
- Vector with indices, or null if index out of range.
-
setPolygonColor
public boolean setPolygonColor(int ind, java.awt.Color aColor)Copy new color to polygon color at specified position in the color list- Parameters:
ind- index of polygonaColor- color to be copied to color list- Returns:
- false, if index out of range, or argument missing
-
getPolygonNormal
public PdVector getPolygonNormal(int ind)
Get a reference to an individual polygon normal.- Returns:
- Vector with indices, or null if index out of range.
-
setPolygonNormal
public boolean setPolygonNormal(int ind, PdVector aNormal)Copy new normal to polygon normal at specified position in the normal list- Parameters:
ind- index of polygonaNormal- normal to be copied to normal list- Returns:
- false, if index out of range, or argument missing
-
getPolygonSize
public double getPolygonSize(int ind)
Get size of a single polygon.- Returns:
- Thickness of specified polygon.
-
removePolygonSizes
public void removePolygonSizes()
Remove polygon sizes from a geometry.Showing of polygon sizes must be switched off explicitly using
showPolygonSizes(boolean).- Since:
- JavaView 3.09
- Version:
- 07.02.04, 1.00 created (kp)
-
setPolygonSize
public boolean setPolygonSize(int ind, double size)Set the thickness of the given polygon.- Parameters:
ind- index of polygonsize- thickness of polygon- Returns:
- false, if index out of range, or argument missing
-
setPolygonSizes
public void setPolygonSizes(PdVector size)
Copy polygon sizes of list to existing array of polygon sizes. Length of argument list must be equal or larger than getNumPolygons(). All polygon sizes are copied.Showing of polygon sizes must be switched on in order to be visible.
- Parameters:
size- array with new polygon size for all polygons- Since:
- JavaView 3.09
- Version:
- 07.02.04, 1.00 created (kp)
-
setPolygons
public void setPolygons(PiVector[] polygon)
Copy all polygons of polygon list to existing array of polygons. Length of argument polygon list must be equal or larger than getNumPolygons(). All polygons are copied.- Parameters:
polygon- array with new polygons- Version:
- 12.01.05, 1.10 revised (ur) Set dimension of polygons to detected common size.
07.02.04, 1.00 created (kp)
-
removePolygonColors
public void removePolygonColors()
Remove local polygon colors from a geometry and use global polygon color instead.Showing of polygon colors must be switched off explicitly using
showPolygonColors(boolean).
-
setPolygonColors
public void setPolygonColors(java.awt.Color[] color)
Copy polygon colors of list to existing array of polygon colors. Length of argument list must be equal or larger than getNumPolygons(). All polygon colors are copied. The dimension of all argument colors must be equal to getDimOfColors() of the geometry.- Parameters:
color- array with new polygon colors
-
removePolygonNormals
public void removePolygonNormals()
Remove local polygon normals from a geometry.Showing of polygon normals must be switched off explicitly using
showPolygonColors(boolean).
-
setPolygonNormals
public void setPolygonNormals(PdVector[] normal)
Copy polygon normals of list to existing array of polygon normals. Length of argument list must be equal or larger than getNumPolygons(). All polygon normals are copied. The dimension of all argument normals must be equal to getDimOfVectors() of the geometry.- Parameters:
normal- array with new polygon normals
-
isClosed
public boolean isClosed(int ind)
Check whether polygon is closed, i.e.if endpoints are identical.- Returns:
- flag whether polygon is closed, false if index out of bounds
- See Also:
setClosed(int, boolean)- Version:
- 25.07.00, 1.00 created (kp)
-
setClosed
public boolean setClosed(int ind, boolean flag)Close a polygon such that first and last vertex are identical. Size of polygon increases if end points where different.The dimension of the polygon set may be affected when closing multiple polygons of a set. Therefore, this method uses
#assureDimOfPolygonsto restore the dimension.PgPolygonSet does not use a flag since PgPolygonSet uses explicit index vectors to determine the polygon. Therefore, the user may just add the first index at the end of the polygon to close it.
- Parameters:
flag-trueensures identical endpoints of polygons- Returns:
falseif index out of bounds- See Also:
isClosed(int)- Version:
- 12.01.05, 1.10 revised (ur) Check flag, implementation for (flag == false), assure dimension of polygons.
25.07.00, 1.00 created (kp)
-
getLengthOfPolygon
public double getLengthOfPolygon(int ind)
Compute length of a single polygon with given index.- Author:
- Konrad Polthier
- Version:
- 23.09.99, 1.00 revised (kp)
23.09.99, 1.00 created (kp)
-
getLength
public double getLength()
Compute total length of all polygons.- Author:
- Konrad Polthier
- Version:
- 23.09.99, 1.00 revised (kp)
23.09.99, 1.00 created (kp)
-
getVertexAngle
public double getVertexAngle(int ind, int locInd)Compute angle at vertex of polygon. If vertex index is 0 or length-1, then angle of closed polygon is taken.- Parameters:
ind- index of polygonlocInd- local index of vertex- Returns:
- angle between edges at vertex
- Author:
- Konrad Polthier
- Version:
- 23.09.99, 1.00 revised (kp)
23.09.99, 1.00 created (kp)
-
getNumEdges
public int getNumEdges()
Calculate total number of edges of all polygons.- Returns:
- number of edges
- Author:
- Konrad Polthier
- Version:
- 23.09.99, 1.00 revised (kp)
23.09.99, 1.00 created (kp)
-
blend
public boolean blend(double s, PgGeometry ag, double t, PgGeometry bg)Blend between two polygon sets 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.
30.12.97, 1.00 created (kp)
-
intersectionWithLine
public PvPickEvent intersectionWithLine(PdVector rayBaseWorld, PdVector rayDirWorld)
Find intersection of polygon set 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.50 revised (kp) Check for vertices.
04.10.99, 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.20 revised (kp) Bug with 2d normals removed, vectors now remain 2d.
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().
-
makePolygonColorsFromXYZ
public boolean makePolygonColorsFromXYZ()
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.- Author:
- Konrad Polthier
- Version:
- 27.09.01, 1.10 revised (kp) Correct if vertex dimension larger than three.
22.08.00, 1.00 created (kp)
-
makePolygonColorsFromZ
public boolean makePolygonColorsFromZ()
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.- Author:
- Konrad Polthier
- Version:
- 16.04.05, 1.20 revised (kp) Both colors flipped to better sync with Maple.
27.09.01, 1.10 revised (kp) Correct if vertex dimension larger than three.
22.08.00, 1.00 created (kp)
-
makePolygonColorsFromZHue
public boolean makePolygonColorsFromZHue()
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 is used instead of the z-component in the color computation.- Author:
- Konrad Polthier
- Version:
- 17.04.05, 1.20 revised (kp) Expand color spectrum to [magenta,red] from [blue,red].
27.09.01, 1.10 revised (kp) Correct if vertex dimension larger than three.
22.08.00, 1.00 created (kp)
-
getFVector
public int[] getFVector()
Compute F-vector that is the number of points, edges, faces, etc.- Overrides:
getFVectorin classPgPointSet- Version:
- 20.12.01, 1.10 revised (kp) Renamed to getFVector() from getEulerNumbers().
04.11.01, 1.00 created (kp)
-
triangulate
public PiVector[] triangulate()
The method triangulates the polygon patches by successively removing the vertex with the smallest interior angle. The method can handle non-convex polygons.- Returns:
- Array of vectors each containing the vertex indices of a triangle.
- Author:
- Ulrich Reitebuch
- Version:
- 07.11.02, 1.10 revised (ur) Handling of closed polygons corrected.
19.11.01, 1.00 created (ur) Adapted from PgPolygon.triangulate().
-
flipOrientation
public void flipOrientation()
Change orientation of the polygon, i.e. the end point becomes the first point. This method just multiplies each normal vector with -1 and, therefore, must be overwritten by subclasses such as PgElementSet and PgPolygon.- Overrides:
flipOrientationin classPgPointSet- Author:
- Konrad Polthier
- Version:
- 22.11.01, 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 polygons 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)
-
makePolygonFromVertexColors
public boolean makePolygonFromVertexColors()
Create polygon colors as average of the color of its vertices. Vertex colors must be available.- Since:
- JavaView 2.69
- Author:
- Konrad Polthier
- Version:
- 24.04.03, 1.00 created (kp)
-
makeVertexFromPolygonColors
public boolean makeVertexFromPolygonColors()
Create vertex colors as average of color of all adjacent polygons. Polygon colors must be available.- Since:
- JavaView 2.69
- Author:
- Konrad Polthier
- Version:
- 24.04.03, 1.00 created (kp)
-
makePolygonColorsFromLength
public boolean makePolygonColorsFromLength()
Create polygon 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)
-
convert
public static PgPolygonSet convert(PgPolygon poly)
Convert a PgPolygon into a PgPolygonSet. The polygon is converted to a single polygon in the new set, therefore, individual edge settings are ignored.- Since:
- JavaView 3.11.003
- Author:
- Konrad Polthier
- Version:
- 03.03.04, 1.00 created (kp)
-
-
"