public class PgPolygonSet extends PgPointSet
PgPointSet
. 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 PgPointSet
for 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 case getDimOfPolygons()==-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,
setNumPolygons(int num)
allocates num
polygons. 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
setPolygon(int ind, PiVector v)
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 array
PiVector [] polygon = polygonSet.getPolygons()
;
for (int i=0; i<pointSet.getNumPolygons(); i++)
polygon[i].copy(v);
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().
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.
Modifier and Type | Field and Description |
---|---|
static int |
BINORMAL |
static int |
CURVATURE_NORMAL |
static int |
NORMAL |
static int |
OFFSET_NORMAL |
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
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 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.
|
Modifier and Type | Method and Description |
---|---|
int |
addPolygon(PiVector poly)
Add new polygon to the end of the polygon list.
|
boolean |
applyModelingMatrix()
Multiply the modeling matrix to all vertices and vectors.
|
boolean |
assureDimOfPolygons()
Assure correctness of value m_dimOfPolygons specifying the number of vertices per polygon.
|
void |
assurePolygonColors()
Assures respectively allocates correct length of polygon color array.
|
void |
assurePolygonNormals()
Assures respectively allocates correct length of polygon normal array.
|
void |
assurePolygonSizes()
Assures respectively allocates correct length of polygon size vector.
|
boolean |
blend(double s,
PgGeometry ag,
double t,
PgGeometry bg)
Blend between two polygon sets using
this = s*ag + t*bg . |
void |
clearTagPolygon(int ind,
int aTag)
Clear a single tag of a polygon.
|
java.lang.Object |
clone()
Duplicate geometry by recursively cloning all instance variables
except inspector panels and lists of registered listeners.
|
static PgPolygonSet |
convert(PgPolygon poly)
Convert a PgPolygon into a PgPolygonSet.
|
void |
copy(PsObject object)
Copy instance variables by duplication, not by copying a reference.
|
void |
copyPolygonSet(PgPolygonSet geom)
Copy instance variables of this class but not of the superclass.
|
void |
flipOrientation()
Change orientation of the polygon, i.e. the end point becomes the first point.
|
int |
getDimOfPolygons()
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.Color |
getGlobalPolygonColor()
Get global polygon color which is used if no local colors are available.
|
java.awt.Color |
getGlobalPolygonNormalColor()
Get global element color which is used if no local colors are available.
|
double |
getGlobalPolygonNormalLength()
Get length factor of normal vectors when drawn in display.
|
double |
getGlobalPolygonNormalSize()
Get thickness in pixels of normals when drawn in display.
|
double |
getGlobalPolygonSize()
Get thickness in pixels of polygon when drawn in display.
|
java.awt.Color |
getGlobalPolygonTagColor()
Get global color of tagged polygons.
|
PgJvxSrc |
getJvx()
Fills a geometry object with data from this instance, for example, to print to file.
|
double |
getLength()
Compute total length of all polygons.
|
double |
getLengthOfPolygon(int ind)
Compute length of a single polygon with given index.
|
int |
getMaxDimOfPolygons()
Get maximal number of vertices appearing in a polygon.
|
int |
getMaxNumPolygons()
Get total length of allocated polygon array.
|
int |
getNumEdges()
Calculate total number of edges of all polygons.
|
int |
getNumPolygons()
Get number of polygons in vertex array.
|
PiVector |
getPolygon(int ind)
Get a reference to an individual polygon array with vertex indices.
|
PgPolygon |
getPolygonAsPgPolygon(int polyId)
Get the specified polygon from a polygon set as PgPolygon.
|
java.awt.Color |
getPolygonColor(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.
|
PdVector |
getPolygonNormal(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.
|
double |
getPolygonSize(int ind)
Get size of a single polygon.
|
PdVector |
getPolygonSizes()
Get polygon size array for read and write access.
|
PdVector[] |
getPolygonVertices(int ind)
Get an array with pointers to all vertices of an polygon.
|
int |
getPolygonWithVertex(int vertexInd)
Find first polygon referencing a given vertex.
|
double |
getVertexAngle(int ind,
int locInd)
Compute angle at vertex of polygon.
|
boolean |
hasPolygonColors()
Check if polygon colors have been allocated.
|
boolean |
hasPolygonNormals()
Check if polygon normals have been allocated.
|
boolean |
hasPolygonSizes()
Check if polygon sizes have been allocated.
|
boolean |
hasTagPolygon(int ind,
int aTag)
Check whether polygon has given tag.
|
void |
init()
Initialize and reset instance variables after call to super.init().
|
PvPickEvent |
intersectionWithLine(PdVector rayBaseWorld,
PdVector rayDirWorld)
Find intersection of polygon set with a given ray.
|
boolean |
isClosed(int ind)
Check whether polygon is closed, i.e.if endpoints are identical.
|
boolean |
isShowingEdgeColorFromVertices()
Determines whether smooth edge coloring uses vertex colors at vertices, requires vertex colors.
|
boolean |
isShowingEdgeFromVertexColors()
Deprecated.
since JavaView 3.96.031, use #isShowingEdgeColorFromVertices()
|
boolean |
isShowingEdgeLabels()
Determine whether showing of edge labels is enabled.
|
boolean |
isShowingPolygonColors()
Set flag to enable drawing of polygon colors.
|
boolean |
isShowingPolygonEndArrow()
Determines whether drawing of arrow at last point of polygon is enabled.
|
boolean |
isShowingPolygonLabels()
Determine whether showing of polygon labels is enabled.
|
boolean |
isShowingPolygonNormalArrow()
Determines whether drawing of arrow of polygon normals is enabled.
|
boolean |
isShowingPolygonNormals()
Set flag to enable drawing of polygon normals.
|
boolean |
isShowingPolygons()
Set flag to enable drawing of polygons.
|
boolean |
isShowingPolygonSizes()
Set flag to enable usage of polygon sizes.
|
boolean |
isShowingPolygonStartArrow()
Determines whether drawing of arrow at first point of polygon is enabled.
|
boolean |
isShowingSmoothEdgeColors()
Determines whether smooth coloring of polygons is enabled, currently requires vertex colors.
|
boolean |
isShowingSmoothLighting()
Determines whether smooth lighting is enabled, requires vertex normals.
|
boolean |
isShowingTaggedPolygons()
Determine whether showing of tagged polygons is enabled.
|
void |
makeBiNormals()
Compute binormals at vertices which are orthogonal to both adjacent edges.
|
void |
makeCurvatureNormals()
Compute normals at vertices as edge bisectors with length equal to (Pi-vertexAngle).
|
void |
makeNormals()
Deprecated.
since JavaView 3.50.002, use makeVertexNormals().
|
void |
makeNormals(int type,
double length)
Compute normals at vertices which lie in the span of the adjacent edges.
|
void |
makeOffsetNormals()
Compute normals at vertices as edge bisectors whose tip lies on an offset==1 curve.
|
boolean |
makePolygonColorsFromLength()
Create polygon color from the polygon length ranging through hue rainbow.
|
boolean |
makePolygonColorsFromXYZ()
Create color from the edge position within its bounding box
which is interpreted as RGB cube.
|
boolean |
makePolygonColorsFromZ()
Create color from the vertical z-height within its bounding box
ranging from low blue to high red.
|
boolean |
makePolygonColorsFromZHue()
Create color from the vertical z-height within its bounding box
ranging through hue rainbow.
|
boolean |
makePolygonFromVertexColors()
Create polygon colors as average of the color of its vertices.
|
boolean |
makeVertexColorsFromLength()
Create vertex color from the polygon length ranging through hue rainbow.
|
boolean |
makeVertexFromPolygonColors()
Create vertex colors as average of color of all adjacent polygons.
|
boolean |
makeVertexNormals()
Compute normals at vertices as edge bisectors with unit length.
|
boolean |
merge(PgGeometryIf aGeom)
Merge polygon set with current object and store union of both objects in 'this'.
|
void |
paint(PvGeometryIf dc)
Major rendering method fills an internal container class supplied by the display.
|
int[] |
removeMarkedPolygons()
Remove all polygons which have been marked
PsObject.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.
|
void |
removePolygonColors()
Remove local polygon colors from a geometry and use global
polygon color instead.
|
void |
removePolygonNormals()
Remove local polygon normals from a geometry.
|
void |
removePolygonSizes()
Remove polygon sizes from a geometry.
|
boolean |
removeUnusedVertices()
Remove all points not referenced by polygons.
|
boolean |
setClosed(int ind,
boolean flag)
Close a polygon such that first and last vertex are identical.
|
void |
setDimOfColors(int aSize)
Let all colors have same number of components
aSize<>0 . |
void |
setDimOfPolygons(int aSize)
Let all polygons have same number of vertices
aSize<>0 , or individual aSize=-1 . |
void |
setDimOfVectors(int aSize)
Let all vectors have same number of vectors
aSize<>0 . |
void |
setDimOfVertices(int dim)
Set dimension of vertices.
|
void |
setGlobalPolygonColor(java.awt.Color color)
Set global polygon color to be used if no local colors are available.
|
void |
setGlobalPolygonNormalColor(java.awt.Color color)
Set global normal color to be used if no local colors are available.
|
void |
setGlobalPolygonNormalLength(double length)
Get length factor of normal vectors when drawn in display.
|
void |
setGlobalPolygonNormalSize(double size)
Get thickness in pixels of normals when drawn in display.
|
void |
setGlobalPolygonSize(double size)
Set thickness in pixels of polygon when drawn in display.
|
void |
setGlobalPolygonTagColor(java.awt.Color color)
Set global color of tagged polygons.
|
void |
setJvx(PgJvxSrc src)
Fill this instance with data from a geometry source, for example, previously read from file.
|
void |
setMaxNumPolygons(int numPolygons)
Allocate given number of polygons, and allocate normals, colors etc.
|
void |
setNumPolygons(int numPolygons)
Allocate given number of polygons, and allocate normals, colors etc.
|
void |
setPolygon(int ind,
int a,
int b)
Copy new vertex indices to polygon at specified position in the polygon list.
|
boolean |
setPolygon(int ind,
PiVector aPolygon)
Set index vector of polygon with given index.
|
boolean |
setPolygonColor(int ind,
java.awt.Color aColor)
Copy new color to polygon color at specified position in the color list
|
void |
setPolygonColors(java.awt.Color[] color)
Copy polygon colors of list to existing array of polygon colors.
|
boolean |
setPolygonNormal(int ind,
PdVector aNormal)
Copy new normal to polygon normal at specified position in the normal list
|
void |
setPolygonNormals(PdVector[] normal)
Copy polygon normals of list to existing array of polygon normals.
|
void |
setPolygons(PiVector[] polygon)
Copy all polygons of polygon list to existing array of polygons.
|
boolean |
setPolygonSize(int ind,
double size)
Set the thickness of the given polygon.
|
void |
setPolygonSizes(PdVector size)
Copy polygon sizes of list to existing array of polygon sizes.
|
boolean |
setPolygonVertices(int ind,
PdVector[] vArray)
Copy new polygon vertices to polygon at specified position in the polygon list.
|
void |
setSizeOfPolygon(int ind,
int aSize)
Set number of vertices of a specific polygon.
|
void |
setTagPolygon(int ind,
int aTag)
Set a tag of a polygon.
|
void |
showEdgeColorFromVertices(boolean flag)
Set flag to enable smooth edge coloring using vertex colors at vertices, requires vertex colors.
|
void |
showEdgeFromVertexColors(boolean flag)
Deprecated.
since JavaView 3.96.031, use #showEdgeColorFromVertices(boolean)
|
void |
showEdgeLabels(boolean flag)
Set flag to enable drawing of edge labels in display.
|
void |
showPolygonColors(boolean flag)
Set flag to enable drawing of polygon colors.
|
void |
showPolygonEndArrow(boolean flag)
Set flag to enable drawing of arrow at last point of polygons.
|
void |
showPolygonLabels(boolean flag)
Set flag to enable drawing of polygon labels in display.
|
void |
showPolygonNormalArrow(boolean flag)
Set flag to enable drawing of arrow of polygon normal.
|
void |
showPolygonNormals(boolean flag)
Set flag to enable drawing of polygon normals.
|
void |
showPolygons(boolean flag)
Set flag to enable drawing of polygons.
|
void |
showPolygonSizes(boolean flag)
Set flag to enable usage of individual polygon sizes.
|
void |
showPolygonStartArrow(boolean flag)
Set flag to enable drawing of arrow at first point of polygons.
|
void |
showSmoothEdgeColors(boolean flag)
Set flag to enable smooth coloring of edges, currently requires vertex colors.
|
void |
showSmoothLighting(boolean flag)
Set flag to enable smooth lighting, requires vertex normals.
|
void |
showTaggedPolygons(boolean flag)
Set flag to enable drawing of tagged polygons.
|
java.lang.String |
toString()
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.
|
boolean |
update(java.lang.Object event)
Update the class whenever a child has changed.
|
void |
useGlobalPolygonColor(boolean flag)
Deprecated.
use showPolygonColors(boolean)
|
addGeometryItem, addVectorField, addVertex, applyAmbientMatrix, assureVertexColors, assureVertexNormals, assureVertexSizes, assureVertexTextures, clearTagVertex, computeCone, computeCylinder, computeDisk, computePlane, computeRotation, computeSnail, computeSphere, computeTorus, getAmbientBounds, getBounds, getCenterOfBndBox, getCenterOfGravity, getDimOfColors, getDimOfTextures, getDimOfVectors, getEulerCharacteristic, getGlobalVectorColor, getGlobalVectorLength, getGlobalVectorSize, getGlobalVertexColor, getGlobalVertexNormalColor, getGlobalVertexNormalLength, getGlobalVertexNormalSize, getGlobalVertexSize, getGlobalVertexTagColor, getIndexOfVectorField, getMarkedVertices, getMaxNumVertices, getNumVectorFields, getNumVertices, getSelectedVectorField, getShininess, getSpecularColor, getTexture, getTextureImage, getTextureImageName, getTransparency, getVectorField, getVectorField, getVertex, getVertexColor, getVertexColors, getVertexNormal, getVertexNormals, getVertexSize, getVertexSizes, getVertexTexture, getVertexTextures, getVertices, hasTagVertex, hasVertex, hasVertex, hasVertexColors, hasVertexNormals, hasVertexSizes, hasVertexTextures, isDefaultLabelEnabled, isEnabledIndexLabels, isShowingIndices, isShowingSingleVectorField, isShowingTaggedVertices, isShowingTransparency, isShowingVectorArrow, isShowingVectorArrows, isShowingVectorColors, isShowingVectorField, isShowingVectorFields, isShowingVertexColors, isShowingVertexLabels, isShowingVertexNormalArrow, isShowingVertexNormals, isShowingVertexOutline, isShowingVertexSizes, isShowingVertexTexture, isShowingVertices, makeColorFromVectorLength, makeQuadrVertexTexture, makeVertexColorsFromXYZ, makeVertexColorsFromZ, makeVertexColorsFromZHue, makeVertexTextureFromBndBox, makeVertexTextureFromCylinder, makeVertexTextureFromSphere, makeVertexTextureFromUV, 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
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
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
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
assureInspector, getInfoPanel, getName, hasTag, setName
getFather, setParent
public static final int NORMAL
public static final int BINORMAL
public static final int OFFSET_NORMAL
public static final int CURVATURE_NORMAL
public PgPolygonSet()
public PgPolygonSet(int aVertexDim)
public void init()
init
in class PgPointSet
public PgJvxSrc getJvx()
getJvx
in interface PgGeometryIf
getJvx
in class PgPointSet
public void setJvx(PgJvxSrc src)
setJvx
in interface PgGeometryIf
setJvx
in class PgPointSet
src
- a geometry source used to fill this instance with data.public java.lang.Object clone()
null
.clone
in interface PgGeometryIf
clone
in class PgPointSet
copy(PsObject)
public void copy(PsObject object)
The argument was changed from PgGeometry to PsObject since there were problems in J/Link which preferred to use jv.object.PsObject#copy(PsObject) instead of jv.project.PgGeometry#copy(PsObject).
copy
in class PgPointSet
clone()
public void copyPolygonSet(PgPolygonSet geom)
public java.lang.String toString()
toString
in interface PgGeometryIf
toString
in class PgPointSet
public boolean update(java.lang.Object event)
update
in interface PsUpdateIf
update
in class PgPointSet
event
- carries a lot of informationPsObject.setParent(PsUpdateIf)
,
PsObject.getFather()
,
PsObject.addUpdateListener(PsUpdateIf)
public boolean applyModelingMatrix()
applyModelingMatrix
in class PgPointSet
true
if operation was applied successfully.public java.awt.Color getGlobalPolygonColor()
public java.awt.Color getGlobalPolygonTagColor()
public double getGlobalPolygonSize()
public java.awt.Color getGlobalPolygonNormalColor()
public double getGlobalPolygonNormalLength()
public double getGlobalPolygonNormalSize()
public void setGlobalPolygonColor(java.awt.Color color)
public void setGlobalPolygonTagColor(java.awt.Color color)
public void setGlobalPolygonSize(double size)
public void setGlobalPolygonNormalColor(java.awt.Color color)
public void setGlobalPolygonNormalLength(double length)
public void setGlobalPolygonNormalSize(double size)
public int addPolygon(PiVector poly)
setPolygon(numPolygons, PiVector)
.addPolygon
in interface PgGeometryIf
addPolygon
in class PgGeometry
poly
- polygon to be added to polygon listpublic PiVector[] getPolygons()
public java.awt.Color[] getPolygonColors()
public PdVector[] getPolygonNormals()
public PdVector getPolygonSizes()
public boolean isShowingEdgeLabels()
public boolean isShowingPolygonLabels()
public boolean isShowingPolygons()
public boolean isShowingPolygonColors()
public boolean isShowingPolygonNormals()
public boolean isShowingPolygonSizes()
public boolean isShowingPolygonNormalArrow()
public boolean isShowingPolygonStartArrow()
public boolean isShowingPolygonEndArrow()
public boolean isShowingTaggedPolygons()
public void showTaggedPolygons(boolean flag)
public void showEdgeLabels(boolean flag)
public void showPolygonLabels(boolean flag)
public void showPolygons(boolean flag)
public void showPolygonColors(boolean flag)
public void showPolygonNormals(boolean flag)
public void showPolygonSizes(boolean flag)
public void showPolygonNormalArrow(boolean flag)
public void showPolygonStartArrow(boolean flag)
public void showPolygonEndArrow(boolean flag)
public void useGlobalPolygonColor(boolean flag)
public int getMaxNumPolygons()
public void setMaxNumPolygons(int numPolygons)
public int getNumPolygons()
public void setNumPolygons(int numPolygons)
public void setSizeOfPolygon(int ind, int aSize)
ind
- Index of polygon.aSize
- Number of vertices given polygon.setNumPolygons(int)
public void setDimOfVertices(int dim)
setDimOfVertices
in class PgPointSet
public void setDimOfPolygons(int aSize)
aSize<>0
, or individual aSize=-1
.
It is more efficient to call method before setNumPolygons()
.aSize
- Number of vertices for all polygons.setNumPolygons(int)
public int getMaxDimOfPolygons()
getDimOfPolygons()
public int getDimOfPolygons()
setDimOfPolygons(int)
public boolean assureDimOfPolygons()
setDimOfPolygons(int)
public void setDimOfColors(int aSize)
aSize<>0
.setDimOfColors
in class PgPointSet
aSize
- Number of components of each color vector.public void setDimOfVectors(int aSize)
aSize<>0
.
It is more efficient to call method before setNumVertices()
.setDimOfVectors
in class PgPointSet
aSize
- Number of coordinates of each vertex.PgPointSet.setDimOfVectors(int)
public boolean hasPolygonColors()
assurePolygonColors()
public boolean hasPolygonNormals()
assurePolygonNormals()
public boolean hasPolygonSizes()
assurePolygonSizes()
public void assurePolygonColors()
public void assurePolygonNormals()
public void assurePolygonSizes()
public void paint(PvGeometryIf dc)
jv.project.PgGeometryIf
for detailed information.paint
in interface PgGeometryIf
paint
in class PgPointSet
PgGeometryIf
public int[] removeMarkedVertices()
Polygons with no or one remaining vertice are removed.
removeMarkedVertices
in class PgPointSet
PgPointSet.removeMarkedVertices()
public int[] removePolygon(int ind)
PsObject.IS_DELETED
and invokes removeMarkedPolygons()
.removePolygon
in interface PgGeometryIf
removePolygon
in class PgGeometry
ind
- index of polygon to be removedpublic int[] removeMarkedPolygons()
PsObject.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 upredictable results.
public boolean removeUnusedVertices()
true
if method was successfullpublic boolean merge(PgGeometryIf aGeom)
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 if
1. 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.
merge
in interface PgGeometryIf
merge
in class PgPointSet
aGeom
- Polygon set to be merged into 'this'true
if method was successfullpublic int getPolygonWithVertex(int vertexInd)
public void clearTagPolygon(int ind, int aTag)
PvGeometryIf
.clearTagPolygon
in interface PgGeometryIf
clearTagPolygon
in class PgGeometry
public boolean hasTagPolygon(int ind, int aTag)
PvGeometryIf
.hasTagPolygon
in interface PgGeometryIf
hasTagPolygon
in class PgGeometry
public void setTagPolygon(int ind, int aTag)
PvGeometryIf
.setTagPolygon
in interface PgGeometryIf
setTagPolygon
in class PgGeometry
public PdVector[] getPolygonVertices(int ind)
public PiVector getPolygon(int ind)
getPolygon
in interface PgGeometryIf
getPolygon
in class PgGeometry
ind
- index of polygon to be returnedpublic PgPolygon getPolygonAsPgPolygon(int polyId)
public boolean setPolygonVertices(int ind, PdVector[] vArray)
ind
- index of polygonvArray
- array with new coordinates of polygon verticespublic void setPolygon(int ind, int a, int b)
ind
- index of polygona
- index of first vertex of new polygon edgeb
- index of second vertex of new polygon edgepublic boolean setPolygon(int ind, PiVector aPolygon)
setPolygon
in interface PgGeometryIf
setPolygon
in class PgGeometry
ind
- index of polygonaPolygon
- array with indices of new polygonpublic java.awt.Color getPolygonColor(int ind)
public boolean setPolygonColor(int ind, java.awt.Color aColor)
ind
- index of polygonaColor
- color to be copied to color listpublic PdVector getPolygonNormal(int ind)
public boolean setPolygonNormal(int ind, PdVector aNormal)
ind
- index of polygonaNormal
- normal to be copied to normal listpublic double getPolygonSize(int ind)
public void removePolygonSizes()
Showing of polygon sizes must be switched off explicitly using
showPolygonSizes(boolean)
.
public boolean setPolygonSize(int ind, double size)
ind
- index of polygonsize
- thickness of polygonpublic void setPolygonSizes(PdVector size)
Showing of polygon sizes must be switched on in order to be visible.
size
- array with new polygon size for all polygonspublic void setPolygons(PiVector[] polygon)
polygon
- array with new polygonspublic void removePolygonColors()
Showing of polygon colors must be switched off explicitly using
showPolygonColors(boolean)
.
public void setPolygonColors(java.awt.Color[] color)
color
- array with new polygon colorspublic void removePolygonNormals()
Showing of polygon normals must be switched off explicitly using
showPolygonColors(boolean)
.
public void setPolygonNormals(PdVector[] normal)
normal
- array with new polygon normalspublic boolean isClosed(int ind)
setClosed(int, boolean)
public boolean setClosed(int ind, boolean flag)
The dimension of the polygon set may be affected when closing multiple
polygons of a set. Therefore, this method uses
#assureDimOfPolygons
to 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.
flag
- true
ensures identical endpoints of polygonsfalse
if index out of boundsisClosed(int)
public double getLengthOfPolygon(int ind)
public double getLength()
public double getVertexAngle(int ind, int locInd)
ind
- index of polygonlocInd
- local index of vertexpublic int getNumEdges()
public boolean blend(double s, PgGeometry ag, double t, PgGeometry bg)
this = s*ag + t*bg
.blend
in interface PgGeometryIf
blend
in class PgPointSet
s
- weight of vertices of first geometryag
- first geometry used for blendingt
- weight of vertices of second geometrybg
- second geometry used for blendingpublic PvPickEvent intersectionWithLine(PdVector rayBaseWorld, PdVector rayDirWorld)
intersectionWithLine
in interface PgGeometryIf
intersectionWithLine
in class PgPointSet
rayBaseWorld
- 3D base point of ray eventually hitting the surface.rayDirWorld
- 3D direction vector of ray eventually hitting the surface.public boolean makeVertexNormals()
This method correctly handles polygons with sequences of parallel edges and multiple vertices.
makeVertexNormals
in class PgPointSet
public void makeNormals()
public void makeBiNormals()
This method correctly handles polygons with sequences of parallel edges and multiple vertices.
public void makeOffsetNormals()
This method correctly handles polygons with sequences of parallel edges and multiple vertices.
public void makeCurvatureNormals()
This method correctly handles polygons with sequences of parallel edges and multiple vertices.
public void makeNormals(int type, double length)
This method correctly handles polygons with sequences of parallel edges and multiple vertices.
public boolean makePolygonColorsFromXYZ()
public boolean makePolygonColorsFromZ()
public boolean makePolygonColorsFromZHue()
public int[] getFVector()
getFVector
in class PgPointSet
public PiVector[] triangulate()
public void flipOrientation()
flipOrientation
in class PgPointSet
public boolean isShowingSmoothLighting()
public void showSmoothLighting(boolean flag)
public boolean isShowingSmoothEdgeColors()
public void showSmoothEdgeColors(boolean flag)
public boolean isShowingEdgeColorFromVertices()
public void showEdgeColorFromVertices(boolean flag)
public boolean isShowingEdgeFromVertexColors()
public void showEdgeFromVertexColors(boolean flag)
public boolean makePolygonFromVertexColors()
public boolean makeVertexFromPolygonColors()
public boolean makePolygonColorsFromLength()
public boolean makeVertexColorsFromLength()
public static PgPolygonSet convert(PgPolygon poly)
"