public class PgElementSet extends PgPointSet
PgPointSet
. Additionally,
there exist instance variables for element normals, element colors, element texture
coordinates, and other element properties. Note, that such element properties are not stored
with each element but each property is stored in an additional array of same length
as the array of elements. If a property is not available then the corresponding array
is null
.
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 element may be the same for all elements of the element set,
and assigned using the method setDimOfElements(int)
.
Or, the size of elements may differ in which case getDimOfElements()==-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 elements, for example,
setNumElements(int num)
allocates num
elements. 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 elements is changed, the class automatically adjusts the size
of those element properties which are currently in use, i.e. whose array is not null
.
Applications may modify the entries of an element and of element properties by direct method calls such as
setElement(int, PiVector)
which sets the element with index ind equal to the components of a vector v by copying.
Alternatively, if an application modifies a larger number of elements then the application
may prefer to obtain the element array from the element set and directly modify the array
PiVector [] element = elementSet.getElements()
;
for (int i=0; i<elementSet.getNumElements(); i++)
element[i].copy(v);
The same choice is available for arrays containing element properties.
Note, that classes like PgElementSet, may not reference all vertices, e.g.
if the currently active elements consists of a subset of all vertices.
Also note, that the actual size of the element array may differ from m_numElements
efficiency reasons. Therefore, do not use element.length but use getNumElements().
This class contains mainly basic methods for memory allocation and access to instance variables. Geometric methods operating on element 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 computeTorus
(if source code access to JavaView is available), or the tutorial applets of JavaView.
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 |
---|
PgElementSet()
Constructor of a polyhedral surface in three-dimensional space.
|
PgElementSet(int aVertexDim)
Constructor of a polyhedral surface in a space of given dimension.
|
Modifier and Type | Method and Description |
---|---|
int |
addElement(PiVector elem)
Add a new element to the end of the element list and increment the
number of elements.
|
boolean |
addElement(PiVector elem,
int ind)
Deprecated.
method is no longer supported, use addElement(PiVector).
|
void |
allocateEdgeStars()
Enable edges and make edges stars if no edge stars available.
|
boolean |
applyModelingMatrix()
Multiply the modeling matrix to all vertices and vectors.
|
void |
assureBoundary(int num)
Allocate boundary polygons and register current element set.
|
boolean |
assureDimOfElements()
Assure correctness of value m_dimOfElements specifying the number of vertices per Element.
|
void |
assureEdgeColors()
Assures respectively allocates correct length of edge color array.
|
void |
assureEdgeSizes()
Assures respectively allocates correct length of edge size array.
|
void |
assureElementBackColors()
Assures respectively allocates correct length of element color array.
|
void |
assureElementColors()
Assures respectively allocates correct length of element color array.
|
void |
assureElementNormals()
Assures respectively allocates correct length of element normal array.
|
void |
assureElementTextures()
Assures respectively allocates correct length of element texture array.
|
boolean |
blend(double s,
PgGeometry ag,
double t,
PgGeometry bg)
Blend between two element sets, used in interpolation and
computing the associate surfaces
this = s*ag + t*bg . |
void |
buildPolygon(PdVector[] polygon,
int discr)
Generate the vertices for a macro polygon where all
edges are subdivided into 'discr' points.
|
void |
buildQuadr(PdVector[] quadr,
int uDiscr,
int vDiscr)
Create a rectangular elements by bilinear interpolation of four given vertices and discretization.
|
void |
buildQuadrFromCurve(PgPolygon[] curve,
PgBndConstraint[] bndConstr)
Generate the vertices for a macro quadrilateral given by four polygons with pairwise
same discretization.
|
void |
buildTriangle(PdVector[] triangle,
int discr)
Generate the vertices for a macro triangle where all
edges are subdivided into 'discr' points.
|
void |
buildTriangleFromCurve(PgPolygon[] curve,
PgBndConstraint[] bndConstr)
Generate the vertices for a macro triangle given by three polygons with same discretization.
|
boolean |
checkNeighbour()
Deprecated.
use checkNeighbour(boolean) instead.
|
boolean |
checkNeighbour(boolean bMessage)
Check correct neighbour connectivity.
|
void |
clearTagElement(int ind,
int aTag)
Clear a single tag of a element.
|
java.lang.Object |
clone()
Duplicate geometry by recursively cloning all instance variables
except inspector panels and lists of registered listeners.
|
boolean |
close()
Identify and remove all interior boundaries of a geometry, and compress vertex array.
|
void |
computeCone(int numULines,
int numVLines,
double bottomRadius,
double height)
Generate cone in z-direction centered at the origin with given bottom radius and height.
|
void |
computeCylinder(int numULines,
int numVLines,
double radius,
double length)
Generate cylinder in z-direction centered at the origin with given radius and length.
|
void |
computeDisk(int numULines,
int numVLines,
double radius)
Generate disk in xy-plane with given radius.
|
void |
computePlane(int numULines,
int numVLines,
double uMin,
double vMin,
double uMax,
double vMax)
Generate rectangle in z=0 plane with given min/max values.
|
void |
computeRotation(PgPolygon meridian,
int numULines)
Generate rotational symmetric surface from given meridian around x-axis.
|
void |
computeSnail(int numULines,
int numVLines,
double numWindings)
Generate a winding snail.
|
void |
computeSphere(int numULines,
int numVLines,
double radius)
Generate sphere with given radius.
|
void |
computeTorus(int numULines,
int numVLines,
double radius,
double thick)
Generate torus in x-y plane with given radius of soal and thickness of tube.
|
void |
copy(PsObject object)
Copy instance variables by duplication, not by copying a reference.
|
void |
copyConnectivity(PgElementSet geom)
Copy connectivity of mesh, i.e. element and neighbour array.
|
void |
copyElementSet(PgElementSet geom)
Copy instance variables of this class but not of its superclass.
|
void |
fixBoundaries()
Constrain all boundary vertices not to move during variations.
|
void |
flipEdges()
Flip edge of pairs of adjacent triangles if sum of opposite angles
is larger than sum of spatial angles at common edge.
|
void |
flipOrientation()
Change orientation of all elements and invert normal vectors.
|
double |
getArea()
Compute total area of polyhedral surface.
|
double |
getAreaOfElement(int elemInd)
Compute area of polyhedral element with given index.
|
PgBndPolygon[] |
getBoundaries()
Get array of boundary polygons, some of which may be marked inactive.
|
PdVector |
getCenterOfElement(PdVector center,
int e)
Compute the barycenter of a geometry element.
|
double |
getCreaseAngle()
Get crease angle which is a threshold determining sharp crease edges.
|
int |
getDimOfElement(int ind)
Get number of vertices of an element with given index.
|
int |
getDimOfElements()
Get number of vertices per element if it is the same for all elements, otherwise return -1.
|
PiVector |
getEdge(int ind)
Deprecated.
since JavaView 3.96.031, use getEdgeStar(int).
|
PgEdgeStar |
getEdge(int vInd1,
int vInd2)
Create an edge structure with information about edge and adjacent elements.
|
java.awt.Color[] |
getEdgeColors()
Get color array for read and write access, but do not modify the size of any color vector.
|
double |
getEdgeLength(int elemInd,
int locInd)
Compute length of element edge specified by element index and vertex index.
|
PdVector |
getEdgeSizes()
Get array of relative edge sizes for read and write access.
|
PgEdgeStar |
getEdgeStar(int ind)
Get edge object for read and write access, but do not modify the size of any edge.
|
PgEdgeStar[] |
getEdgeStars()
Get edge array for read and write access, but do not modify the size of any edge.
|
PiVector |
getElement(int ind)
Get a reference to an individual element.
|
java.awt.Color |
getElementBackColor(int ind)
Get a reference to an individual backside element color.
|
java.awt.Color[] |
getElementBackColors()
Get backside element color array for read and write access, but do not modify the size of any color vector.
|
java.awt.Color |
getElementColor(int ind)
Get a reference to an individual element color.
|
java.awt.Color[] |
getElementColors()
Get element color array for read and write access, but do not modify the size of any color vector.
|
int |
getElementEdge(int elementInd,
int locNeighbInd)
Get the index of an edge incident to the given element.
|
PiVector[] |
getElementEdges()
Get an array which stores for each element the indices of its incident edges.
|
PdVector |
getElementNormal(int ind)
Get a reference to an individual element normal.
|
PdVector[] |
getElementNormals()
Get element normal array for read and write access, but do not modify the size of any normal vector.
|
PiVector[] |
getElements()
Get element array for read and write access.
|
PdVector[] |
getElementTexture(int ind)
Get element texture array of an individual element.
|
PdVector[][] |
getElementTextures()
Get element texture array for read and write access, but do not modify the size of any texture vector.
|
PdVector[] |
getElementVertices(int elemInd)
Get an array with pointers to all vertices of an element.
|
int |
getElementWithVertex(int vertexInd)
Find first element referencing a given vertex.
|
int[] |
getFVector()
Compute F-vector which shows the number of points, edges, faces, etc.
|
java.awt.Color |
getGlobalBndColor()
Get global boundary color which is used if no local colors are available.
|
double |
getGlobalBndSize()
Get thickness in pixels of boundary when drawn in display.
|
java.awt.Color |
getGlobalBndTagColor()
Get global color of tagged boundaries.
|
java.awt.Color |
getGlobalEdgeColor()
Get global edge color which is used if no local colors are available.
|
double |
getGlobalEdgeSize()
Get thickness in pixels of edge when drawn in display.
|
java.awt.Color |
getGlobalEdgeTagColor()
Get global color of tagged edges.
|
java.awt.Color |
getGlobalElementBackColor()
Get global color of backface of elements.
|
java.awt.Color |
getGlobalElementColor()
Get global element color which is used if no local colors are available.
|
java.awt.Color |
getGlobalElementNormalColor()
Get global element normal color which is used if no local colors are available.
|
double |
getGlobalElementNormalLength()
Get length factor of element normal vectors when drawn in display.
|
double |
getGlobalElementNormalSize()
Get thickness in pixels of element normals when drawn in display.
|
java.awt.Color |
getGlobalElementTagColor()
Get global color of tagged elements.
|
int |
getIndexOfBndPolygon(PgBndPolygon bnd)
Get index of vector fields, assumes user data is stored in a vector.
|
PgJvxSrc |
getJvx()
Fills a geometry object with data from this instance, for example, to print to file.
|
PdMatrix |
getL2Matrix(PdMatrix mat)
Compute L2 matrix S such that L2-norm(u)^2 = u*S*u.
|
double |
getL2Norm()
Compute L2 norm of identity map of element set.
|
int |
getMaxDimOfElements()
Get maximal number of vertices appearing in an element.
|
int |
getMaxNumElements()
Get total length of allocated element array.
|
PiVector |
getNeighbour(int ind)
Get a reference to an individual neighbour vector.
|
int |
getNeighbourLocInd(int elemInd,
int vInd,
int wInd)
For a given edge return the local index of the vertex containing the neighbourhood information.
|
PiVector[] |
getNeighbours()
Get neighbour array for read and write access, but do not modify the size of any neighbour vector.
|
int |
getNumBoundaries()
Return number of (living) boundary polygons.
|
int |
getNumBoundaryEdges()
Calculate number of boundary edges of a manifold surface using m_neighbour information.
|
int |
getNumBoundaryVertices()
Count number of boundary vertices assuming boundary vertices have been previously marked.
|
int |
getNumEdges()
Calculate number of edges of a manifold surface using m_neighbour information.
|
int |
getNumEdgeStars()
Get number of allocated edge stars.
|
int |
getNumElementIndices()
Get total number of vertex entries in all elements.
|
int |
getNumElements()
Get number of elements in element array.
|
int |
getNumUnusedVertices()
Get the number of unused vertices which are not references by elements.
|
int |
getOppVertexInd(int elemInd,
int locInd)
In the adjacent element find the vertex containing the neighbourhood information for the original element.
|
int |
getOppVertexLocInd(int elemInd,
int locInd)
In the adjacent element find the vertex containing the neighbourhood information for the original element.
|
PiVector[] |
getSavedElements()
Only used when working with non-conforming triangulations.
|
int |
getSavedNumVertices()
Only used when working with non-conforming triangulations.
|
PgBndPolygon |
getSelectedBndPolygon()
Get the currently selected boundary polygon, or null if there is none.
|
double |
getVertexAngle(int elemInd,
int locInd)
Compute the element angle specified by element index and local vertex index.
|
PdVector[] |
getVertexTextures()
Get array of all texture coordinates both for vertex and element based textures.
|
static PiVector |
getVertexValence(PgElementSet geom)
Compute valence of each vertex, that is, the number of incoming edges.
|
double |
getVolume()
Compute total volume of polyhedral surface.
|
double |
getVolumeOfElement(int elemInd)
Compute algebraic volume of the cone of a polyhedral element with the origin.
|
boolean |
hasBoundary()
Check whether surface has boundary polygons, assume boundary has been calculated.
|
boolean |
hasEdgeColors()
Check if edge colors have been allocated.
|
boolean |
hasEdgeSizes()
Check if relative edge sizes have been allocated.
|
boolean |
hasElementBackColors()
Check if element back colors have been allocated.
|
boolean |
hasElementColors()
Check if element colors have been allocated.
|
boolean |
hasElementNormals()
Check if element normals have been allocated.
|
boolean |
hasElementTextures()
Check if element textures have been allocated.
|
boolean |
hasTagElement(int ind,
int aTag)
Check whether element has given tag.
|
void |
init()
Initialize and reset instance variables after call to super.init().
|
PvPickEvent |
intersectionWithLine(PdVector rayBaseWorld,
PdVector rayDirWorld)
Find intersection of element set with a given ray.
|
boolean |
isConforming()
Return
true if elementSet is conforming, else false . |
boolean |
isEnabledEdges()
Check if storage and maintenance of edges is enabled.
|
boolean |
isShowingBackface()
Determines whether drawing of backfacing elements whose normal points away from camera is enabled.
|
boolean |
isShowingBoundaries()
Determines whether drawing of boundary curves is enabled.
|
boolean |
isShowingEdgeColorFromElements()
Determines whether local edge color is induced from element or vertex colors.
|
boolean |
isShowingEdgeColorFromVertices()
Determines whether smooth edge coloring uses vertex colors at vertices, requires vertex colors.
|
boolean |
isShowingEdgeColors()
Determine whether showing of edge colors is enabled.
|
boolean |
isShowingEdgeLabels()
Determines whether showing of edge labels is enabled.
|
boolean |
isShowingEdges()
Determines whether drawing of element edges is enabled.
|
boolean |
isShowingEdgeSizes()
Determine whether showing of edge sizes is enabled.
|
boolean |
isShowingElementBackColor()
Determines whether global element backface color is used.
|
boolean |
isShowingElementBackColors()
Determines whether drawing of individual backface element colors is enabled.
|
boolean |
isShowingElementColors()
Determines whether global element color is used.
|
boolean |
isShowingElementFromVertexColors()
Determines whether smooth element coloring uses vertex colors, requires vertex colors.
|
boolean |
isShowingElementLabels()
Determines whether showing of element labels is enabled.
|
boolean |
isShowingElementNormalArrow()
Determines whether drawing of arrow of element normals is enabled.
|
boolean |
isShowingElementNormals()
Determines whether drawing of element normals is enabled.
|
boolean |
isShowingElements()
Determines whether drawing of elements is enabled.
|
boolean |
isShowingElementTexture()
Determines whether drawing of element texture is enabled.
|
boolean |
isShowingElementTextures()
Deprecated.
use isShowingElementTexture()
|
boolean |
isShowingSilhouette()
Determines whether a polygon is shown along the silhouette if a shape.
|
boolean |
isShowingSmoothEdgeColors()
Determines whether smooth coloring of edges is enabled, currently requires vertex colors.
|
boolean |
isShowingSmoothElementColors()
Determines whether smooth coloring of elements is enabled, currently requires vertex colors.
|
boolean |
isShowingSmoothLighting()
Determines whether smooth lighting is enabled, requires vertex normals.
|
boolean |
isShowingTaggedBoundaries()
Determines whether drawing of tagged boundary curves is enabled.
|
boolean |
isShowingTaggedEdges()
Determines whether drawing of tagged element edges is enabled.
|
boolean |
isShowingTaggedElements()
Determines whether drawing of tagged elements is enabled.
|
void |
makeAlternatingQuadrConn(int uDiscr,
int vDiscr,
boolean alternateUDir)
Make quadrilateral connectivity with quadrilaterals being alternately triangulated.
|
void |
makeCylinderConn(int uDiscr,
int vDiscr)
Generate element and neighbourhood information for a cylindrical surface.
|
PgEdgeStar[] |
makeEdgeStars()
Generate list of edges from element information of a possibly non-manifold surface.
|
PgEdgeStar[] |
makeEdgeStarsFromNeighbour()
Generate list of edges from the neighbourhood information of a possibly non-manifold surface.
|
boolean |
makeElementColorsFromXYZ()
Create color from the element position within its bounding box
which is interpreted as RGB cube.
|
boolean |
makeElementColorsFromZ()
Create color from the vertical z-height within its bounding box
ranging from low blue to high red.
|
boolean |
makeElementColorsFromZHue()
Create color from the vertical z-height within its bounding box
ranging through hue rainbow.
|
boolean |
makeElementFromVertexColors()
Create element colors as average of all colors of its vertices.
|
boolean |
makeElementFromVertexTexture()
Create element textures from vertex textures and remove vertex textures.
|
boolean |
makeElementNormals()
Compute element normals from edge cross products.
|
boolean |
makeNeighbour()
Generate neighbourhood information for a given manifold polyhedron.
|
void |
makeQuadrBnd(int uDiscr,
int vDiscr)
Generate boundary information for a quadrilateral surface.
|
void |
makeQuadrConn(int uDiscr,
int vDiscr)
Generate element and neighbourhood information for a quadrilateral surface.
|
void |
makeQuadrElementTexture(int uDiscr,
int vDiscr)
Generate default element texture in [0,1]*[0,1] for a quadrilateral surface.
|
void |
makeTriangleBnd(int discr)
Generate the boundary of a macro triangle where all
edges are subdivided into 'discr' points.
|
void |
makeTriangleConn(int discr)
Generate the connectivity for a macro triangle where all
edges are subdivided into 'discr' points.
|
boolean |
makeVertexFromElementColors()
Create vertex colors as average of individual color of all adjacent elements.
|
boolean |
makeVertexNormals()
Compute vertex normals from adjacent elements (without using element normals).
|
void |
markBoundary()
Tag all boundary vertices as those.
|
boolean |
merge(PgGeometryIf aGeom)
Merge element 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.
|
java.lang.String |
printEdgeList()
Print list of edges to console if previously computed.
|
boolean |
projectFromAmbientSpace()
Apply projection matrix and perform projection determined by projection flag
of the surface in a Euclidean model R3, R2, or R1 with parallel projection.
|
boolean |
refineGlobalIntoFour()
Deprecated.
use refineGlobalIntoFour(boolean) instead.
|
boolean |
refineGlobalIntoFour(boolean bInsertMidPoints)
Refine elementSet by dividing each triangle into four similar children.
|
PgGeometry |
reflect(PdMatrix mat,
boolean bOrient,
boolean bVector)
Generate a cloned geometry and transform vertices by a matrix.
|
void |
removeBoundaries()
Remove all boundary curves.
|
int |
removeDeletedBoundaries()
Remove all boundary curves which are marked PsObject.IS_DELETED.
|
void |
removeEdgeColors()
Remove local edge colors from a geometry and use global
edge color instead.
|
void |
removeEdgeSizes()
Remove edge sizes from a geometry.
|
int[] |
removeElement(int ind)
Remove element with given index, and decrement index of all elements with higher index.
|
void |
removeElementBackColors()
Remove local backface element colors from a geometry and use global
backface element color instead.
|
void |
removeElementColors()
Remove local element colors from a geometry and use global
element color instead.
|
void |
removeElementEdges()
Remove element-edge incidence information from element set.
|
void |
removeElementNormals()
Remove element normals from a geometry.
|
int[] |
removeMarkedElements()
Remove all elements which have been marked
PsObject.IS_DELETED . |
int[] |
removeMarkedVertices()
Remove vertices marked with tag PsObject#IS_DELETED from elements.
|
void |
removeTexture()
Remove all texture information from surface and switch off showing of texture.
|
boolean |
removeUnusedVertices()
Remove all points not referenced by elements.
|
boolean |
resetBoundaryNormals()
Remove boundary vertex normal.
|
int |
selectBndPolygon(PgBndPolygon bnd)
Select a boundary polygon.
|
void |
setBoundary(PgBndPolygon[] newBnd)
Set new boundary polygons by replacing the previous array with the argument array.
|
void |
setConforming(boolean flag)
Set conformality state of geometry and boundary curves, and do not modify connectivity.
|
void |
setCreaseAngle(double angle)
Set crease angle which is a threshold determining sharp crease edges.
|
void |
setDimOfColors(int aSize)
Let all colors have same number of components
aSize<>0 . |
void |
setDimOfElement(int ind,
int aSize)
Set size of a single element and associated data like neighbour list.
|
void |
setDimOfElements(int aSize)
Let all elements 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 |
setEdgeColors(java.awt.Color[] colorList)
Copy edge colors of list to existing array of edge colors.
|
void |
setEdgeSizes(PdVector edgeSize)
Assign a set of relative edge sizes.
|
boolean |
setEdgeStar(int ind,
PgEdgeStar edgeStar)
Set index vector of edge with given index.
|
boolean |
setElement(int elemInd,
int[] anIndArray)
Copy new vertex indices to element at specified position in the element list.
|
void |
setElement(int elemInd,
int a,
int b,
int c)
Copy new vertex indices to element at specified position in the element list.
|
void |
setElement(int elemInd,
int a,
int b,
int c,
int d)
Copy new vertex indices to element at specified position in the element list.
|
boolean |
setElement(int ind,
PiVector newElem)
Copy new vertex indices to element at specified position in the element list.
|
boolean |
setElementBackColor(int ind,
java.awt.Color aColor)
Copy new color to element color at specified position in the color list
|
void |
setElementBackColors(java.awt.Color[] color)
Copy backface element colors of list to existing array of element colors.
|
boolean |
setElementColor(int ind,
java.awt.Color aColor)
Copy new color to element color at specified position in the color list
|
void |
setElementColors(java.awt.Color[] color)
Copy element colors of list to existing array of element colors.
|
void |
setElementEdges(PiVector[] elementEdge)
Set an array which stores for each element the indices of its incident edges.
|
boolean |
setElementNormal(int ind,
PdVector aNormal)
Copy new normal to element normal at specified position in the normal list
|
void |
setElementNormals(PdVector[] normal)
Copy element normals of list to existing array of element normals.
|
void |
setElements(PiVector[] element)
Copy the first
getNumElements() elements of source array into
an existing element array. |
boolean |
setElementTexture(int ind,
PdVector[] aTexture)
Copy new texture coordinates to element texture at specified position in the element texture list
|
void |
setElementTextures(PdVector[][] texCoords)
Use the given textures coordinates as element-based texture coordinates.
|
void |
setElementTexturesFromList(PdVector[] texCoords)
Use the given textures coordinates as element-based texture coordinates.
|
boolean |
setElementVertices(int elemInd,
PdVector[] vArray)
Copy new element vertices at specified position in the vertex array of PgPointSet.
|
void |
setEnabledEdges(boolean flag)
Enable storage and maintenance of edges.
|
void |
setGlobalBndColor(java.awt.Color color)
Set global boundary color to be used if no local colors are available.
|
void |
setGlobalBndSize(double size)
Set thickness in pixels of boundary when drawn in display.
|
void |
setGlobalBndTagColor(java.awt.Color color)
Set global color of tagged boundaries.
|
void |
setGlobalEdgeColor(java.awt.Color color)
Set global edge color to be used if no local colors are available.
|
void |
setGlobalEdgeSize(double size)
Set thickness in pixels of edge when drawn in display.
|
void |
setGlobalEdgeTagColor(java.awt.Color color)
Set global color of tagged edges.
|
void |
setGlobalElementBackColor(java.awt.Color color)
Set global color of backface of elements.
|
void |
setGlobalElementColor(java.awt.Color color)
Set global element color to be used if no local colors are available.
|
void |
setGlobalElementNormalColor(java.awt.Color color)
Set global element normal color to be used if no local colors are available.
|
void |
setGlobalElementNormalLength(double length)
Set length factor of element normal vectors when drawn in display.
|
void |
setGlobalElementNormalSize(double size)
Set thickness in pixels of element normals when drawn in display.
|
void |
setGlobalElementTagColor(java.awt.Color color)
Set global color of tagged elements.
|
void |
setGlobalVertexNormalColor(java.awt.Color color)
Set global element normal color to be used if no local colors are available.
|
void |
setGlobalVertexNormalLength(double length)
Set length factor of element normal vectors when drawn in display.
|
void |
setGlobalVertexNormalSize(double size)
Set thickness in pixels of element normals when drawn in display.
|
void |
setJvx(PgJvxSrc src)
Fill this instance with data from a geometry source, for example, previously read from file.
|
void |
setMaxNumElements(int numElements)
Major memory allocation routine, all element allocation should be done here.
|
boolean |
setNeighbour(int ind,
PiVector newNeigh)
Set neighbour elements of given element.
|
void |
setNeighbours(PiVector[] neighbour)
Copy neighbour array to existing array of neighbours.
|
void |
setNumElements(int numElements)
Allocate given number of elements, and allocate normals, colors etc.
|
void |
setSavedElements(PiVector[] element)
Only used when working with non-conforming triangulations.
|
void |
setSavedNumVertices(int num)
Only used when working with non-conforming triangulations.
|
void |
setTagElement(int ind,
int aTag)
Set a tag of a element.
|
void |
showBackface(boolean flag)
Set flag to enable drawing of backfacing elements whose normal points away from camera.
|
void |
showBoundaries(boolean flag)
Set flag to enable drawing of boundary curves.
|
void |
showEdgeColorFromElements(boolean flag)
Set flag if edge colors are induced from local element or vertex colors.
|
void |
showEdgeColorFromVertices(boolean flag)
Set flag to enable smooth edge coloring using vertex colors at vertices, requires vertex colors.
|
void |
showEdgeColors(boolean flag)
Set flag to enable drawing of individual edge colors.
|
void |
showEdgeLabels(boolean flag)
Set flag to enable drawing of edge labels in display.
|
void |
showEdges(boolean flag)
Set flag to enable drawing of element edges.
|
void |
showEdgeSizes(boolean flag)
Set flag to enable drawing of edge sizes.
|
void |
showElementBackColor(boolean flag)
Set flag to enable drawing of backface color of elements.
|
void |
showElementBackColors(boolean flag)
Set flag to enable drawing of individual backface element colors.
|
void |
showElementColors(boolean flag)
Set flag of using global element color instead of coloring each element individually.
|
void |
showElementFromVertexColors(boolean flag)
Set flag to enable smooth element coloring using vertex colors at vertices, requires vertex colors.
|
void |
showElementLabels(boolean flag)
Set flag to enable drawing of element labels in display.
|
void |
showElementNormalArrow(boolean flag)
Set flag to enable drawing of arrow of element normal.
|
void |
showElementNormals(boolean flag)
Set flag to enable drawing of element normals.
|
void |
showElements(boolean flag)
Set flag to enable drawing of elements.
|
void |
showElementTexture(boolean flag)
Set flag to enable drawing of element texture.
|
void |
showSilhouette(boolean flag)
Set flag to enable if a polygon is shown along the silhouette if a shape.
|
void |
showSmoothEdgeColors(boolean flag)
Set flag to enable smooth coloring of edges, currently requires vertex colors.
|
void |
showSmoothElementColors(boolean flag)
Set flag to enable smooth coloring of elements, currently requires vertex colors.
|
void |
showSmoothLighting(boolean flag)
Set flag to enable smooth lighting, requires vertex normals.
|
void |
showTaggedBoundaries(boolean flag)
Set flag to enable drawing of boundary curves.
|
void |
showTaggedEdges(boolean flag)
Set flag to enable drawing of element edges.
|
void |
showTaggedElements(boolean flag)
Set flag to enable drawing of tagged elements.
|
void |
showVertexTexture(boolean flag)
Set flag to enable drawing of vertex texture.
|
java.lang.String |
toString()
Create a multi-line string representation
with detailed information about all instance variables.
|
static boolean |
triangulate(PgElementSet geom)
Triangulate the given element set in place.
|
boolean |
update(java.lang.Object event)
Update the class whenever a child has changed.
|
addGeometryItem, addVectorField, addVertex, applyAmbientMatrix, assureVertexColors, assureVertexNormals, assureVertexSizes, assureVertexTextures, clearTagVertex, 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, 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, projectToSphere, removeAllVectorFields, removeHiddenVectorFields, removeVectorField, removeVertex, removeVertexColors, removeVertexNormals, removeVertexSizes, scale, scale, selectVectorField, setCenterOfBndBox, setDefaultLabelEnabled, setDimOfTextures, setEnabledIndexLabels, setGlobalVectorColor, setGlobalVectorLength, setGlobalVectorSize, setGlobalVertexColor, 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, showVertices, translate
addDisplay, addPolygon, clearTagPolygon, convertWorldToModel, fillMethodMenu, fillMethodMenu, getAmbientInvMatrix, getAmbientMatrix, getAmbientProjection, getAmbientSpace, getAuthorInfo, getAuthors, getCenter, getCenterOfElement, getControlPanel, getDiameter, getDimOfSimplex, getDimOfVertices, getDisplayList, getDisplays, getGeometryInfo, getLabelAttribute, getLabelColor, getLabelFont, getLabelSize, getLabelStyle, getMaterialPanel, getModelMatrix, getPolygon, getState, getTitle, getType, getVersion, getVersionType, hasAmbientMatrix, hasDisplay, hasModelMatrix, hasTagPolygon, isConfigurable, isEnabledInstanceSharing, isShowingBndBox, isShowingCenter, isShowingName, isShowingTitle, isVisible, removeDisplay, removeMethodMenus, removePolygon, setAmbientMatrix, setAmbientProjection, setAmbientSpace, setAuthorInfo, setAuthors, setCenter, setDimOfSimplex, setEnabledInstanceSharing, setGeometryInfo, setLabelAttribute, setLabelAttribute, setLabelColor, setLabelFont, setLabelSize, setLabelStyle, setModelMatrix, setPolygon, setTagPolygon, 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 PgElementSet()
This constructor allows to create a geometry by specifying the class name as string. By default, showing of vertices is enabled.
public PgElementSet(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)
If src geometry has missing neighbour information then method calculates neighbour information using makeNeighbour(), unless PsJavaView.m_bAutoNeighbour==false.
If src geometry has missing element or vertex normals then method re-calculates normals using makeElementNormals() or makeVertexNormals(), unless PsJavaView.m_bAutoNormals==false.
setJvx
in interface PgGeometryIf
setJvx
in class PgPointSet
src
- a geometry source used to fill this instance with data.public boolean applyModelingMatrix()
applyModelingMatrix
in class PgPointSet
true
if operation was applied successfully.public boolean projectFromAmbientSpace()
projectFromAmbientSpace
in class PgPointSet
true
if operation was applied successfully.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 copyElementSet(PgElementSet geom)
public void copyConnectivity(PgElementSet 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 int addElement(PiVector elem)
If element normals exist then the normal is calculated for the new element too. Note, if vertex normals exist then the normals of the element vertices are currently not recalculated (this behavior might change in the future).
If element colors exist then the color of the new element is the global element color.
addElement
in interface PgGeometryIf
addElement
in class PgGeometry
elem
- element to be added to element listpublic boolean addElement(PiVector elem, int ind)
Length of element must be at least three, and all entries of the index vector must be different.
When the first element is added to an element set then the internal variable m_dimOfElements is set to the length of the first element. The variable dimOfElements is adjusted if it is different from size of the argument element.
elem
- element to be added to element listind
- index of element positionpublic java.awt.Color getGlobalElementColor()
public java.awt.Color getGlobalElementBackColor()
public java.awt.Color getGlobalElementTagColor()
public void setGlobalElementColor(java.awt.Color color)
public void setGlobalElementBackColor(java.awt.Color color)
public void setGlobalElementTagColor(java.awt.Color color)
public java.awt.Color getGlobalElementNormalColor()
public double getGlobalElementNormalLength()
public double getGlobalElementNormalSize()
public void setGlobalElementNormalColor(java.awt.Color color)
Note, currently element normal attributes like color, length and size are identical with the settings for vertex normals. The reason is that the material panel would become too messed up if there are sliders for both types of normal vectors. In the future the synchronization of the two normal vectors may be skipped, so it is a good programming practice to make use of the individual methods of each type.
public void setGlobalElementNormalLength(double length)
Note, currently element normal attributes like color, length and size are identical with the settings for vertex normals. The reason is that the material panel would become too messed up if there are sliders for both types of normal vectors. In the future the synchronization of the two normal vectors may be skipped, so it is a good programming practice to make use of the individual methods of each type.
public void setGlobalElementNormalSize(double size)
Note, currently element normal attributes like color, length and size are identical with the settings for vertex normals. The reason is that the material panel would become too messed up if there are sliders for both types of normal vectors. In the future the synchronization of the two normal vectors may be skipped, so it is a good programming practice to make use of the individual methods of each type.
public void setGlobalVertexNormalColor(java.awt.Color color)
setGlobalVertexNormalColor
in class PgPointSet
public void setGlobalVertexNormalLength(double length)
setGlobalVertexNormalLength
in class PgPointSet
public void setGlobalVertexNormalSize(double size)
setGlobalVertexNormalSize
in class PgPointSet
public double getCreaseAngle()
setCreaseAngle(double)
public void setCreaseAngle(double angle)
getCreaseAngle()
public java.awt.Color getGlobalEdgeColor()
public java.awt.Color getGlobalEdgeTagColor()
public double getGlobalEdgeSize()
public void setGlobalEdgeColor(java.awt.Color color)
public void setGlobalEdgeTagColor(java.awt.Color color)
public void setGlobalEdgeSize(double size)
public boolean isShowingEdgeColors()
public void showEdgeColors(boolean flag)
public boolean isShowingEdgeSizes()
public void showEdgeSizes(boolean flag)
public java.awt.Color getGlobalBndColor()
public java.awt.Color getGlobalBndTagColor()
public double getGlobalBndSize()
public void setGlobalBndColor(java.awt.Color color)
public void setGlobalBndTagColor(java.awt.Color color)
public void setGlobalBndSize(double size)
public boolean isEnabledEdges()
public void setEnabledEdges(boolean flag)
When enabled, then just a flag is set. Call makeEdgeStars() or makeNeighbour() to rebuilt the edge array.
When disabled, then internal edge variables are deleted.
makeEdgeStars()
,
makeNeighbour()
public int getNumEdgeStars()
See also getNumEdges() which returns the number of edges of the underlying simplicial complex. Note, getNumEdgeStars() will return 0 if no edgeStars are allocated while getNumEdges() always returns a number related to the simplicial complex. Use getNumEdgesStars() when working with edgeStar array, and use getNumEdges() in combinatorial calculations.
getNumEdges()
public PgEdgeStar[] getEdgeStars()
public PgEdgeStar getEdgeStar(int ind)
public PiVector getEdge(int ind)
public boolean setEdgeStar(int ind, PgEdgeStar edgeStar)
ind
- index of edgeedgeStar
- array with indices of new edgepublic PiVector[] getElementEdges()
public int getElementEdge(int elementInd, int locNeighbInd)
elementInd
- Index of an element.locNeighbInd
- Local neighbour index of the edge.public void setElementEdges(PiVector[] elementEdge)
public void removeElementEdges()
public java.awt.Color[] getEdgeColors()
public boolean hasEdgeColors()
assureEdgeColors()
public void assureEdgeColors()
public void removeEdgeColors()
Showing of edge colors must be switched off explicitly using
showEdgeColors(boolean)
.
public void setEdgeColors(java.awt.Color[] colorList)
Showing of edge colors must be switched on in order to be visible.
colorList
- array with new edge colorspublic PdVector getEdgeSizes()
public boolean hasEdgeSizes()
assureEdgeSizes()
public void assureEdgeSizes()
public void removeEdgeSizes()
Showing of edge sizes must be switched off explicitly using
showEdgeSizes(boolean)
.
public void setEdgeSizes(PdVector edgeSize)
Showing of edge sizes must be switched on in order to be visible.
edgeSize
- array with new edge size for all edgespublic PiVector[] getElements()
Do not modify the size of any element vector.
Note, that the actual size of the array may be larger than m_numElements for efficiency reasons. Therefore, do not use the length of array.
public java.awt.Color[] getElementColors()
public java.awt.Color[] getElementBackColors()
public PdVector[] getElementNormals()
public PdVector[] getElementTexture(int ind)
public PdVector[][] getElementTextures()
public PdVector[] getVertexTextures()
getVertexTextures
in class PgPointSet
public PiVector[] getNeighbours()
public int getNumBoundaries()
getNumBoundaryEdges()
public boolean hasBoundary()
public PgBndPolygon[] getBoundaries()
public PgBndPolygon getSelectedBndPolygon()
public int selectBndPolygon(PgBndPolygon bnd)
public int getIndexOfBndPolygon(PgBndPolygon bnd)
public void removeBoundaries()
public int removeDeletedBoundaries()
public void setBoundary(PgBndPolygon[] newBnd)
newBnd
- array with new boundary polygons of element set.public void assureBoundary(int num)
public boolean isShowingEdges()
public void showEdges(boolean flag)
public boolean isShowingEdgeColorFromElements()
public void showEdgeColorFromElements(boolean flag)
public boolean isShowingSmoothEdgeColors()
public void showSmoothEdgeColors(boolean flag)
public boolean isShowingEdgeColorFromVertices()
public void showEdgeColorFromVertices(boolean flag)
public boolean isShowingEdgeLabels()
public void showEdgeLabels(boolean flag)
public boolean isShowingTaggedEdges()
public void showTaggedEdges(boolean flag)
public boolean isShowingElementLabels()
public boolean isShowingElements()
public boolean isShowingTaggedElements()
public boolean isShowingBackface()
public boolean isShowingElementNormals()
public boolean isShowingElementNormalArrow()
public boolean isShowingElementTextures()
public boolean isShowingElementTexture()
public boolean isShowingSilhouette()
public void showSilhouette(boolean flag)
public boolean isShowingBoundaries()
public boolean isShowingTaggedBoundaries()
public boolean isShowingElementColors()
public boolean isShowingElementBackColors()
public boolean isShowingElementBackColor()
public boolean isShowingSmoothLighting()
public void showSmoothLighting(boolean flag)
public boolean isShowingSmoothElementColors()
public void showSmoothElementColors(boolean flag)
public boolean isShowingElementFromVertexColors()
public void showElementFromVertexColors(boolean flag)
public void showElementLabels(boolean flag)
public void showElements(boolean flag)
public void showTaggedElements(boolean flag)
public void showElementBackColor(boolean flag)
public void showElementBackColors(boolean flag)
public void showBackface(boolean flag)
public void showElementNormals(boolean flag)
public void showElementNormalArrow(boolean flag)
public void showElementTexture(boolean flag)
public void showVertexTexture(boolean flag)
showVertexTexture
in class PgPointSet
public void showBoundaries(boolean flag)
public void showTaggedBoundaries(boolean flag)
public void showElementColors(boolean flag)
public int getMaxNumElements()
public void setMaxNumElements(int numElements)
public int getNumElements()
public int getNumElementIndices()
public void setNumElements(int numElements)
Note, the neighbour array might be initialized to -1 when its size changes.
public int getMaxDimOfElements()
getDimOfElements()
public int getDimOfElements()
public void setDimOfElements(int aSize)
aSize<>0
,
or individual aSize=-1
.
It is more efficient to call method before setNumElements()
.
Argument must be -1 or >=3. Other values lead to a warning message.
Note, if aSize!=-1 then this method initializes the neighbour array of all elements to -1.
aSize
- Number of vertices for all elements.setNumElements(int)
public int getDimOfElement(int ind)
getDimOfElements()
,
setDimOfElement(int, int)
public void setDimOfElement(int ind, int aSize)
setElement(int, PiVector)
.
New size must be larger than 3, other values lead to a warning message.
Note, this method initializes the neighbour array of this element to -1.
ind
- Index of element to change size.aSize
- New number of vertices of element, must be larger than 3.getDimOfElement(int)
,
setDimOfElements(int)
,
setElement(int, PiVector)
public void setDimOfColors(int aSize)
aSize<>0
.setDimOfColors
in class PgPointSet
aSize
- Number of components of each color vector.public void setDimOfVertices(int dim)
setDimOfVertices
in class PgPointSet
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 element.PgPointSet.setDimOfVectors(int)
public boolean assureDimOfElements()
setDimOfElements(int)
is called
to set the correct value.
Note: this check does not include the size of elements with index in {m_numElements, m_maxNumElements-1}.setDimOfElements(int)
public boolean hasElementColors()
assureElementColors()
public boolean hasElementBackColors()
assureElementBackColors()
public boolean hasElementNormals()
assureElementNormals()
public boolean hasElementTextures()
assureElementTextures()
public void assureElementColors()
public void assureElementBackColors()
public void assureElementNormals()
public void assureElementTextures()
getDimOfTextures()
.public void paint(PvGeometryIf dc)
jv.project.PgGeometryIf
for detailed information.paint
in interface PgGeometryIf
paint
in class PgPointSet
PgGeometryIf
public void makeQuadrElementTexture(int uDiscr, int vDiscr)
uDiscr
- Number of lines in u
direction.vDiscr
- Number of lines in v
direction.public void makeQuadrConn(int uDiscr, int vDiscr)
uDiscr
- Number of lines in u
direction.vDiscr
- Number of lines in v
direction.makeCylinderConn(int, int)
public void makeAlternatingQuadrConn(int uDiscr, int vDiscr, boolean alternateUDir)
uDiscr
- Number of lines in u
direction.vDiscr
- Number of lines in v
direction.alternateUDir
- Determines if diagonals are flipped along uDir or vDir.makeCylinderConn(int, int)
public void makeCylinderConn(int uDiscr, int vDiscr)
uDiscr
- Number of lines in u
direction.vDiscr
- Number of lines in v
direction.makeQuadrConn(int, int)
public void makeQuadrBnd(int uDiscr, int vDiscr)
uDiscr
- Number of lines in u
direction.vDiscr
- Number of lines in v
direction.makeQuadrConn(int, int)
,
getBoundaries()
public void makeTriangleConn(int discr)
discr
- number of points on each edgemakeTriangleBnd(int)
public void makeTriangleBnd(int discr)
discr
- number of points on each edgemakeTriangleConn(int)
public void flipOrientation()
flipOrientation
in class PgPointSet
PgPointSet.flipOrientation()
public static PiVector getVertexValence(PgElementSet geom)
public void flipEdges()
public void allocateEdgeStars()
public PgEdgeStar[] makeEdgeStars()
The routine computes an array of edges temporarily in a single pass through all elements. Additionally, it stores the (1, 2, ..) elements sharing an edge.
The method allows an edge to be shared by more than two elements, i.e. non-manifold
polyhedra. Method consists of code from previous version of
makeNeighbour()
, which now calls makeEdgeStars(). Therefore, the
method does not use any neighbour information.
During edge collection, each edge is stored in the array edgesAtVertex at an index equal to the lowest of its two vertex indices. After the collection, each entry of edgesAtVertex is a vector containing those edges emanating from this vertex to vertices with higher vertex index. The entry at index i in edgesAtVertex is an array which contains all edges emanating from vertex with index i to vertices with higher index.
This algorithm requires the array edgesAtVertex to have size equal to largest vertex index
referenced from an element,
but has a linear runtime when finding entries with identical edges.
When collection is finished, usually some array entries will be null
.
The return parameter is an array of edges constructed from edgesAtVertex.
Note, think about using getEdge(int,int)
to obtain just a few edges.
If element set is non-manifold then the number of edges returned by this method may differ from the number which getNumEdgeStars() returns and getNumEdges() since the later relies on a correct neighbour information which is not used here.
getNumEdgeStars()
,
getEdgeStars()
,
getEdge(int, int)
public PgEdgeStar[] makeEdgeStarsFromNeighbour()
The routine computes an array of edges temporarily in a single pass through all elements. Additionally, it stores the 1 or 2 elements sharing an edge.
This method does not allow an edge to be shared by more than two elements; for non-manifold edges the neighbourhood information must be set correctly in m_neighbour. By this method the edge list can be reconstructed for models saved to a jvx file.
During edge collection, each edge is stored in the array edgesAtVertex at an index equal to the lowest of its two vertex indices. After the collection, each entry of edgesAtVertex is a vector containing those edges emanating from this vertex to vertices with higher vertex index.
This algorithm requires the array edgesAtVertex to have size equal to largest vertex index
referenced from an element,
but has a linear runtime when finding entries with identical edges.
When collection is finished, usually some array entries will be null
.
The return parameter is an array of edges constructed from edgesAtVertex.
getNumEdgeStars()
,
getEdgeStars()
,
getEdge(int, int)
,
makeEdgeStars()
public java.lang.String printEdgeList()
public boolean makeNeighbour()
Since version 2.60 the construction of the edge list is outsourced in
getEdgeStars()
.
Edges belonging to more than two elements become a boundary edge in each element.
public boolean makeElementNormals()
Method works reliably only for convex planar elements.
Dimension of vertices must be equal to 3.
makeVertexNormals()
public boolean makeVertexNormals()
Dimension of vertices must be equal to 3.
makeVertexNormals
in class PgPointSet
makeElementNormals()
public void buildQuadr(PdVector[] quadr, int uDiscr, int vDiscr)
quadr
- array with four vertices of macro patchuDiscr
- number of vertices along u-directionvDiscr
- number of vertices along v-directionmakeQuadrConn(int, int)
public void buildTriangle(PdVector[] triangle, int discr)
triangle
- array with three vertices of macro patchdiscr
- number of points on each edgemakeTriangleBnd(int)
public void buildPolygon(PdVector[] polygon, int discr)
TODO: Method should be split, and coordinate stuff move to PgPointSet.
polygon
- triangle array with three vertices of macro patchdiscr
- number of points on each edgemakeTriangleBnd(int)
public void buildTriangleFromCurve(PgPolygon[] curve, PgBndConstraint[] bndConstr)
curve
- array with three polygons with same number of verticesbndConstr
- boundary constraints assigned to boundary polygonsmakeTriangleConn(int)
public void buildQuadrFromCurve(PgPolygon[] curve, PgBndConstraint[] bndConstr)
curve
- array with four polygons with pairwise same number of verticesbndConstr
- boundary constraints assigned to boundary polygonsmakeTriangleConn(int)
public boolean close()
true
if successfulremoveUnusedVertices()
public int getNumUnusedVertices()
public boolean removeUnusedVertices()
close()
vertices are
no longer in used since elements are identified long interior boundary curves.
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).true
if method was successfulpublic int[] removeMarkedVertices()
removeMarkedVertices
in class PgPointSet
public int[] removeElement(int ind)
PsObject.IS_DELETED
and invokes removeMarkedElements()
.removeElement
in interface PgGeometryIf
removeElement
in class PgGeometry
ind
- index of element which is to be deletedpublic int[] removeMarkedElements()
PsObject.IS_DELETED
.
E.g. after application of method close()
elements are
no longer in use since elements are shrunk at zero-length boundary curves.
First, the method computes where each element is moved to, then all element data
is moved and the references to the element in bnd curves is changed. This routine is O(n).
Method assumes that there exist no references to marked elements. Otherwise application of this method would lead to unpredictable results.
public boolean merge(PgGeometryIf aGeom)
close()
.
The merged geometry will local colors allocated and assigned 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
- elementSet to be merged into 'this'true
if method was successfulclose()
public boolean refineGlobalIntoFour()
public boolean refineGlobalIntoFour(boolean bInsertMidPoints)
bInsertMidPoints
- flag, if new vertices shall be computed to edge mid points.true
if method was successfulPwRivaraBisection.rivaraRefinement(jv.geom.PgElementSet, int[])
public int getElementWithVertex(int vertexInd)
public PgEdgeStar getEdge(int vInd1, int vInd2)
Note, method runs through all elements to find an edge.
So, do not use this method in inner loops but create an edge array instead
using getEdgeStars()
.
vInd1
- Index of edge vertices in global vertex array of elementSet.vInd2
- Index of edge vertices in global vertex array of elementSet.getEdgeStars()
public void clearTagElement(int ind, int aTag)
PvGeometryIf
.clearTagElement
in interface PgGeometryIf
clearTagElement
in class PgGeometry
public boolean hasTagElement(int ind, int aTag)
PvGeometryIf
.hasTagElement
in interface PgGeometryIf
hasTagElement
in class PgGeometry
public void setTagElement(int ind, int aTag)
PvGeometryIf
.setTagElement
in interface PgGeometryIf
setTagElement
in class PgGeometry
public PdVector[] getElementVertices(int elemInd)
public PiVector getElement(int ind)
getElement
in interface PgGeometryIf
getElement
in class PgGeometry
ind
- index of elementpublic PiVector getNeighbour(int ind)
ind
- index of elementpublic java.awt.Color getElementColor(int ind)
ind
- index of elementpublic java.awt.Color getElementBackColor(int ind)
ind
- index of elementpublic PdVector getElementNormal(int ind)
ind
- index of elementpublic boolean setElementVertices(int elemInd, PdVector[] vArray)
elemInd
- index of elementvArray
- array with new coordinates of element verticespublic void setElement(int elemInd, int a, int b, int c)
elemInd
- index of elementa
- new vertex index of elementb
- new vertex index of elementc
- new vertex index of elementpublic void setElement(int elemInd, int a, int b, int c, int d)
elemInd
- index of elementa
- new vertex index of elementb
- new vertex index of elementc
- new vertex index of elementd
- new vertex index of elementpublic boolean setElement(int elemInd, int[] anIndArray)
elemInd
- index of elementanIndArray
- array with new vertex indices of elementpublic boolean setElement(int ind, PiVector newElem)
setElement
in interface PgGeometryIf
setElement
in class PgGeometry
ind
- index of elementnewElem
- vector with new indices of elementpublic boolean setNeighbour(int ind, PiVector newNeigh)
Usually, an applications calls makeNeighbour() instead of calling this low level method. This method is provided for efficiency.
ind
- index of elementnewNeigh
- vector with indices of neighbour elementspublic boolean setElementColor(int ind, java.awt.Color aColor)
ind
- index of elementaColor
- color to be copied to color listpublic boolean setElementBackColor(int ind, java.awt.Color aColor)
ind
- index of elementaColor
- color to be copied to color listpublic boolean setElementNormal(int ind, PdVector aNormal)
ind
- index of elementaNormal
- normal to be copied to normal listpublic boolean setElementTexture(int ind, PdVector[] aTexture)
ind
- index of elementaTexture
- array with texture coordinates to be copiedpublic void setElements(PiVector[] element)
getNumElements()
elements of source array into
an existing element array.
If source array is too small then abort operation.
Assure size of neighbour array, but recomputation of neighbour information must be
invoked explicitly using makeNeighbour()
.
Appearance of elements with 2 or less vertices should be avoid. They lead to a setting of m_dimOfElements=2.
element
- array of element vectors to be copiedpublic void removeElementColors()
Showing of element colors must be switched off explicitly using
showElementColors(boolean)
.
public void setElementColors(java.awt.Color[] color)
Showing of element colors must be switched on in order to be visible.
color
- array with new element colorspublic void removeElementBackColors()
Showing of backface element colors must be switched off explicitly using
showElementBackColor(boolean)
.
public void setElementBackColors(java.awt.Color[] color)
Showing of back element colors must be switched on in order to be visible.
color
- array with new element colorspublic void removeElementNormals()
Showing of element normals must be switched off explicitly using
showElementColors(boolean)
.
public void setElementNormals(PdVector[] normal)
Showing of element normals must be switched on in order to be visible.
normal
- array with new element normalspublic void setElementTextures(PdVector[][] texCoords)
getDimOfTextures()
of the geometry.
Showing of textures must be switched on in order to be visible.
texCoords
- array with new element texturessetElementTexturesFromList(PdVector [])
public void setElementTexturesFromList(PdVector[] texCoords)
getNumElementIndices()
.
All textures coordinates are copied. The dimension of all argument texture
vectors must be equal to getDimOfTextures() of the geometry.
In contrast to the method
setElementTextures(PdVector [][])
the texture coordinates of the double vector are simply linearized,
that means, if the first element has n-vertices, then the first
n-textures coordinates are used as texture coordinates of this element.
Showing of textures must be switched on in order to be visible.
texCoords
- array with new element texturessetElementTextures(PdVector [][])
public void removeTexture()
removeTexture
in class PgPointSet
public void setNeighbours(PiVector[] neighbour)
neighbour
- array with neighbour informationmakeNeighbour()
public int getNeighbourLocInd(int elemInd, int vInd, int wInd)
Modified to handle elements with more than three edges too. The 'neighbour vertex' is now defined as the place which stores the neighbourhood information for edge (vInd, wInd) in m_neighbour. If i is the lowest local index of both edge vertices, then i+elemLen-1 is the searched position. In case of a triangle, i+elemLen-1 == i+2, so nothing is changed for triangles.
vInd
- index of first vertex of an element edge, not local indiceswInd
- index of second vertex of an element edge, not local indiceselemInd
- an element indexgetOppVertexLocInd(int, int)
public int getOppVertexInd(int elemInd, int locInd)
elemInd
- an element indexlocInd
- local index such that m_neighbour[elemInd].m_data[locInd]==neighElemInd
is the adjacent element.getOppVertexLocInd(int, int)
public int getOppVertexLocInd(int elemInd, int locInd)
(i-1+nov)%nov
is the searched position. In case of a triangle, (i-1+nov)%nov == (i+2)%nov
,
so nothing has changed for triangles.
Returns -2 in case of bug in neighbourhood. Use makeNeighbour() to create a new neighbourhood.
elemInd
- an element indexlocInd
- local index such that m_neighbour[elemInd].m_data[locInd]==neighElemInd
is the adjacent element.getNeighbourLocInd(int, int, int)
public double getAreaOfElement(int elemInd)
public double getArea()
public double getVolumeOfElement(int elemInd)
A sphere with positively oriented triangles such that normals point outward will have a positive volume.
public double getVolume()
public double getL2Norm()
public PdMatrix getL2Matrix(PdMatrix mat)
public double getEdgeLength(int elemInd, int locInd)
elemInd
- index of elementlocInd
- local index of vertex whose neighbour refers to this edgepublic double getVertexAngle(int elemInd, int locInd)
elemInd
- index of elementlocInd
- local index of vertexpublic void computeRotation(PgPolygon meridian, int numULines)
close()
to remove interior boundaries.
Compute vertex normals.computeRotation
in class PgPointSet
meridian
- meridian given as polygonnumULines
- discretization in angular directionpublic void computeCone(int numULines, int numVLines, double bottomRadius, double height)
close()
to remove interior boundaries.
Compute vertex normals.
Sample method to have simple geometry available for test purposes.computeCone
in class PgPointSet
numULines
- discretization in angular directionnumVLines
- discretization in z-axis directionbottomRadius
- radius of bottom disk of coneheight
- height of cone from bottom disk to tippublic void computeCylinder(int numULines, int numVLines, double radius, double length)
close()
to remove interior boundaries.
Compute vertex normals.
Sample method to have simple geometry available for test purposes.computeCylinder
in class PgPointSet
numULines
- discretization in angular directionnumVLines
- discretization in z-axis directionradius
- radius of cylinderlength
- height of cylinderpublic void computeDisk(int numULines, int numVLines, double radius)
close()
to remove interior boundaries.
Compute vertex normals.
Sample method to have simple geometry available for test purposes.computeDisk
in class PgPointSet
numULines
- discretization in radial directionnumVLines
- discretization in angular directionradius
- radius of diskpublic void computePlane(int numULines, int numVLines, double uMin, double vMin, double uMax, double vMax)
close()
to remove interior boundaries.
Compute vertex normals.
Sample method to have simple geometry available for test purposes.computePlane
in class PgPointSet
numULines
- discretization in x directionnumVLines
- discretization in y directionuMin
- u coordinate of lower left corner of rectanglevMin
- v coordinate of lower left corner of rectangleuMax
- u coordinate of upper right corner of rectanglevMax
- v coordinate of upper right corner of rectanglepublic void computeSphere(int numULines, int numVLines, double radius)
close()
to remove interior boundaries.
Compute vertex normals.
Sample method to have simple geometry available for test purposes.computeSphere
in class PgPointSet
numULines
- discretization in angular directionnumVLines
- discretization in meridian directionradius
- radius of spherepublic void computeTorus(int numULines, int numVLines, double radius, double thick)
close()
to remove interior boundaries.
Compute vertex normals.
Sample method to have simple geometry available for test purposes.computeTorus
in class PgPointSet
numULines
- discretization in angular directionnumVLines
- discretization in meridian directionradius
- radius of soalthick
- radius of torus tubepublic void computeSnail(int numULines, int numVLines, double numWindings)
computeSnail
in class PgPointSet
numULines
- discretization in angular directionnumVLines
- discretization in meridian directionnumWindings
- number of half-turns of snail housepublic int getNumBoundaryEdges()
If surface is non-manifold and neighbour information is not correct then this method may determine a wrong number of boundary edges.
getNumBoundaries()
,
getNumEdges()
public int getNumEdges()
If neighbour information is missing, then each element edge is counted. Algorithm runs once over all elements and counts an edge if the index of the adjacent element is smaller than the index of the current element.
If surface is non-manifold and neighbour information is not correct then this method may determine a wrong number of edges.
See also getNumEdges() which returns the number of edges of the underlying simplicial complex. Note, getNumEdgeStars() will return 0 if no edgeStars are allocated while getNumEdges() always returns a number related to the simplicial complex. Use getNumEdgesStars() when working with edgeStar array, and use getNumEdges() in combinatorial calculations.
getNumEdgeStars()
,
getNumBoundaryEdges()
public void fixBoundaries()
public void markBoundary()
public int getNumBoundaryVertices()
markBoundary()
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 boolean isConforming()
true
if elementSet is conforming, else false
.public void setConforming(boolean flag)
public static boolean triangulate(PgElementSet geom)
PgUtil.triangulate(PdVector [], int)
.geom
- Surface with polygonal faces. Modified after this calling method.PgUtil.triangulate(PdVector [], int)
public boolean checkNeighbour()
public boolean checkNeighbour(boolean bMessage)
- length of each neighbour array has same size as element array - it does not reference itself - it is neighbour of each adjacent element - it and its neighbour join an edge with common vertices.
bMessage
- Flag to send a message to the console.public 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 int getSavedNumVertices()
public void setSavedNumVertices(int num)
public PiVector[] getSavedElements()
public void setSavedElements(PiVector[] element)
public boolean makeElementColorsFromXYZ()
public boolean makeElementColorsFromZ()
public boolean makeElementColorsFromZHue()
public boolean makeElementFromVertexColors()
public boolean makeVertexFromElementColors()
public boolean makeElementFromVertexTexture()
public PgGeometry reflect(PdMatrix mat, boolean bOrient, boolean bVector)
reflect
in interface PgGeometryIf
reflect
in class PgPointSet
mat
- 3*3 or 4*4 transformation matrixbOrient
- flag whether to keep the orientation of the geometrybVector
- flag whether to keep the orientation of vectorspublic boolean resetBoundaryNormals()
public int[] getFVector()
Note, the number of vertices may include some vertices which are not referenced by elements. The number of unused vertices must be subtracted from the number of vertices found in the F-vector when computing the Euler characteristic.
getFVector
in class PgPointSet
"