public class PgCubeSet extends PgPointSet
PgPointSet
. Additionally,
there exist instance variables for cube normals, cube colors, cube texture
coordinates, and other cube properties. Note, that such cube properties are not stored
with each cube but each property is stored in an additional array of same length
as the array of cubes. 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 cube is the same for all cube of the cube set, each cube has eight vertices.
There exist several utility functions to allocate and modify the number of cubes, for example,
setNumCubes(int num)
allocates num
cubes. 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 cubes is changed, the class automatically adjusts the size
of those cube properties which are currently in use, i.e. whose array is not null
.
Applications may modify the entries of a cube and of cube properties by direct method calls such as
setCube(int, PiVector)
which sets the cube with index ind equal to the components of a vector v by copying.
Alternatively, if an application modifies a larger number of cubes then the application
may prefer to obtain the cube array from the cube set and directly modify the array
PiVector [] cube = cubeSet.getCubes()
;
for (int i=0; i<cubeSet.getNumCubes(); i++)
cube[i].copy(v);
The same choice is available for arrays containing cube properties.
Note, that classes like PgCubeSet, may not reference all vertices, e.g.
if the currently active cubes consists of a subset of all vertices.
Also note, that the actual size of the cube array may differ from m_numCubes
efficiency reasons. Therefore, do not use cube.length but use getNumCubes().
This class contains mainly basic methods for memory allocation and access to instance variables. Geometric methods operating on cube 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[][] |
LOCAL_EDGE_TO_VERTEX
Local indices of the two vertices of all edges of cubes.
|
static int[][] |
LOCAL_FACE_TO_VERTEX
Local indices of the four vertices of all faces of cubes.
|
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 |
---|
PgCubeSet()
Constructor of a cube grid for a solid in three-dimensional space.
|
PgCubeSet(int aVertexDim)
Constructor of a cube grid for a solid in a space of given dimension.
|
Modifier and Type | Method and Description |
---|---|
int |
addCube(PiVector cube)
Add a new cube to the end of the cube list and increment the
number of cubes.
|
int |
addElement(PiVector el)
Method does nothing and may be overridden by subclasses.
|
boolean |
applyModelingMatrix()
Multiply the modeling matrix to all vertices and vectors.
|
void |
assureBoundary(int num)
Allocate boundary polygons and register current tetra set.
|
void |
assureCubeColors()
Assures respectively allocates correct length of cube color array.
|
void |
assureCubeTextures()
Assures respectively allocates correct length of cube texture array.
|
boolean |
blend(double s,
PgGeometry ag,
double t,
PgGeometry bg)
Blend between two cube 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 |
clearTagCube(int ind,
int aTag)
Clear a single tag of a cube.
|
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 |
copy(PsObject object)
Copy instance variables by duplication, not by copying a reference.
|
void |
copyConnectivity(PgCubeSet geom)
Copy connectivity of mesh, i.e. tetrahedra and neighbour array.
|
void |
copyCubeSet(PgCubeSet geom)
Copy instance variables of this class but not of its superclass.
|
void |
flipOrientation()
Change orientation of all cubves and invert normal vectors.
|
PgCubeBndElementSet[] |
getBoundaries()
Get array of boundary polygons, some of which may be marked inactive.
|
PdVector |
getCenterOfCube(int c)
Get center of a cube.
|
PiVector |
getCube(int ind)
Get a reference to an individual cube.
|
java.awt.Color |
getCubeColor(int ind)
Get a reference to an individual cube color.
|
java.awt.Color[] |
getCubeColors()
Get cube color array for read and write access, but do not modify the size of any color vector.
|
PiVector[] |
getCubes()
Get cube array for read and write access.
|
PdVector[] |
getCubeTexture(int ind)
Get cube texture array of an individual cube.
|
PdVector[][] |
getCubeTextures()
Get cube texture array for read and write access, but do not modify the size of any texture vector.
|
PdVector[] |
getCubeVertices(int cubeInd)
Get an array with pointers to all vertices of a cube.
|
int |
getCubeWithEdge(int vertexInd1,
int vertexInd2)
Find first cube with an edge whose two vertex indices are given.
|
int |
getDimOfCubes()
Get number of vertices per cube which is constant 8.
|
double |
getEdgeLength(int cubeInd,
int locInd1,
int locInd2)
Compute length of cube edge specified by tetrahedron index and local vertex indices.
|
int |
getEdgeVertex0(int cubeIndex,
int locEdgeInd)
Get first vertex of the edge in given cube with given local edge index.
|
int |
getEdgeVertex1(int cubeIndex,
int locEdgeInd)
Get first vertex of the edge in given cube with given local edge index.
|
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 |
getGlobalCubeColor()
Get global cube color which is used if no local colors are available.
|
java.awt.Color |
getGlobalCubeTagColor()
Get global color of tagged cubes.
|
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.
|
PgJvxSrc |
getJvx()
Fills a geometry object with data from this instance, for example, to print to file.
|
int |
getMaxNumCubes()
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 |
getNumCubeIndices()
Get total number of vertex entries in all cubes.
|
int |
getNumCubes()
Get number of cubes in cube array.
|
int |
getNumEdges()
Calculate number of edges of a 3d triangulation using m_neighbour information.
|
int |
getNumFaces()
Get number of quad faces of cube set.
|
int |
getNumUnusedVertices()
Get the number of unused vertices which are not references by cubes.
// * This method is very cheap and should be
|
int |
getOppVertexInd(int cubeInd,
int locInd)
In the adjacent cube find the vertex containing the neighbourhood information for the
original cube.
|
int |
getOppVertexLocInd(int cubeInd,
int locInd)
In the adjacent cube find the vertex containing the neighbourhood information for the
original cube.
|
PgElementSet |
getSurface(PgElementSet surface)
Get the elements of the cube set.
|
PdVector[] |
getVertexTextures()
Get array of all texture coordinates both for vertex and cube based textures.
|
static PiVector |
getVertexValence(PgCubeSet geom)
Compute valence of each vertex, that is, the number of incoming edges.
|
boolean |
hasBoundary()
Check whether surface has boundary polygons, assume boundary has been calculated.
|
boolean |
hasCubeColors()
Check if cube colors have been allocated.
|
boolean |
hasCubeTextures()
Check if cube textures have been allocated.
|
boolean |
hasTagCube(int ind,
int aTag)
Check whether cube has given tag.
|
void |
init()
Initialize and reset instance variables after call to super.init().
|
boolean |
isShowingBoundaries()
Determines whether drawing of boundary curves is enabled.
|
boolean |
isShowingCubeColors()
Determines whether global cube color is used.
|
boolean |
isShowingCubeFromVertexColors()
Determines whether smooth cube coloring uses vertex colors, requires vertex colors.
|
boolean |
isShowingCubeLabels()
Determines whether showing of cube labels is enabled.
|
boolean |
isShowingCubes()
Determines whether drawing of cubes is enabled.
|
boolean |
isShowingCubeTexture()
Determines whether drawing of cube texture is enabled.
|
boolean |
isShowingEdgeColorFromCubes()
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 cube edges is enabled.
|
boolean |
isShowingSmallCubes()
Flag if shrunken cubes are shown.
|
boolean |
isShowingSmoothCubeColors()
Determines whether smooth coloring of cubes is enabled, currently requires vertex colors.
|
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 |
isShowingTaggedBoundaries()
Determines whether drawing of tagged boundary curves is enabled.
|
boolean |
isShowingTaggedCubes()
Determines whether drawing of tagged cubes is enabled.
|
boolean |
makeCubeColorsFromXYZ()
Create color from the cube position within its bounding box
which is interpreted as RGB cube.
|
boolean |
makeCubeColorsFromZ()
Create color from the vertical z-height within its bounding box
ranging from low blue to high red.
|
boolean |
makeCubeColorsFromZHue()
Create color from the vertical z-height within its bounding box
ranging through hue rainbow.
|
void |
makeCubeConn(int uDiscr,
int vDiscr,
int wDiscr)
Generates element and neighbourhood information for a cube
volume.
|
boolean |
makeCubeFromVertexColors()
Create tetra colors as average of all colors of its vertices.
|
boolean |
makeCubeFromVertexTexture()
Create cube textures from vertex textures and remove vertex textures.
|
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 |
makeVertexFromCubeColors()
Create vertex colors as average of individual color of all adjacent cubes.
|
void |
markBoundary()
Tag all boundary vertices as those.
|
boolean |
merge(PgGeometryIf aGeom)
Merge cube 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[] |
removeCube(int ind)
Remove cube with given index, and decrement index of all cubes with higher index.
|
void |
removeCubeColors()
Remove local cube colors from a geometry and use global
cube color instead.
|
int |
removeDeletedBoundaries()
Remove all boundary surfaces which are marked PsObject.IS_DELETED.
|
int[] |
removeMarkedCubes()
Remove all cubes which have been marked
PsObject.IS_DELETED . |
int[] |
removeMarkedVertices()
Remove vertices marked with tag PsObject#IS_DELETED from cubes.
|
void |
removeTexture()
Remove all texture information from volume and switch off showing of texture.
|
boolean |
removeUnusedVertices()
Remove all points not referenced by cubes.
|
boolean |
resetBoundaryNormals()
Remove boundary vertex normal.
|
void |
setBoundary(PgCubeBndElementSet[] newBnd)
Set new boundary polygons by replacing the previous array with the argument array.
|
boolean |
setCube(int elemInd,
int[] anIndArray)
Copy new vertex indices to cube at specified position in the cube list.
|
boolean |
setCube(int ind,
PiVector newCube)
Copy new vertex indices to cube at specified position in the cube list.
|
boolean |
setCubeColor(int ind,
java.awt.Color aColor)
Copy new color to cube color at specified position in the color list
|
void |
setCubeColors(java.awt.Color[] color)
Copy cube colors of list to existing array of cube colors.
|
void |
setCubes(PiVector[] cube)
Copy the first
getNumCubes() cubes of source array into
an existing cube array. |
boolean |
setCubeTexture(int ind,
PdVector[] aTexture)
Copy new texture coordinates to cube texture at specified position in the cube texture list
|
void |
setCubeTextures(PdVector[][] texCoords)
Use the given textures coordinates as cube-based texture coordinates.
|
void |
setCubeTexturesFromList(PdVector[] texCoords)
Use the given textures coordinates as cube-based texture coordinates.
|
boolean |
setCubeVertices(int elemInd,
PdVector[] vArray)
Copy new cube vertices at specified position in the vertex array of PgPointSet.
|
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 |
setGlobalCubeColor(java.awt.Color color)
Set global cube color to be used if no local colors are available.
|
void |
setGlobalCubeTagColor(java.awt.Color color)
Set global color of tagged cubes.
|
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 |
setJvx(PgJvxSrc src)
Fill this instance with data from a geometry source, for example, previously read from file.
|
void |
setMaxNumCubes(int numCubes)
Major memory allocation routine, all cube allocation should be done here.
|
boolean |
setNeighbour(int ind,
PiVector newNeigh)
Set neighbour cubes of given cube.
|
void |
setNeighbours(PiVector[] neighbour)
Copy neighbour array to existing array of neighbours.
|
void |
setNumCubes(int numCubes)
Allocate given number of cubes, and allocate normals, colors etc.
|
void |
setNumFaces(int numFaces)
Major memory allocation routine, all element allocation should be done here.
|
void |
setTagCube(int ind,
int aTag)
Set a tag of a cube.
|
void |
showBoundaries(boolean flag)
Set flag to enable drawing of boundary surfaces.
|
void |
showCubeColors(boolean flag)
Set flag of using global tetrahedron color instead of coloring each cube individually.
|
void |
showCubeFromVertexColors(boolean flag)
Set flag to enable smooth cube coloring using vertex colors at vertices, requires vertex colors.
|
void |
showCubeLabels(boolean flag)
Set flag to enable drawing of cube labels in display.
|
void |
showCubes(boolean flag)
Set flag to enable drawing of cubes.
|
void |
showCubeTexture(boolean flag)
Set flag to enable drawing of cube texture.
|
void |
showEdgeColorFromCubes(boolean flag)
Set flag if edge colors are induced from local cube 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 cube edges.
|
void |
showSmallCubes(boolean flag)
Set flag to show shrunken cubes.
|
void |
showSmoothCubeColors(boolean flag)
Set flag to enable smooth coloring of cubes, currently requires vertex colors.
|
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 |
showTaggedBoundaries(boolean flag)
Set flag to enable drawing of boundary surfaces.
|
void |
showTaggedCubes(boolean flag)
Set flag to enable drawing of tagged cubes.
|
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, computeCone, computeCylinder, computeDisk, computePlane, computeRotation, computeSnail, computeSphere, computeTorus, copySelect, getAmbientBounds, getBounds, getCenterOfBndBox, getCenterOfGravity, getDimOfColors, getDimOfTextures, getDimOfVectors, getEulerCharacteristic, getGlobalVectorColor, getGlobalVectorLength, getGlobalVectorSize, getGlobalVertexColor, getGlobalVertexNormalColor, getGlobalVertexNormalLength, getGlobalVertexNormalSize, getGlobalVertexSize, getGlobalVertexTagColor, getIndexOfVectorField, getMarkedVertices, getMarkedVertices, getMaxNumVertices, getNumVectorFields, getNumVertices, getSelectedVectorField, getShininess, getSpecularColor, getTexture, getTextureImage, getTextureImageName, getTransparency, getVectorField, getVectorField, getVertex, getVertexColor, getVertexColors, getVertexNormal, getVertexNormals, getVertexSize, getVertexSizes, getVertexTexture, getVertices, hasTagVertex, hasVertex, hasVertex, hasVertexColors, hasVertexNormals, hasVertexSizes, hasVertexTextures, intersectionWithLine, 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_cube.m_data[LOCAL_EDGE_TO_VERTEX[k][0]]
and
m_cube.m_data[LOCAL_EDGE_TO_VERTEX[k][1]]
.public static final int[][] LOCAL_FACE_TO_VERTEX
m_cube.m_data[LOCAL_FACE_TO_VERTEX[k][0]]
,
m_cube.m_data[LOCAL_FACE_TO_VERTEX[k][1]]
,
m_cube.m_data[LOCAL_FACE_TO_VERTEX[k][2]]
and
m_cube.m_data[LOCAL_FACE_TO_VERTEX[k][3]]
.public PgCubeSet()
This constructor allows to create a geometry by specifying the class name as string. By default, showing of vertices is enabled.
public PgCubeSet(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: Cube normals??? // Is this just cut-and-paste stuff, or is it really done? If src geometry has missing cube normals then method calculates tetra normals using makeCubeNormals(), 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 copyCubeSet(PgCubeSet geom)
public void copyConnectivity(PgCubeSet 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 addCube(PiVector cube)
If cube normals exist then the normal is calculated for the new cube too. Note, if vertex normals exist then the normals of the cube vertices are currently not recalculated (this behavior might change in the future).
If cube colors exist then the color of the new cube is the global cube color. // TODO: New cube's neighbourhood is not yet computed.
cube
- cube to be added to cube listpublic java.awt.Color getGlobalCubeColor()
public java.awt.Color getGlobalCubeTagColor()
public void setGlobalCubeColor(java.awt.Color color)
public void setGlobalCubeTagColor(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[] getCubes()
Do not modify the size of any cube vector.
Note, that the actual size of the array may be larger than m_numCubes for efficiency reasons. Therefore, do not use the length of array.
public java.awt.Color[] getCubeColors()
public PdVector[] getCubeTexture(int ind)
public PdVector[][] getCubeTextures()
public PdVector[] getVertexTextures()
getVertexTextures
in class PgPointSet
public PiVector[] getNeighbours()
public int getNumBoundaries()
PgTetraSet.getBoundaries()
public boolean hasBoundary()
public PgCubeBndElementSet[] getBoundaries()
public void removeBoundaries()
public int removeDeletedBoundaries()
public void setBoundary(PgCubeBndElementSet[] 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 isShowingEdgeColorFromCubes()
public void showEdgeColorFromCubes(boolean flag)
public boolean isShowingSmoothEdgeColors()
public void showSmoothEdgeColors(boolean flag)
public boolean isShowingEdgeColorFromVertices()
public void showEdgeColorFromVertices(boolean flag)
public boolean isShowingCubeLabels()
public boolean isShowingCubes()
public boolean isShowingTaggedCubes()
public boolean isShowingCubeTexture()
public boolean isShowingBoundaries()
public boolean isShowingTaggedBoundaries()
public boolean isShowingCubeColors()
public boolean isShowingSmoothLighting()
public void showSmoothLighting(boolean flag)
public boolean isShowingSmoothCubeColors()
public void showSmoothCubeColors(boolean flag)
public boolean isShowingCubeFromVertexColors()
public void showCubeFromVertexColors(boolean flag)
public void showCubeLabels(boolean flag)
public void showCubes(boolean flag)
public void showTaggedCubes(boolean flag)
public void showCubeTexture(boolean flag)
public void showVertexTexture(boolean flag)
showVertexTexture
in class PgPointSet
public void showBoundaries(boolean flag)
public void showTaggedBoundaries(boolean flag)
public void showCubeColors(boolean flag)
public int getNumFaces()
public void setNumFaces(int numFaces)
public int getMaxNumCubes()
public void setMaxNumCubes(int numCubes)
public int getNumCubes()
public int getNumCubeIndices()
public void setNumCubes(int numCubes)
Note, the neighbour array might be initialized to -1 when its size changes.
public int getDimOfCubes()
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 cube.PgPointSet.setDimOfVectors(int)
public boolean hasCubeColors()
assureCubeColors()
public boolean hasCubeTextures()
assureCubeTextures()
public void assureCubeColors()
public void assureCubeTextures()
getDimOfTextures()
.public boolean isShowingSmallCubes()
public void showSmallCubes(boolean flag)
public void paint(PvGeometryIf dc)
jv.project.PgGeometryIf
for detailed information.paint
in interface PgGeometryIf
paint
in class PgPointSet
PgGeometryIf
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(PgCubeSet 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[] removeCube(int ind)
PsObject.IS_DELETED
and invokes removeMarkedCubes()
.ind
- index of cube which is to be deletedpublic int[] removeMarkedCubes()
PsObject.IS_DELETED
.
First, the method computes where each cube is moved to, then all cube 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 cubes. 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 getCubeWithEdge(int vertexInd1, int vertexInd2)
public void clearTagCube(int ind, int aTag)
PvGeometryIf
.public boolean hasTagCube(int ind, int aTag)
PvGeometryIf
.public void setTagCube(int ind, int aTag)
PvGeometryIf
.public PdVector[] getCubeVertices(int cubeInd)
public PiVector getCube(int ind)
ind
- index of cubepublic PiVector getNeighbour(int ind)
ind
- index of tetrapublic java.awt.Color getCubeColor(int ind)
ind
- index of cubepublic boolean setCubeVertices(int elemInd, PdVector[] vArray)
elemInd
- index of tetravArray
- array with new coordinates of cube verticespublic boolean setCube(int elemInd, int[] anIndArray)
elemInd
- index of cubeanIndArray
- array with new vertex indices of cubepublic boolean setCube(int ind, PiVector newCube)
ind
- index of cubenewCube
- vector with new indices of cubepublic 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 cubenewNeigh
- vector with indices of neighbour cubespublic boolean setCubeColor(int ind, java.awt.Color aColor)
ind
- index of cubeaColor
- color to be copied to color listpublic boolean setCubeTexture(int ind, PdVector[] aTexture)
ind
- index of cubeaTexture
- array with texture coordinates to be copiedpublic void setCubes(PiVector[] cube)
getNumCubes()
cubes of source array into
an existing cube 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()
.
cube
- array of cube vectors to be copiedpublic void removeCubeColors()
Showing of cube colors must be switched off explicitly using
showCubeColors(boolean)
.
public void setCubeColors(java.awt.Color[] color)
Showing of cube colors must be switched on in order to be visible.
color
- array with new tetra colorspublic void setCubeTextures(PdVector[][] texCoords)
getDimOfTextures()
of the geometry.
Showing of textures must be switched on in order to be visible.
texCoords
- array with new cube texturessetCubeTexturesFromList(PdVector [])
public void setCubeTexturesFromList(PdVector[] texCoords)
getNumCubeIndices()
.
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
setCubeTextures(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 texturessetCubeTextures(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 cubeInd, int locInd)
cubeInd
- a cube indexlocInd
- local index such that m_neighbour[elemInd].m_data[locInd]==neighElemInd
is the adjacent cube.getOppVertexLocInd(int, int)
public int getOppVertexLocInd(int cubeInd, int locInd)
Returns -2 in case of bug in neighbourhood. Use makeNeighbour() to create a new neighbourhood.
cubeInd
- a cube indexlocInd
- local index such that m_neighbour[elemInd].m_data[locInd]==neighElemInd
is the adjacent cube.getNeighbourLocInd(int, int, int)
public double getEdgeLength(int cubeInd, int locInd1, int locInd2)
cubeInd
- index of cubelocInd1
- local index of first vertexlocInd2
- local index of second vertexpublic int getNumBoundaryFaces()
If solid is non-manifold and neighbour information is not correct then this method may determine a wrong number of boundary faces.
PgTetraSet.getNumBoundaries()
public int getNumEdges()
If neighbour information is missing, then each cube edge is counted.
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()
PgTetraSet.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 boolean makeCubeColorsFromXYZ()
public boolean makeCubeColorsFromZ()
public boolean makeCubeColorsFromZHue()
public boolean makeCubeFromVertexColors()
public boolean makeVertexFromCubeColors()
public boolean makeCubeFromVertexTexture()
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 cubes. 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 cubeIndex, int locEdgeInd)
public int getEdgeVertex1(int cubeIndex, int locEdgeInd)
public int addElement(PiVector el)
PgGeometry
addElement
in interface PgGeometryIf
addElement
in class PgGeometry
el
- vector with indices of vertices in global vertex arraypublic PdVector getCenterOfCube(int c)
"