public class PgTetraSet extends PgPointSet
PgPointSet
. Additionally,
there exist instance variables for tetra normals, tetra colors, tetra texture
coordinates, and other tetra properties. Note, that such tetra properties are not stored
with each tetra but each property is stored in an additional array of same length
as the array of tetras. 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 tetra is the same for all tetras of the tetra set, each tetra has four vertices.
There exist several utility functions to allocate and modify the number of tetras, for example,
setNumTetras(int num)
allocates num
tetras. 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 tetras is changed, the class automatically adjusts the size
of those tetra properties which are currently in use, i.e. whose array is not null
.
Applications may modify the entries of a tetra and of tetra properties by direct method calls such as
setTetra(int, PiVector)
which sets the tetra with index ind equal to the components of a vector v by copying.
Alternatively, if an application modifies a larger number of tetras then the application
may prefer to obtain the tetra array from the tetra set and directly modify the array
PiVector [] tetra = tetraSet.getTetras()
;
for (int i=0; i<tetraSet.getNumTetras(); i++)
tetra[i].copy(v);
The same choice is available for arrays containing tetra properties.
Note, that classes like PgTetraSet, may not reference all vertices, e.g.
if the currently active tetras consists of a subset of all vertices.
Also note, that the actual size of the tetra array may differ from m_numTetras
efficiency reasons. Therefore, do not use tetra.length but use getNumTetras().
This class contains mainly basic methods for memory allocation and access to instance variables. Geometric methods operating on tetra 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 computeBox
(if source code access to JavaView is available), or the tutorial applets of JavaView.
Modifier and Type | Field and Description |
---|---|
static int[][] |
FACE_TO_VERTEX
Changed to positive oriented triangles (normal pointing outward if tet is
positively oriented).
|
static int[][] |
LOCAL_EDGE_TO_VERTEX
Local indices of the two vertices of all edges of tetrahedra.
|
static int[][] |
LOCAL_FACE_TO_EDGE
For a given tet, [i] contains edge indices of the edges adjacent to the i-th face.
|
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 |
---|
PgTetraSet()
Constructor of a tetrahedral grid for a solid in three-dimensional space.
|
PgTetraSet(int aVertexDim)
Constructor of a tetrahedral grid for a solid in a space of given dimension.
|
Modifier and Type | Method and Description |
---|---|
int |
addElement(PiVector el)
Add a new tetrahedron.
|
int |
addTetra(PiVector tetra)
Add a new tetrahedron to the end of the tetrahedra list and increment the
number of tetrahedra.
|
boolean |
applyModelingMatrix()
Multiply the modeling matrix to all vertices and vectors.
|
void |
assureBoundary(int num)
Allocate boundary polygons and register current tetra set.
|
void |
assureTetraColors()
Assures respectively allocates correct length of tetrahedron color array.
|
void |
assureTetraTextures()
Assures respectively allocates correct length of tetrahedron texture array.
|
boolean |
blend(double s,
PgGeometry ag,
double t,
PgGeometry bg)
Blend between two tetra sets, used in interpolation and
computing the associate surfaces
this = s*ag + t*bg . |
void |
buildCube(PdVector[] quadr,
int uDiscr,
int vDiscr,
int wDiscr)
Creates a volume by trilinear interpolation of eight given vertices and
given discretization.
|
boolean |
checkNeighbour()
Check correct neighbour connectivity.
|
boolean |
checkNeighbour(boolean bMessage)
Check correct neighbour connectivity.
|
void |
clearTagTetra(int ind,
int aTag)
Clear a single tag of a tetrahedron.
|
java.lang.Object |
clone()
Duplicate geometry by recursively cloning all instance variables
except inspector panels and lists of registered listeners.
|
void |
computeBox(int numULines,
int numVLines,
int numWLines,
double uMin,
double vMin,
double wMin,
double uMax,
double vMax,
double wMax)
Generates rectangular volume with given min/max values.
|
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 |
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(PgTetraSet geom)
Copy connectivity of mesh, i.e. tetrahedra and neighbour array.
|
void |
copyTetraSet(PgTetraSet geom)
Copy instance variables of this class but not of its superclass.
|
void |
flipOrientation()
Change orientation of all tetrahedra and invert normal vectors.
|
double |
getArea()
Compute total area of boundary surface of tetrahedral volume.
|
PgBndElementSet[] |
getBoundaries()
Get array of boundary surfaces.
|
PdVector |
getCenterOfTetra(int t)
Get center point of tetrahedron.
|
int |
getDimOfTetras()
Get number of vertices per tetrahedron which is constant 4.
|
double |
getEdgeLength(int tetraInd,
int locInd1,
int locInd2)
Compute length of tetrahedron edge specified by tetrahedron index and vertex indices.
|
int |
getEdgeVertex0(int tet,
int locEdgeInd)
Get first vertex of the edge in given tet with given local edge index.
|
int |
getEdgeVertex1(int tet,
int locEdgeInd)
Get first vertex of the edge in given tet with given local edge index.
|
PiVector |
getFace(int t,
int i)
Get a face triangle of a tetra.
|
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.
|
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 |
getGlobalTetraColor()
Get global tetrahedron color which is used if no local colors are available.
|
java.awt.Color |
getGlobalTetraTagColor()
Get global color of tagged tetrahedra.
|
PgJvxSrc |
getJvx()
Fills a geometry object with data from this instance, for example, to print to file.
|
int |
getMaxNumTetras()
Get total length of allocated tetrahedron 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 |
getNumBoundaryFaces()
Calculate number of boundary Faces of a manifold solid 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 3d triangulation using m_neighbour information.
|
int |
getNumFaces()
Get number of triangle faces of tetrahedron set.
|
int |
getNumTetraIndices()
Get total number of vertex entries in all tetrahedra.
|
int |
getNumTetras()
Get number of tetrahedra in tetrahedron array.
|
int |
getNumUnusedVertices()
Get the number of unused vertices which are not references by tetrahedra.
// * This method is very cheap and should be
|
int |
getOppVertexInd(int tetraInd,
int locInd)
In the adjacent tetrahedron find the vertex containing the neighbourhood information for the
original tetrahedron.
|
int |
getOppVertexLocInd(int tetraInd,
int locInd)
In the adjacent tetrahedron find the vertex containing the neighbourhood information for the
original tetrahedron.
|
int |
getOtherVertexLocInd(int tetraInd,
int uInd,
int vInd,
int wInd)
For a given face return the local index of the vertex containing the
neighbourhood information.
|
PgElementSet |
getSurface(PgElementSet surface)
Gets the surface elements of the tetrahedron set.
|
PiVector |
getTetra(int ind)
Get a reference to an individual tetrahedron.
|
java.awt.Color |
getTetraColor(int ind)
Get a reference to an individual tetrahedron color.
|
java.awt.Color[] |
getTetraColors()
Get tetrahedron color array for read and write access, but do not modify the size of any color vector.
|
PiVector[] |
getTetras()
Get tetrahedron array for read and write access.
|
PdVector[] |
getTetraTexture(int ind)
Get tetrahedron texture array of an individual tetrahedron.
|
PdVector[][] |
getTetraTextures()
Get tetrahedron texture array for read and write access, but do not modify the size of any texture vector.
|
PdVector[] |
getTetraVertices(int elemInd)
Get an array with pointers to all vertices of a tetrahedron.
|
int |
getTetraWithEdge(int vertexInd1,
int vertexInd2)
Find first tetrahedron with an edge whose two vertex indices are given.
|
PdVector[] |
getVertexTextures()
Get array of all texture coordinates both for vertex and tetrahedron based textures.
|
static PiVector |
getVertexValence(PgTetraSet geom)
Compute valence of each vertex, that is, the number of incoming edges.
|
double |
getVolume()
Compute total volume of the solid.
|
double |
getVolume2()
Compute total volume of the solid, using the dimension-independent
getVolumeOfNdTetra(int) method. |
double |
getVolumeOfNdTetra(int tetraInd)
Compute algebraic volume of the cone of a face with the third vertex.
|
double |
getVolumeOfTetra(int tetraInd)
Compute algebraic volume of the cone of a face with the third vertex.
|
boolean |
hasBoundary()
Check whether surface has boundary polygons, assume boundary has been calculated.
|
boolean |
hasTagTetra(int ind,
int aTag)
Check whether tetrahedron has given tag.
|
boolean |
hasTetraColors()
Check if tetrahedron colors have been allocated.
|
boolean |
hasTetraTextures()
Check if tetrahedron textures have been allocated.
|
void |
init()
Initialize and reset instance variables after call to super.init().
|
PvPickEvent |
intersectionWithLine(PdVector rayBaseWorld,
PdVector rayDirWorld)
Find intersection of tetra set with a given ray.
|
boolean |
isShowingBoundaries()
Determines whether drawing of boundary curves is enabled.
|
boolean |
isShowingEdgeColorFromTetras()
Determines whether local edge color is induced from tetrahedron 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 |
isShowingEdges()
Determines whether drawing of tetrahedron edges is enabled.
|
boolean |
isShowingSmoothEdgeColors()
Determines whether smooth coloring of edges is enabled, currently requires vertex colors.
|
boolean |
isShowingSmoothLighting()
Determines whether smooth lighting is enabled, requires vertex normals.
|
boolean |
isShowingSmoothTetraColors()
Determines whether smooth coloring of tetrahedra is enabled, currently requires vertex colors.
|
boolean |
isShowingTaggedBoundaries()
Determines whether drawing of tagged boundary curves is enabled.
|
boolean |
isShowingTaggedTetras()
Determines whether drawing of tagged tetrahedra is enabled.
|
boolean |
isShowingTetraColors()
Determines whether global tetrahedron color is used.
|
boolean |
isShowingTetraFromVertexColors()
Determines whether smooth tetrahedron coloring uses vertex colors, requires vertex colors.
|
boolean |
isShowingTetraLabels()
Determines whether showing of tetrahedron labels is enabled.
|
boolean |
isShowingTetras()
Determines whether drawing of tetrahedra is enabled.
|
boolean |
isShowingTetraTexture()
Determines whether drawing of tetrahedron texture is enabled.
|
void |
makeCubeConn(int uDiscr,
int vDiscr,
int wDiscr)
Generates element and neighbourhood information for a quadrilateral
volume.
|
void |
makeCubeTetraTexture(int uDiscr,
int vDiscr,
int wDiscr)
Generate default tetrahedron texture in [0,1]*[0,1]*[0,1] for a cubical volume.
|
PgEdgeStar[] |
makeEdgeStars()
Generate list of edges from element information of a possibly non-manifold surface.
|
boolean |
makeNeighbour()
Generate neighbourhood information for a given manifold polyhedron.
|
boolean |
makeTetraColorsFromXYZ()
Create color from the tetrahedron position within its bounding box
which is interpreted as RGB cube.
|
boolean |
makeTetraColorsFromZ()
Create color from the vertical z-height within its bounding box
ranging from low blue to high red.
|
boolean |
makeTetraColorsFromZHue()
Create color from the vertical z-height within its bounding box
ranging through hue rainbow.
|
boolean |
makeTetraFromVertexColors()
Create tetra colors as average of all colors of its vertices.
|
boolean |
makeTetraFromVertexTexture()
Create tetra textures from vertex textures and remove vertex textures.
|
boolean |
makeVertexFromTetraColors()
Create vertex colors as average of individual color of all adjacent tetras.
|
void |
markBoundary()
Tag all boundary vertices as those.
|
boolean |
merge(PgGeometryIf aGeom)
Merge tetra 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.
|
PgGeometry |
reflect(PdMatrix mat,
boolean bOrient,
boolean bVector)
Generate a cloned geometry and transform vertices by a matrix.
|
void |
removeBoundaries()
Remove all boundary surfaces.
|
int |
removeDeletedBoundaries()
Remove all boundary surfaces which are marked PsObject.IS_DELETED.
|
int[] |
removeMarkedTetras()
Remove all tetrahedra which have been marked
PsObject.IS_DELETED . |
int[] |
removeMarkedVertices()
Remove vertices marked with tag PsObject#IS_DELETED from tetrahedra.
|
int[] |
removeTetra(int ind)
Remove tetrahedron with given index, and decrement index of all tetrahedra with higher index.
|
void |
removeTetraColors()
Remove local tetrahedron colors from a geometry and use global
tetrahedron color instead.
|
void |
removeTexture()
Remove all texture information from surface and switch off showing of texture.
|
boolean |
removeUnusedVertices()
Remove all points not referenced by tetrahedra.
|
boolean |
resetBoundaryNormals()
Remove boundary vertex normal.
|
void |
setBoundary(PgBndElementSet[] newBnd)
Set new boundary polygons by replacing the previous array with the argument array.
|
void |
setDimOfColors(int aSize)
Let all colors have same number of components
aSize! |
void |
setDimOfVectors(int aSize)
Let all vectors have same number of vectors
aSize! |
void |
setGlobalBndColor(java.awt.Color color)
Set global boundary color to be used if no local colors are available.
|
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 |
setGlobalTetraColor(java.awt.Color color)
Set global tetrahedron color to be used if no local colors are available.
|
void |
setGlobalTetraTagColor(java.awt.Color color)
Set global color of tagged tetrahedra.
|
void |
setJvx(PgJvxSrc src)
Fill this instance with data from a geometry source, for example, previously read from file.
|
void |
setMaxNumTetras(int numTetras)
Major memory allocation routine, all tetrahedron allocation should be done here.
|
boolean |
setNeighbour(int ind,
PiVector newNeigh)
Set neighbour tetrahedra of given tetrahedron.
|
void |
setNeighbours(PiVector[] neighbour)
Copy neighbour array to existing array of neighbours.
|
void |
setNumFaces(int numFaces)
Major memory allocation routine, all element allocation should be done here.
|
void |
setNumTetras(int numTetras)
Allocate given number of tetrahedra, and allocate normals, colors etc.
|
void |
setTagTetra(int ind,
int aTag)
Set a tag of a tetrahedron.
|
boolean |
setTetra(int elemInd,
int[] anIndArray)
Copy new vertex indices to tetrahedron at specified position in the tetrahedron list.
|
void |
setTetra(int elemInd,
int a,
int b,
int c,
int d)
Copy new vertex indices to tetra at specified position in the tetrahedron list.
|
boolean |
setTetra(int ind,
PiVector newElem)
Copy new vertex indices to tetrahedron at specified position in the tetrahedron list.
|
boolean |
setTetraColor(int ind,
java.awt.Color aColor)
Copy new color to tetrahedron color at specified position in the color list
|
void |
setTetraColors(java.awt.Color[] color)
Copy tetrahedron colors of list to existing array of tetrahedron colors.
|
void |
setTetras(PiVector[] tetra)
Copy the first
getNumTetras() tetrahedra of source array into
an existing tetrahedron array. |
boolean |
setTetraTexture(int ind,
PdVector[] aTexture)
Copy new texture coordinates to tetrahedron texture at specified position in the tetrahedron texture list
|
void |
setTetraTextures(PdVector[][] texCoords)
Use the given textures coordinates as tetra-based texture coordinates.
|
void |
setTetraTexturesFromList(PdVector[] texCoords)
Use the given textures coordinates as tetra-based texture coordinates.
|
boolean |
setTetraVertices(int elemInd,
PdVector[] vArray)
Copy new tetra vertices at specified position in the vertex array of PgPointSet.
|
void |
showBoundaries(boolean flag)
Set flag to enable drawing of boundary surfaces.
|
void |
showEdgeColorFromTetras(boolean flag)
Set flag if edge colors are induced from local tetrahedron 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 |
showEdges(boolean flag)
Set flag to enable drawing of tetrahedron edges.
|
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 |
showSmoothTetraColors(boolean flag)
Set flag to enable smooth coloring of tetrahedra, currently requires vertex colors.
|
void |
showTaggedBoundaries(boolean flag)
Set flag to enable drawing of boundary surfaces.
|
void |
showTaggedTetras(boolean flag)
Set flag to enable drawing of tagged tetrahedra.
|
void |
showTetraColors(boolean flag)
Set flag of using global tetrahedron color instead of coloring each tetrahedron individually.
|
void |
showTetraFromVertexColors(boolean flag)
Set flag to enable smooth tetrahedron coloring using vertex colors at vertices, requires vertex colors.
|
void |
showTetraLabels(boolean flag)
Set flag to enable drawing of tetrahedron labels in display.
|
void |
showTetras(boolean flag)
Set flag to enable drawing of tetrahedra.
|
void |
showTetraTexture(boolean flag)
Set flag to enable drawing of tetrahedron texture.
|
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.
|
boolean |
update(java.lang.Object event)
Update the class whenever a child has changed.
|
addGeometryItem, addVectorField, addVertex, applyAmbientMatrix, assureVertexColors, assureVertexNormals, assureVertexSizes, assureVertexTextures, clearTagVertex, computeDisk, computePlane, computeRotation, computeSnail, copySelect, getAmbientBounds, getBounds, getCenterOfBndBox, getCenterOfGravity, getDimOfColors, getDimOfTextures, getDimOfVectors, getEulerCharacteristic, getGlobalVectorColor, getGlobalVectorLength, getGlobalVectorSize, getGlobalVertexColor, getGlobalVertexNormalColor, getGlobalVertexNormalLength, getGlobalVertexNormalSize, getGlobalVertexSize, getGlobalVertexTagColor, getIndexOfVectorField, getMarkedVertices, getMarkedVertices, getMaxNumVertices, getNumVectorFields, getNumVertices, getSelectedVectorField, getShininess, getSpecularColor, getTexture, getTextureImage, getTextureImageName, getTransparency, getVectorField, getVectorField, getVertex, getVertexColor, getVertexColors, getVertexNormal, getVertexNormals, getVertexSize, getVertexSizes, getVertexTexture, getVertices, hasTagVertex, hasVertex, hasVertex, hasVertexColors, hasVertexNormals, hasVertexSizes, hasVertexTextures, isDefaultLabelEnabled, isEnabledIndexLabels, isShowingIndices, isShowingSingleVectorField, isShowingTaggedVertices, isShowingTransparency, isShowingVectorArrow, isShowingVectorArrows, isShowingVectorColors, isShowingVectorField, isShowingVectorFields, isShowingVertexColors, isShowingVertexLabels, isShowingVertexNormalArrow, isShowingVertexNormals, isShowingVertexOutline, isShowingVertexSizes, isShowingVertexTexture, isShowingVertices, makeColorFromVectorLength, makeQuadrVertexTexture, makeVertexColorsFromNormal, makeVertexColorsFromXYZ, makeVertexColorsFromZ, makeVertexColorsFromZHue, makeVertexNormals, makeVertexTextureFromBndBox, makeVertexTextureFromCylinder, makeVertexTextureFromSphere, makeVertexTextureFromUV, projectFromAmbientSpace, projectToSphere, removeAllVectorFields, removeHiddenVectorFields, removeVectorField, removeVertex, removeVertexColors, removeVertexNormals, removeVertexSizes, scale, scale, selectVectorField, setCenterOfBndBox, setDefaultLabelEnabled, setDimOfTextures, setDimOfVertices, 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, showVertices, translate
addDisplay, addPolygon, clearTagElement, clearTagPolygon, convertWorldToModel, fillMethodMenu, fillMethodMenu, getAmbientInvMatrix, getAmbientMatrix, getAmbientProjection, getAmbientSpace, getAuthorInfo, getAuthors, getCenter, getCenterOfElement, getControlPanel, getDiameter, getDimOfSimplex, getDimOfVertices, getDisplayList, getDisplays, getElement, getGeometryInfo, getLabelAttribute, getLabelColor, getLabelFont, getLabelSize, getLabelStyle, getMaterialPanel, getModelMatrix, getPolygon, getState, getTitle, getType, getVersion, getVersionType, hasAmbientMatrix, hasDisplay, hasModelMatrix, hasTagElement, hasTagPolygon, isConfigurable, isEnabledInstanceSharing, isShowingBndBox, isShowingCenter, isShowingName, isShowingTitle, isVisible, removeDisplay, removeElement, removeMethodMenus, removePolygon, setAmbientMatrix, setAmbientProjection, setAmbientSpace, setAuthorInfo, setAuthors, setCenter, setDimOfSimplex, setElement, setEnabledInstanceSharing, setGeometryInfo, setLabelAttribute, setLabelAttribute, setLabelColor, setLabelFont, setLabelSize, setLabelStyle, setModelMatrix, setPolygon, setTagElement, setTagPolygon, setTitle, setType, setVersion, setVersionType, setVisible, showBndBox, showCenter, showName, showTitle
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[][] LOCAL_EDGE_TO_VERTEX
m_tetra.m_data[LOCAL_EDGE_TO_VERTEX[k][0]]
and
m_tetra.m_data[LOCAL_EDGE_TO_VERTEX[k][1]]
.public static final int[][] LOCAL_FACE_TO_EDGE
public static final int[][] FACE_TO_VERTEX
public PgTetraSet()
This constructor allows to create a geometry by specifying the class name as string. By default, showing of vertices is enabled.
public PgTetraSet(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.
// TODO: Tetra normals??? // Is this just cut-and-paste stuff, or is it really done? If src geometry has missing tetra normals then method calculates tetra normals using makeTetraNormals(), 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 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 copyTetraSet(PgTetraSet geom)
public void copyConnectivity(PgTetraSet 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 addTetra(PiVector tetra)
If tetrahedron normals exist then the normal is calculated for the new tetrahedron too. Note, if vertex normals exist then the normals of the tetrahedron vertices are currently not recalculated (this behavior might change in the future).
If tetrahedron colors exist then the color of the new tetrahedron is the global tetrahedron color. // TODO: New tetrahedron's neighbourhood is not yet computed.
tetra
- tetrahedron to be added to tetrahedra listpublic java.awt.Color getGlobalTetraColor()
public java.awt.Color getGlobalTetraTagColor()
public void setGlobalTetraColor(java.awt.Color color)
public void setGlobalTetraTagColor(java.awt.Color color)
public java.awt.Color getGlobalEdgeColor()
public double getGlobalEdgeSize()
public void setGlobalEdgeColor(java.awt.Color color)
public void setGlobalEdgeSize(double size)
public java.awt.Color getGlobalBndColor()
public java.awt.Color getGlobalBndTagColor()
public void setGlobalBndColor(java.awt.Color color)
public void setGlobalBndTagColor(java.awt.Color color)
public PiVector[] getTetras()
Do not modify the size of any tetrahedron vector.
Note, that the actual size of the array may be larger than m_numTetras for efficiency reasons. Therefore, do not use the length of array.
public java.awt.Color[] getTetraColors()
public PdVector[] getTetraTexture(int ind)
public PdVector[][] getTetraTextures()
public PdVector[] getVertexTextures()
getVertexTextures
in class PgPointSet
public PiVector[] getNeighbours()
public int getNumBoundaries()
getBoundaries()
public boolean hasBoundary()
public PgBndElementSet[] getBoundaries()
public void removeBoundaries()
public int removeDeletedBoundaries()
public void setBoundary(PgBndElementSet[] newBnd)
newBnd
- array with new boundary polygons of tetra set.public void assureBoundary(int num)
public boolean isShowingEdges()
public void showEdges(boolean flag)
public boolean isShowingEdgeColors()
public void showEdgeColors(boolean flag)
public boolean isShowingEdgeColorFromTetras()
public void showEdgeColorFromTetras(boolean flag)
public boolean isShowingSmoothEdgeColors()
public void showSmoothEdgeColors(boolean flag)
public boolean isShowingEdgeColorFromVertices()
public void showEdgeColorFromVertices(boolean flag)
public boolean isShowingTetraLabels()
public boolean isShowingTetras()
public boolean isShowingTaggedTetras()
public boolean isShowingTetraTexture()
public boolean isShowingBoundaries()
public boolean isShowingTaggedBoundaries()
public boolean isShowingTetraColors()
public boolean isShowingSmoothLighting()
public void showSmoothLighting(boolean flag)
public boolean isShowingSmoothTetraColors()
public void showSmoothTetraColors(boolean flag)
public boolean isShowingTetraFromVertexColors()
public void showTetraFromVertexColors(boolean flag)
public void showTetraLabels(boolean flag)
public void showTetras(boolean flag)
public void showTaggedTetras(boolean flag)
public void showTetraTexture(boolean flag)
public void showVertexTexture(boolean flag)
showVertexTexture
in class PgPointSet
public void showBoundaries(boolean flag)
public void showTaggedBoundaries(boolean flag)
public void showTetraColors(boolean flag)
public int getNumFaces()
public void setNumFaces(int numFaces)
public int getMaxNumTetras()
public void setMaxNumTetras(int numTetras)
public int getNumTetras()
public int getNumTetraIndices()
public void setNumTetras(int numTetras)
Note, the neighbour array might be initialized to -1 when its size changes.
public int getDimOfTetras()
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 tetrahedron.PgPointSet.setDimOfVectors(int)
public boolean hasTetraColors()
assureTetraColors()
public boolean hasTetraTextures()
assureTetraTextures()
public void assureTetraColors()
public void assureTetraTextures()
getDimOfTextures()
.public void paint(PvGeometryIf dc)
jv.project.PgGeometryIf
for detailed information.paint
in interface PgGeometryIf
paint
in class PgPointSet
PgGeometryIf
public void makeCubeTetraTexture(int uDiscr, int vDiscr, int wDiscr)
uDiscr
- Number of lines in u
direction.vDiscr
- Number of lines in v
direction.wDiscr
- Number of lines in w
direction.public void makeCubeConn(int uDiscr, int vDiscr, int wDiscr)
uDiscr
- An int
with number of lines on x-axis.vDiscr
- An int
with number of lines on y-axis.wDiscr
- An int
with number of lines on z-axis.makeNeighbour()
public void flipOrientation()
flipOrientation
in class PgPointSet
PgPointSet.flipOrientation()
public static PiVector getVertexValence(PgTetraSet geom)
public void buildCube(PdVector[] quadr, int uDiscr, int vDiscr, int wDiscr)
quadr
- a PdVector array with the eight edge pointsuDiscr
- an int with the number of knots for the first axisvDiscr
- an int with the number of knots for the second axiswDiscr
- an int with the number of knots for the third axismakeCubeConn(int,int,int)
public int getNumUnusedVertices()
public boolean removeUnusedVertices()
true
if method was successfullpublic int[] removeMarkedVertices()
removeMarkedVertices
in class PgPointSet
public int[] removeTetra(int ind)
PsObject.IS_DELETED
and invokes removeMarkedTetras()
.ind
- index of tetrahedron which is to be deletedpublic int[] removeMarkedTetras()
PsObject.IS_DELETED
.
First, the method computes where each tetrahedron is moved to, then all tetrahedron data
is moved and the references to the tetra in bnd curves is changed. This routine is O(n).
Method assumes that there exist no references to marked tetrahedra. Otherwise application of this method would lead to unpredictable results.
public boolean merge(PgGeometryIf aGeom)
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
- tetraSet to be merged into 'this'true
if method was successfullpublic int getTetraWithEdge(int vertexInd1, int vertexInd2)
public void clearTagTetra(int ind, int aTag)
PvGeometryIf
.public boolean hasTagTetra(int ind, int aTag)
PvGeometryIf
.public void setTagTetra(int ind, int aTag)
PvGeometryIf
.public PdVector[] getTetraVertices(int elemInd)
public PiVector getTetra(int ind)
ind
- index of tetrapublic PiVector getNeighbour(int ind)
ind
- index of tetrapublic java.awt.Color getTetraColor(int ind)
ind
- index of tetrapublic boolean setTetraVertices(int elemInd, PdVector[] vArray)
elemInd
- index of tetravArray
- array with new coordinates of tetra verticespublic void setTetra(int elemInd, int a, int b, int c, int d)
elemInd
- index of tetraa
- new vertex index of tetrab
- new vertex index of tetrac
- new vertex index of tetrad
- new vertex index of tetrapublic boolean setTetra(int elemInd, int[] anIndArray)
elemInd
- index of tetrahedronanIndArray
- array with new vertex indices of tetrahedronpublic boolean setTetra(int ind, PiVector newElem)
ind
- index of tetranewElem
- vector with new indices of tetrapublic 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 tetranewNeigh
- vector with indices of neighbour tetraspublic boolean setTetraColor(int ind, java.awt.Color aColor)
ind
- index of tetrahedronaColor
- color to be copied to color listpublic boolean setTetraTexture(int ind, PdVector[] aTexture)
ind
- index of tetrahedronaTexture
- array with texture coordinates to be copiedpublic void setTetras(PiVector[] tetra)
getNumTetras()
tetrahedra of source array into
an existing tetrahedron 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 tetras with 2 or less vertices should be avoid. They lead to a setting of m_dimOfTetras=2.
tetra
- array of tetrahedron vectors to be copiedpublic void removeTetraColors()
Showing of tetra colors must be switched off explicitly using
showTetraColors(boolean)
.
public void setTetraColors(java.awt.Color[] color)
Showing of tetra colors must be switched on in order to be visible.
color
- array with new tetra colorspublic void setTetraTextures(PdVector[][] texCoords)
getDimOfTextures()
of the geometry.
Showing of textures must be switched on in order to be visible.
texCoords
- array with new tetra texturessetTetraTexturesFromList(PdVector [])
public void setTetraTexturesFromList(PdVector[] texCoords)
getNumTetraIndices()
.
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
setTetraTextures(PdVector [][])
the texture coordinates of the double vector are simply linearized,
that means, if the first tetra has n-vertices, then the first
n-textures coordinates are used as texture coordinates of this tetra.
Showing of textures must be switched on in order to be visible.
texCoords
- array with new tetra texturessetTetraTextures(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 tetras 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 tetra edge, not local indiceswInd
- index of second vertex of an tetra edge, not local indiceselemInd
- an tetra indexgetOppVertexLocInd(int, int)
public int getOppVertexInd(int tetraInd, int locInd)
tetraInd
- a tetrahedron indexlocInd
- local index such that m_neighbour[elemInd].m_data[locInd]==neighElemInd
is the adjacent tetra.getOppVertexLocInd(int, int)
public int getOppVertexLocInd(int tetraInd, int locInd)
Returns -2 in case of bug in neighbourhood. Use makeNeighbour() to create a new neighbourhood.
tetraInd
- a tetrahedron indexlocInd
- local index such that m_neighbour[elemInd].m_data[locInd]==neighElemInd
is the adjacent tetra.getNeighbourLocInd(int, int, int)
public int getOtherVertexLocInd(int tetraInd, int uInd, int vInd, int wInd)
uInd
- vertex index specifies a face, not local indicesvInd
- vertex index specifies a face, not local indiceswInd
- vertex index specifies a face, not local indicestetraInd
- a tetrahedron indexgetOppVertexLocInd(int, int)
public double getVolumeOfTetra(int tetraInd)
public double getVolumeOfNdTetra(int tetraInd)
getVolumeOfTetra(int)
this method is dimension-independent and
works for tetrahedra in Rn for arbitrary n>=3.
The volume is computed as 1/6*g where g is the Gram determinant of three edges spanning the tetrahedron.
TODO: (poe) Method needs proper testing. Performance could be improved in several ways, e.g. by
using a left/rightMult member method of PdMatrix that works for non-square n*m-matrices, as long as column/row sizes match.tetraInd
- A valid index for a tetrahedron in this mesh.public double getVolume2()
getVolumeOfNdTetra(int)
method.
TODO: (poe) This method should eventually replace getVolume()
.public double getVolume()
public double getArea()
public double getEdgeLength(int tetraInd, int locInd1, int locInd2)
tetraInd
- index of tetrahedronlocInd1
- local index of first vertexlocInd2
- local index of second vertexpublic void computeCone(int numULines, int numVLines, double bottomRadius, double height)
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)
computeCylinder
in class PgPointSet
numULines
- discretization in angular directionnumVLines
- discretization in z-axis directionradius
- radius of cylinderlength
- height of cylinderpublic void computeSphere(int numULines, int numVLines, double radius)
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)
computeTorus
in class PgPointSet
numULines
- discretization in angular directionnumVLines
- discretization in meridian directionradius
- radius of soalthick
- radius of torus tubepublic int getNumBoundaryFaces()
If solid is non-manifold and neighbour information is not correct then this method may determine a wrong number of boundary faces.
getNumBoundaries()
public int getNumEdges()
If neighbour information is missing, then each tetra edge is counted. Algorithm runs once over all tetras and counts an edge if the index of the adjacent tetra is smaller than the index of the current tetra.
If surface is non-manifold and neighbour information is not correct then this method may determine a wrong number of edges.
getNumBoundaryFaces()
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 checkNeighbour(boolean bMessage)
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 boolean makeTetraColorsFromXYZ()
public boolean makeTetraColorsFromZ()
public boolean makeTetraColorsFromZHue()
public boolean makeTetraFromVertexColors()
public boolean makeVertexFromTetraColors()
public boolean makeTetraFromVertexTexture()
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 tetras. 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
public boolean checkNeighbour()
boolean
indicating if neighbour connectivity is correct (true).public void computeBox(int numULines, int numVLines, int numWLines, double uMin, double vMin, double wMin, double uMax, double vMax, double wMax)
numULines
- an int with the number of lines on the x-axisnumVLines
- an int with the number of lines on the y-axisnumWLines
- an int with the number of lines on the z-axisuMin
- a double with the start value on the x-axisvMin
- a double with the start value on the y-axiswMin
- a double with the start value on the z-axisuMax
- a double with the end value on the x-axisvMax
- a double with the end value on the y-axiswMax
- a double with the end value on the z-axisbuildCube(PdVector[],int,int,int)
public PgElementSet getSurface(PgElementSet surface)
PgElementSet
with the surface.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.
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.
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.
public boolean makeNeighbour()
public void markBoundary()
public int getEdgeVertex0(int tet, int locEdgeInd)
public int getEdgeVertex1(int tet, int locEdgeInd)
public PiVector getFace(int t, int i)
t
- Index of tetrahedron.i
- Local neighbour index of face in tetrahedron.public int addElement(PiVector el)
addElement
in interface PgGeometryIf
addElement
in class PgGeometry
el
- vector with indices of vertices in global vertex arraypublic PdVector getCenterOfTetra(int t)
"