JavaView® v2.00.008

jv.geom
Class PgElementSet

java.lang.Object
  |
  +--jv.object.PsObject
        |
        +--jv.project.PgGeometry
              |
              +--jv.geom.PgPointSet
                    |
                    +--jv.geom.PgElementSet
All Implemented Interfaces:
java.lang.Cloneable, PgGeometryIf, PsUpdateIf, java.io.Serializable
Direct Known Subclasses:
MySurface, PgCatenoid, PgDomain, PgGraph, PgSurface, PgTube, PgWeierstrass

public class PgElementSet
extends PgPointSet

Base class for most geometric surfaces with polygonal faces formed by vertices. The class contains an array with faces, i.e. elements, and each element may have different number of vertices. Each element is an instance of type PiVector containing indices of the vertices which are stored in the superclass 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.

Version:
28.11.00, 2.70 revised (kp) Two new methods setElement() implemented.
17.10.00, 2.60 revised (ep) Bugfix in method setDimOfVectors(int).
21.09.00, 2.55 revised (kp) Methods for global backface element color added.
21.07.00, 2.50 revised (kp) Global properties of normals splitted into vertex and element part.
02.04.00, 2.00 revised (kp) PdColor replaced with Color in lists.
09.02.00, 1.30 revised (kp) Outline mode added.
01.09.99, 1.11 revised (ur) setSize of elements and neighbours in copy(PgElementSet) if m_dimOfElements=-1.
08.07.99, 1.10 revised (kp) BndList array not allocated during init() to avoid loading of class.
20.02.99, 1.02 revised (kp) init() method enabled as reset method.
03.01.99, 1.01 revised (kp) set of get-methods implemented, texture.
01.09.97, 1.00 created (kp)
Author:
Konrad Polthier
See Also:
Serialized Form

Field Summary
protected  boolean m_bConforming
          Indicates whether triangulation is in edge midpoint or vertex (true) representation.
protected  PgBndPolygon[] m_bndList
          Array with boundary polygons.
protected  boolean m_bShowBackface
          Flag whether to show back facing elements whose element normal points aways from camera.
protected  boolean m_bShowBoundaries
          Flag whether boundaries are shown in display.
protected  boolean m_bShowEdgeColors
          Flag if global color of edges used in display, applied if no individual edge coloring available.
protected  boolean m_bShowEdgeLabels
          Flag whether labels of edges are shown in display.
protected  boolean m_bShowEdges
          Flag whether edges are shown in display.
protected  boolean m_bShowElementBackColor
          Flag to enable showing of separate backface color of elements.
protected  boolean m_bShowElementBackColors
          Flag if individual color of backside elements used in display.
protected  boolean m_bShowElementColors
          Flag if individual color of elements used in display.
protected  boolean m_bShowElementLabels
          Flag whether labels of elements are shown in display.
protected  boolean m_bShowElementNormalArrow
          Flag whether to show arrow of element normals or not.
protected  boolean m_bShowElementNormals
          Flag whether to show element normals or not.
protected  boolean m_bShowElements
          Flag whether elements are shown in display.
protected  boolean m_bShowElementTexture
          Show element texture.
protected  boolean m_bShowOutline
          Flag whether edges at horizon are shown thickened in display.
protected  boolean m_bShowTaggedBoundaries
          Flag whether tagged boundaries are shown in display.
protected  boolean m_bShowTaggedEdges
          Flag whether tagged edges are shown in display.
protected  boolean m_bShowTaggedElements
          Flag whether to show tagged elements or not.
protected  int m_dimOfElements
          Determines size of elements.
protected  PiVector[] m_edge
          Array with edges of element set.
protected  java.awt.Color[] m_edgeColor
          Color of each edge.
protected  PiVector[] m_element
          Array with all polygonal elements.
protected  java.awt.Color[] m_elementBackColor
          Array with a color of each backside element.
protected  java.awt.Color[] m_elementColor
          Array with a color of each element.
protected  PdVector[] m_elementNormal
          Array with a normal per element.
protected  PiVector[] m_elementSaved
          Saved original vertex indices of elements of vertex based triangulation.
protected  PdVector[][] m_elementTexture
          Texture coordinates for each element.
protected  PdColor m_globalBndColor
          Global color of boundary used in display.
protected  PuDouble m_globalBndSize
          Thickness in pixels of boundary edges used in display.
protected  PdColor m_globalBndTagColor
          Global color of tagged boundary used in display.
protected  PdColor m_globalEdgeColor
          Global color of edges used in display, applied if no individual edge coloring available.
protected  PuDouble m_globalEdgeSize
          Thickness in pixels of each edge used in display.
protected  PdColor m_globalEdgeTagColor
          Global color of tagged edges used in display.
protected  PdColor m_globalElementBackColor
          Global color of backside of elements used in display, applied if enabled.
protected  PdColor m_globalElementColor
          Global color of elements used in display, applied if no individual element coloring available.
protected  PdColor m_globalElementNormalColor
          Global color of element normals used in display.
protected  PuDouble m_globalElementNormalLength
          Scaling factor of all element normals used in display.
protected  PuDouble m_globalElementNormalSize
          Thickness in pixels of each element normal used in display.
protected  PdColor m_globalElementTagColor
          Global color of tagged elements used in display.
protected  int m_maxNumElements
          Number of allocated elements.
protected  PiVector[] m_neighbour
          Array with neighbours of all elements.
protected  int m_numEdges
          Number of used edges.
protected  int m_numElements
          Number of used elements.
protected  int m_savedNumVertices
          Saved number of vertices of vertex based triangulation.
 
Fields inherited from class jv.geom.PgPointSet
m_bDefaultLabelEnabled, m_bShowIndices, m_bShowTaggedVertices, m_bShowTransparency, m_bShowVectorArrow, m_bShowVectorColors, m_bShowVectorFields, m_bShowVertexColors, m_bShowVertexLabels, m_bShowVertexNormalArrow, m_bShowVertexNormals, m_bShowVertexTexture, m_bShowVertices, m_dimOfColors, m_dimOfTextures, m_dimOfVectors, m_globalVectorColor, m_globalVectorLength, m_globalVectorSize, m_globalVertexColor, m_globalVertexNormalColor, m_globalVertexNormalLength, m_globalVertexNormalSize, m_globalVertexSize, m_globalVertexTagColor, m_maxNumVertices, m_numVectorFields, m_numVertices, m_texture, m_transparency, m_vectorField, m_vertex, m_vertexColor, m_vertexNormal, m_vertexTexture
 
Fields inherited from class jv.project.PgGeometry
m_ambientProj, m_ambientSpace, m_authorInfo, m_bShowBndBox, m_bShowCenter, m_bShowing, m_bShowTitle, m_center, m_dim, m_dimOfSimplex, m_displayList, m_geometryInfo, m_labelAttribute, m_methodMenu, m_modelMatrix, m_title, m_version, m_versionType
 
Fields inherited from class jv.object.PsObject
HAS_CONFIG_PANEL, HAS_INFO_PANEL, HAS_MATERIAL_PANEL, INSPECTOR_INFO, INSPECTOR_INFO_EXT, IS_DELETED, IS_FIXED, IS_SELECTED, IS_USED, m_infoPanel, m_name, m_panelList, m_parent, m_tag, m_updateList, NUM_TAGS
 
Fields inherited from interface jv.project.PgGeometryIf
AMBIENT_H3_HYPERBOLIC, AMBIENT_PROJECTIONS, AMBIENT_R3_EUCLIDEAN, AMBIENT_R4_EUCLIDEAN, AMBIENT_S3_SPHERE, AMBIENT_SPACES, INSPECTOR_CONTROL, INSPECTOR_CONTROL_EXT, INSPECTOR_MATERIAL, INSPECTOR_MATERIAL_EXT, LABEL_BASE, LABEL_CENTER, LABEL_HEAD, LABEL_MIDDLE, LABEL_TAIL, LABEL_TOP, METHOD_EXT, PROJ_KLEIN_BALL, PROJ_PARALLEL, PROJ_POINCARE_BALL, PROJ_STEREOGRAPHIC, PROJ_UPPER_HALFSPACE
 
Constructor Summary
PgElementSet()
          Constructor of a polyhedral surface in three-dimensional space.
PgElementSet(int aVertexDim)
          Constructor of a polyhedral surface in a space of given dimension.
 
Method Summary
 int addEdge(PiVector anEdge)
          Add new edge to the end of the edge list.
 int addElement(PiVector anElement)
          Add new element to the end of the element list.
 boolean addElement(PiVector anElement, int anIndex)
          Add a new element at the specified position in the element list.
 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 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.
protected  void assureNeighbours()
          Assures correct length of neighbour array and, if this method needs to adjust any array of m_neighbour, then initialize the whole array with -1.
 boolean blend(double s, PgGeometry ag, double t, PgGeometry bg)
          Blend between two elementSets, used in interpolation and computing the associate surfaces this = s*a + t*b.
 void buildPolygon(PdVector[] polygon, int discr)
          Generate the vertices for a macro polygon where all edges are subdivided into 'discr' points.
 void buildPolygonFromCurve(PgPolygon[] curve)
          Generate the vertices for a macro polygon given by a set of polygons, all with same discretization.
 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. curve[0] and curve[2] respectively curve[1] and curve[3] must have 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()
          Check correct neighbour connectivity.
 void clearTagElement(int anIndex, 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 computeCylinder(int numULines, int numVLines, double radius, double length)
          Generate cylinder in z-direction 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(PgGeometry geom)
          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.
 int getDimOfElements()
          Retrieve number of vertices per element, if it is the same for all elements, otherwise return -1.
 PiVector getEdge(int anIndex)
          Get a reference to index vector of edge with given index.
 PgElementEdge 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.
 double getEdgeLength(int anElem, int locInd)
          Compute length of triangle edge specified by element index and vertex index.
 PgElementEdge[] getEdgeList()
          Generate list of edges from element information.
 PiVector[] getEdges()
          Get edge array for read and write access, but do not modify the size of any edge.
 PiVector getElement(int anIndex)
          Get a reference to an individual element.
 java.awt.Color getElementBackColor(int anIndex)
          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 anIndex)
          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.
 PdVector getElementNormal(int anIndex)
          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[][] 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.
 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.
 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 getMaxNumElements()
          Get total length of allocated element array.
 PiVector getNeighbour(int anIndex)
          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 boundary polygons, i.e. length of array m_bndList.
 int getNumBoundaryComponents()
          Compute number of boundary components of a trianglation.
 int getNumBoundaryEdges()
          Calculate number of boundary edges.
 int getNumBoundaryVertices()
          Count number of boundary vertices assuming boundary vertices have been previously marked.
 int getNumEdges()
          Calculate number of edges.
 int getNumElements()
          Get number of elements in element array.
 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.
 double getVertexAngle(int elemInd, int locInd)
          Compute length of triangle edge specified by element index and vertex index.
 double getVolume()
          Compute total volume of polyhedral surface.
 double getVolumeOfElement(int elemInd)
          Compute 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 and size corresponds to number of edges.
 boolean hasEdges()
          Check if edge array has been allocated, size is not checked.
 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 anIndex, int aTag)
          Check whether element has given tag.
 void init()
          Initialize and reset instance variables after call to super.init().
 PvPickEvent intersectionWithLine(PdVector rayBase, PdVector rayDir)
          Find intersection of element set with a given ray.
 boolean isConforming()
          Return true if elementSet is conforming, else false.
 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 isShowingEdgeColors()
          Determines whether global edge color is used.
 boolean isShowingEdgeLabels()
          Determines whether showing of edge labels is enabled.
 boolean isShowingEdges()
          Determines whether drawing of element edges 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 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 isShowingElementTextures()
          Determines whether drawing of element texture is enabled.
 boolean isShowingOutline()
          Determines whether drawing of outline element edges is enabled.
 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.
 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 red to blue.
 boolean makeElementColorsFromZHue()
          Create color from the vertical z-height within its bounding box ranging through hue rainbow.
 boolean makeElementNormals()
          Compute element normals from edge crossproducts.
 boolean makeNeighbour()
          Generate neighbourhood information for a given manifold polyhedron.
 void makePatchConn(int discr)
          Generate the connectivity for a macro polygon where all edges are subdivided into 'discr' points.
 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 makeQuadrVertexTexture(int uDiscr, int vDiscr)
          Generate default vertex 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 makeVertexNormals()
          Compute vertex normals by adding all adjacent element normals, and final normalization.
 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()
          Generate list of edges from element information.
 boolean refineGlobalIntoFour()
           
 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[] removeElement(int ind)
          Remove element with given index, and decrement index of all elements with higher index.
 int[] removeMarkedElements()
          Remove all elements which have been marked PsObject.IS_DELETED.
 int[] removeMarkedVertices()
          Remove vertices marked with tag PsObject#IS_DELETED from elements.
 boolean removeUnusedVertices()
          Remove all points not referenced by elements.
 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 setDimOfColors(int aSize)
          Let all colors have same number of components aSize<>0.
protected  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.
 boolean setEdge(int anIndex, PiVector aEdge)
          Set index vector of edge with given index.
 void setEdgeColors(java.awt.Color[] color)
          Copy edge colors of list to existing array of edge colors.
 void setEdges(PiVector[] edge)
          Copy the first m_numEdges of given array into edge array.
 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 anIndex, PiVector newElem)
          Copy new vertex indices to element at specified position in the element list.
 boolean setElementBackColor(int anIndex, 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 anIndex, 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.
 boolean setElementNormal(int anIndex, 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 anIndex, PdVector[] aTexture)
          Copy new texture coordinates to element texture at specified position in the element texture list
 void setElementTextures(PdVector[][] texCoords)
          Copy element textures of list to existing array of element textures.
 boolean setElementVertices(int elemInd, PdVector[] vArray)
          Copy new element vertices at specified position in the vertex array of PgPointSet.
 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)
          Get length factor of element normal vectors when drawn in display.
 void setGlobalElementNormalSize(double size)
          Get thickness in pixels of element normals when drawn in display.
 void setGlobalElementTagColor(java.awt.Color color)
          Set global color of tagged elements.
 void setJvx(PgJvxSrc src)
          Fill this instance with data from a geometry source, for example, previously read from file.
protected  void setMaxNumElements(int numElements)
          Major memory allocation routine, all element allocation should be done here.
 void setNeighbours(PiVector[] neighbour)
          Copy neighbour array to existing array of neighbours.
 void setNumEdges(int aNumEdges, int dimOfEdges)
          Allocate given number of edges, and allocate normals, colors etc. if they already exist.
 void setNumElements(int aNumElements)
          Allocate given number of elements, and allocate normals, colors etc. if they already exist.
 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 anIndex, 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 showEdgeColors(boolean flag)
          Set flag of using global edge color instead of coloring each edge individually.
 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 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 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 showOutline(boolean flag)
          Set flag to enable drawing of outline element edges.
 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.
 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.
 
Methods inherited from class jv.geom.PgPointSet
addVectorField, addVertex, assureVertexColors, assureVertexNormals, assureVertexTextures, clearTagVertex, getBounds, getCenterOfBndBox, getCenterOfGravity, getDimOfColors, getDimOfTextures, getDimOfVectors, getGlobalVectorColor, getGlobalVectorLength, getGlobalVectorSize, getGlobalVertexColor, getGlobalVertexNormalColor, getGlobalVertexNormalLength, getGlobalVertexNormalSize, getGlobalVertexSize, getGlobalVertexTagColor, getIndexOfVectorField, getMaxNumVertices, getNumVectorFields, getNumVertices, getTexture, getTextureImage, getTextureImageName, getVectorField, getVectorField, getVectorField, getVertex, getVertexColor, getVertexColors, getVertexNormal, getVertexNormals, getVertexTextures, getVertices, hasTagVertex, hasVertex, hasVertex, hasVertexColors, hasVertexNormals, hasVertexTextures, isDefaultLabelEnabled, isShowingIndices, isShowingTaggedVertices, isShowingVectorArrow, isShowingVectorColors, isShowingVectorField, isShowingVertexColors, isShowingVertexLabels, isShowingVertexNormalArrow, isShowingVertexNormals, isShowingVertexTexture, isShowingVertices, makeColorFromVectorLength, makeVertexColorsFromXYZ, makeVertexColorsFromZ, makeVertexColorsFromZHue, makeVertexTextureFromBndBox, projectToSphere, removeAllVectorFields, removeVectorField, removeVertex, scale, scale, setCenterOfBndBox, setDefaultLabelEnabled, setDimOfTextures, setGlobalVectorColor, setGlobalVectorLength, setGlobalVectorSize, setGlobalVertexColor, setGlobalVertexNormalColor, setGlobalVertexNormalLength, setGlobalVertexNormalSize, setGlobalVertexSize, setGlobalVertexTagColor, setMaxNumVertices, setNumVertices, setTagVertex, setTexture, setTextureImage, setTextureImageName, setTransparency, setVertex, setVertex, setVertex, setVertex, setVertexColor, setVertexColors, setVertexNormal, setVertexNormals, setVertexTextures, setVertices, showIndices, showTaggedVertices, showVectorArrow, showVectorColors, showVectorField, showVertexColors, showVertexLabels, showVertexNormalArrow, showVertexNormals, showVertexTexture, showVertices, translate
 
Methods inherited from class jv.project.PgGeometry
addDisplay, addPolygon, clearTagPolygon, fillMethodMenu, getAmbientProjection, getAmbientSpace, getAuthorInfo, getAuthors, getCenter, getCenterOfElement, getControlPanel, getDiameter, getDimOfSimplex, getDimOfVertices, getDisplays, getGeometryInfo, getLabelAttribute, getMaterialPanel, getModelMatrix, getPolygon, getTitle, getVersion, getVersionType, hasDisplay, hasModelMatrix, hasTagPolygon, isConfigurable, isShowingBndBox, isShowingCenter, isShowingTitle, isVisible, removeDisplay, removePolygon, setAmbientProjection, setAmbientSpace, setAuthorInfo, setAuthors, setCenter, setDimOfSimplex, setGeometryInfo, setLabelAttribute, setLabelAttribute, setModelMatrix, setPolygon, setTagPolygon, setTitle, setVersion, setVersionType, setVisible, showBndBox, showCenter, showTitle
 
Methods inherited from class jv.object.PsObject
addInspector, addUpdateListener, clearTag, clone, clone, copy, getFather, getInfoPanel, getInspector, getName, getNumObjects, hasInspector, hasTag, hasUpdateListener, instanceOf, instanceOf, removeInspector, removeUpdateListener, setName, setParent, setTag, updatePanels
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jv.project.PgGeometryIf
getInfoPanel, getName, setName
 
Methods inherited from interface jv.object.PsUpdateIf
getFather, setParent
 

Field Detail

m_bShowEdgeLabels

protected boolean m_bShowEdgeLabels
Flag whether labels of edges are shown in display.

m_bShowElementLabels

protected boolean m_bShowElementLabels
Flag whether labels of elements are shown in display.

m_dimOfElements

protected int m_dimOfElements
Determines size of elements. It has the following states m_dimOfElement = -1 elements have different size = 3 all elements are triangles = 4 all elements are quadrilaterals = .. all elements are polygons with same size Some methods assume all elements to be triangles. In such a case all elements are triangulated.
See Also:
setDimOfElements(int)

m_numElements

protected int m_numElements
Number of used elements. Each element may be a polygon of different size.
See Also:
setNumElements(int)

m_maxNumElements

protected int m_maxNumElements
Number of allocated elements. Do not modify this value directly but use setNumElements(int) This value is adjusted automatically whenever more memory is needed.
See Also:
setNumElements(int), setMaxNumElements(int)

m_element

protected PiVector[] m_element
Array with all polygonal elements. Each element with, say k, vertices is given by the indices of its k vertices in array '[] m_vertex' of the superclass. Elements may have different number of edges.

m_elementColor

protected java.awt.Color[] m_elementColor
Array with a color of each element. Used in display if array is not null.

m_elementBackColor

protected java.awt.Color[] m_elementBackColor
Array with a color of each backside element. Used in display if array is not null.

m_elementNormal

protected PdVector[] m_elementNormal
Array with a normal per element.

m_neighbour

protected PiVector[] m_neighbour
Array with neighbours of all elements. For each element with, say k, edges exists a corresponding neighbour array listing the indices of the neighbouring elements at these edges. See method makeNeighbour() for details on usage.

m_bndList

protected PgBndPolygon[] m_bndList
Array with boundary polygons. Each polygon may have boundary constraints.

m_bShowBoundaries

protected boolean m_bShowBoundaries
Flag whether boundaries are shown in display.

m_bShowTaggedBoundaries

protected boolean m_bShowTaggedBoundaries
Flag whether tagged boundaries are shown in display.

m_globalBndColor

protected PdColor m_globalBndColor
Global color of boundary used in display.

m_globalBndTagColor

protected PdColor m_globalBndTagColor
Global color of tagged boundary used in display.

m_globalBndSize

protected PuDouble m_globalBndSize
Thickness in pixels of boundary edges used in display.

m_bConforming

protected boolean m_bConforming
Indicates whether triangulation is in edge midpoint or vertex (true) representation.

m_elementSaved

protected PiVector[] m_elementSaved
Saved original vertex indices of elements of vertex based triangulation.

m_savedNumVertices

protected int m_savedNumVertices
Saved number of vertices of vertex based triangulation.

m_bShowElementTexture

protected boolean m_bShowElementTexture
Show element texture.

m_elementTexture

protected PdVector[][] m_elementTexture
Texture coordinates for each element.

m_bShowOutline

protected boolean m_bShowOutline
Flag whether edges at horizon are shown thickened in display.

m_numEdges

protected int m_numEdges
Number of used edges. Each edge may be a polygon of different size.

m_edge

protected PiVector[] m_edge
Array with edges of element set. Will be updated whenever connectivity changes. Use makeEdges() or makeNeighbour() to generate edge array.

m_bShowEdges

protected boolean m_bShowEdges
Flag whether edges are shown in display.

m_bShowTaggedEdges

protected boolean m_bShowTaggedEdges
Flag whether tagged edges are shown in display.

m_edgeColor

protected java.awt.Color[] m_edgeColor
Color of each edge.

m_bShowEdgeColors

protected boolean m_bShowEdgeColors
Flag if global color of edges used in display, applied if no individual edge coloring available.

m_globalEdgeColor

protected PdColor m_globalEdgeColor
Global color of edges used in display, applied if no individual edge coloring available.

m_globalEdgeTagColor

protected PdColor m_globalEdgeTagColor
Global color of tagged edges used in display.

m_globalEdgeSize

protected PuDouble m_globalEdgeSize
Thickness in pixels of each edge used in display.

m_bShowElements

protected boolean m_bShowElements
Flag whether elements are shown in display.

m_bShowTaggedElements

protected boolean m_bShowTaggedElements
Flag whether to show tagged elements or not.

m_bShowBackface

protected boolean m_bShowBackface
Flag whether to show back facing elements whose element normal points aways from camera.

m_bShowElementNormals

protected boolean m_bShowElementNormals
Flag whether to show element normals or not.

m_bShowElementNormalArrow

protected boolean m_bShowElementNormalArrow
Flag whether to show arrow of element normals or not.

m_globalElementNormalLength

protected PuDouble m_globalElementNormalLength
Scaling factor of all element normals used in display.

m_globalElementNormalSize

protected PuDouble m_globalElementNormalSize
Thickness in pixels of each element normal used in display.

m_globalElementNormalColor

protected PdColor m_globalElementNormalColor
Global color of element normals used in display.

m_bShowElementColors

protected boolean m_bShowElementColors
Flag if individual color of elements used in display.

m_globalElementColor

protected PdColor m_globalElementColor
Global color of elements used in display, applied if no individual element coloring available.

m_globalElementTagColor

protected PdColor m_globalElementTagColor
Global color of tagged elements used in display.

m_globalElementBackColor

protected PdColor m_globalElementBackColor
Global color of backside of elements used in display, applied if enabled.

m_bShowElementBackColor

protected boolean m_bShowElementBackColor
Flag to enable showing of separate backface color of elements.

m_bShowElementBackColors

protected boolean m_bShowElementBackColors
Flag if individual color of backside elements used in display.
Constructor Detail

PgElementSet

public PgElementSet()
Constructor of a polyhedral surface in three-dimensional space.

PgElementSet

public PgElementSet(int aVertexDim)
Constructor of a polyhedral surface in a space of given dimension.
Method Detail

init

public void init()
Initialize and reset instance variables after call to super.init().
Overrides:
init in class PgPointSet

getJvx

public PgJvxSrc getJvx()
Fills a geometry object with data from this instance, for example, to print to file.
Overrides:
getJvx in class PgPointSet
Returns:
src a geometry source to be filled with data from this instance.

setJvx

public void setJvx(PgJvxSrc src)
Fill this instance with data from a geometry source, for example, previously read from file.
Overrides:
setJvx in class PgPointSet
Parameters:
src - a geometry source used to fill this instance with data.

clone

public java.lang.Object clone()
Duplicate geometry by recursively cloning all instance variables except inspector panels and lists of registered listeners. The parent relationship is maintained only within this class but not to external classes. In general, all links of the clone to external objects are set to null. Tags of this object are not copied but maybe copied of subclasses.
Overrides:
clone in class PgPointSet
See Also:
#copy(PgElementSet)

copy

public void copy(PgGeometry geom)
Copy instance variables by duplication, not by copying a reference.
Overrides:
copy in class PgPointSet

copyElementSet

public void copyElementSet(PgElementSet geom)
Copy instance variables of this class but not of its superclass.

copyConnectivity

public void copyConnectivity(PgElementSet geom)
Copy connectivity of mesh, i.e. element and neighbour array.

toString

public java.lang.String toString()
Create a multi-line string representation with detailed information about all instance variables.
Overrides:
toString in class PgPointSet

update

public boolean update(java.lang.Object event)
Update the class whenever a child has changed. Method is usually invoked from the children.
Overrides:
update in class PgPointSet
Following copied from interface: jv.object.PsUpdateIf
Parameters:
event - carries a lot of information
Returns:
true if event has been handled, otherwise false
See Also:
PsObject, PsUpdateIf.getFather(), PsUpdateIf.setParent(PsUpdateIf)

addElement

public int addElement(PiVector anElement)
Add new element to the end of the element list. Method just calls addElement(PiVector, int). After adding an element or a set of elements, the neighbour relation is out of date and must be updated by calling makeNeighbour().
Overrides:
addElement in class PgGeometry
Parameters:
PiVector - element to be added to element list
Returns:
int index of new element in element list

addElement

public boolean addElement(PiVector anElement,
                          int anIndex)
Add a new element at the specified position in the element list. All elements with larger index are moved by one to the end of the list. After adding an element or a set of elements, the neighbour relation is out of date and must be updated by calling makeNeighbour().

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.

Parameters:
PiVector - element to be added to element list
int - index of element position
Returns:
boolean false, if index out of range

getGlobalElementColor

public java.awt.Color getGlobalElementColor()
Get global element color which is used if no local colors are available.

getGlobalElementBackColor

public java.awt.Color getGlobalElementBackColor()
Get global color of backface of elements.

getGlobalElementTagColor

public java.awt.Color getGlobalElementTagColor()
Get global color of tagged elements.

setGlobalElementColor

public void setGlobalElementColor(java.awt.Color color)
Set global element color to be used if no local colors are available.

setGlobalElementBackColor

public void setGlobalElementBackColor(java.awt.Color color)
Set global color of backface of elements.

setGlobalElementTagColor

public void setGlobalElementTagColor(java.awt.Color color)
Set global color of tagged elements.

getGlobalElementNormalColor

public java.awt.Color getGlobalElementNormalColor()
Get global element normal color which is used if no local colors are available.

getGlobalElementNormalLength

public double getGlobalElementNormalLength()
Get length factor of element normal vectors when drawn in display.

getGlobalElementNormalSize

public double getGlobalElementNormalSize()
Get thickness in pixels of element normals when drawn in display.

setGlobalElementNormalColor

public void setGlobalElementNormalColor(java.awt.Color color)
Set global element normal color to be used if no local colors are available.

setGlobalElementNormalLength

public void setGlobalElementNormalLength(double length)
Get length factor of element normal vectors when drawn in display.

setGlobalElementNormalSize

public void setGlobalElementNormalSize(double size)
Get thickness in pixels of element normals when drawn in display.

getGlobalEdgeColor

public java.awt.Color getGlobalEdgeColor()
Get global edge color which is used if no local colors are available.

getGlobalEdgeTagColor

public java.awt.Color getGlobalEdgeTagColor()
Get global color of tagged edges.

getGlobalEdgeSize

public double getGlobalEdgeSize()
Get thickness in pixels of edge when drawn in display.

setGlobalEdgeColor

public void setGlobalEdgeColor(java.awt.Color color)
Set global edge color to be used if no local colors are available.

setGlobalEdgeTagColor

public void setGlobalEdgeTagColor(java.awt.Color color)
Set global color of tagged edges.

setGlobalEdgeSize

public void setGlobalEdgeSize(double size)
Set thickness in pixels of edge when drawn in display.

getGlobalBndColor

public java.awt.Color getGlobalBndColor()
Get global boundary color which is used if no local colors are available.

getGlobalBndTagColor

public java.awt.Color getGlobalBndTagColor()
Get global color of tagged boundaries.

getGlobalBndSize

public double getGlobalBndSize()
Get thickness in pixels of boundary when drawn in display.

setGlobalBndColor

public void setGlobalBndColor(java.awt.Color color)
Set global boundary color to be used if no local colors are available.

setGlobalBndTagColor

public void setGlobalBndTagColor(java.awt.Color color)
Set global color of tagged boundaries.

setGlobalBndSize

public void setGlobalBndSize(double size)
Set thickness in pixels of boundary when drawn in display.

getEdges

public PiVector[] getEdges()
Get edge array for read and write access, but do not modify the size of any edge. Use makeEdges() or makeNeighbour() to generate edge array. Also note, that the actual size of the array may be larger than number of edge for efficiency reasons. Therefore, do not use length of array.

getEdgeColors

public java.awt.Color[] getEdgeColors()
Get color array for read and write access.

setNumEdges

public void setNumEdges(int aNumEdges,
                        int dimOfEdges)
Allocate given number of edges, and allocate normals, colors etc. if they already exist. The user should change the number of edges only via this method. If dimension of edges is '-1' then only the edge array is allocated and not the individual edges. Currently, length of array is equal to number of edges of element set but this may change in the future to allow caching. Method also ensures correct size of edge color array if edge color has previously been used.

assureEdgeColors

public void assureEdgeColors()
Assures respectively allocates correct length of edge color array. Length of array is equal to length of edge array.

setEdges

public void setEdges(PiVector[] edge)
Copy the first m_numEdges of given array into edge array. Must call #setNumEdges(int, int) before to allocate argument array. If argment array too small do nothing.
Parameters:
edge - array of edge vectors to be copied

setEdgeColors

public void setEdgeColors(java.awt.Color[] color)
Copy edge colors of list to existing array of edge colors. Length of argument list must be equal or larger than getNumEdges().
Parameters:
color - array with new edge colors

hasEdges

public boolean hasEdges()
Check if edge array has been allocated, size is not checked.
See Also:
#assureEdges

hasEdgeColors

public boolean hasEdgeColors()
Check if edge colors have been allocated and size corresponds to number of edges.
See Also:
assureElementColors()

addEdge

public int addEdge(PiVector anEdge)
Add new edge to the end of the edge list. Method just calls setEdge(PiVector, numEdges).
Parameters:
PiVector - edge to be added to edge list
Returns:
int index of added edge in edge list

getEdge

public PiVector getEdge(int anIndex)
Get a reference to index vector of edge with given index.

setEdge

public boolean setEdge(int anIndex,
                       PiVector aEdge)
Set index vector of edge with given index. Copy new edge to edge at specified position in the edge list. Number of edges is increased if required.
Parameters:
anIndex - index of edge
aEdge - array with indices of new edge
Returns:
boolean false, if index out of range, or argument missing

getElements

public PiVector[] getElements()
Get element array for read and write access. Do not modify the size of any element vector if getDimOfElements()!=-1. Also note, that the actual size of the array may be larger than m_numElements for efficiency reasons. Therefore, do not use length of array.

getElementColors

public java.awt.Color[] getElementColors()
Get element color array for read and write access, but do not modify the size of any color vector. Note, that subclasses may not reference all element colors. Also note, that the actual size of the color array may be larger than m_numElements for efficiency reasons. Therefore, do not use length of array.

getElementBackColors

public java.awt.Color[] getElementBackColors()
Get backside element color array for read and write access, but do not modify the size of any color vector. Note, that subclasses may not reference all element colors. Also note, that the actual size of the color array may be larger than m_numElements for efficiency reasons. Therefore, do not use length of array.

getElementNormals

public PdVector[] getElementNormals()
Get element normal array for read and write access, but do not modify the size of any normal vector. Note, that subclasses may not reference all element normals. Also note, that the actual size of the color may be larger than m_numElements for efficiency reasons. Therefore, do not use length of array.

getElementTextures

public PdVector[][] getElementTextures()
Get element texture array for read and write access, but do not modify the size of any texture vector. Note, that subclasses may not reference all element textures. Also note, that the actual size of the texture array may be larger than m_numElements for efficiency reasons. Therefore, do not use length of array. Each element has associated an array of 2-dimensional vectors with normalized texture coordinates.

getNeighbours

public PiVector[] getNeighbours()
Get neighbour array for read and write access, but do not modify the size of any neighbour vector. Also note, that the actual size of the array may be larger than m_numElements for efficiency reasons. Therefore, do not use length of array.

hasBoundary

public boolean hasBoundary()
Check whether surface has boundary polygons, assume boundary has been calculated. TODO: Check for boundary even if boundary polygons have not been calculated yet.

getBoundaries

public PgBndPolygon[] getBoundaries()
Get array of boundary polygons, some of which may be marked inactive. If there does not exist a boundary then method returns array of zero length.
Returns:
a possibly empty array of boundary polygons. Array is never null.

removeBoundaries

public void removeBoundaries()
Remove all boundary curves.

setBoundary

public void setBoundary(PgBndPolygon[] newBnd)
Set new boundary polygons by replacing the previous array with the argument array.
Parameters:
newBnd - array with new boundary polygons of element set.

assureBoundary

public void assureBoundary(int num)
Allocate boundary polygons and register current element set. If new number of polygons is smaller than old number then try to reuse old polygons.

isShowingEdgeLabels

public boolean isShowingEdgeLabels()
Determines whether showing of edge labels is enabled.

isShowingElementLabels

public boolean isShowingElementLabels()
Determines whether showing of element labels is enabled.

isShowingElements

public boolean isShowingElements()
Determines whether drawing of elements is enabled.

isShowingTaggedElements

public boolean isShowingTaggedElements()
Determines whether drawing of tagged elements is enabled.

isShowingBackface

public boolean isShowingBackface()
Determines whether drawing of backfacing elements whose normal points away from camera is enabled.

isShowingElementNormals

public boolean isShowingElementNormals()
Determines whether drawing of element normals is enabled.

isShowingElementNormalArrow

public boolean isShowingElementNormalArrow()
Determines whether drawing of arrow of element normals is enabled.

isShowingElementTextures

public boolean isShowingElementTextures()
Determines whether drawing of element texture is enabled.

isShowingOutline

public boolean isShowingOutline()
Determines whether drawing of outline element edges is enabled.

isShowingEdges

public boolean isShowingEdges()
Determines whether drawing of element edges is enabled.

isShowingTaggedEdges

public boolean isShowingTaggedEdges()
Determines whether drawing of tagged element edges is enabled.

isShowingBoundaries

public boolean isShowingBoundaries()
Determines whether drawing of boundary curves is enabled.

isShowingTaggedBoundaries

public boolean isShowingTaggedBoundaries()
Determines whether drawing of tagged boundary curves is enabled.

isShowingElementColors

public boolean isShowingElementColors()
Determines whether global element color is used.

isShowingElementBackColors

public boolean isShowingElementBackColors()
Determines whether drawing of individual backface element colors is enabled.

isShowingEdgeColors

public boolean isShowingEdgeColors()
Determines whether global edge color is used.

isShowingElementBackColor

public boolean isShowingElementBackColor()
Determines whether global element backface color is used.

showEdgeLabels

public void showEdgeLabels(boolean flag)
Set flag to enable drawing of edge labels in display.

showElementLabels

public void showElementLabels(boolean flag)
Set flag to enable drawing of element labels in display.

showElements

public void showElements(boolean flag)
Set flag to enable drawing of elements.

showTaggedElements

public void showTaggedElements(boolean flag)
Set flag to enable drawing of tagged elements.

showElementBackColor

public void showElementBackColor(boolean flag)
Set flag to enable drawing of backface color of elements.

showElementBackColors

public void showElementBackColors(boolean flag)
Set flag to enable drawing of individual backface element colors.

showBackface

public void showBackface(boolean flag)
Set flag to enable drawing of backfacing elements whose normal points away from camera. If element set has no element normals then method creates element normals.

showElementNormals

public void showElementNormals(boolean flag)
Set flag to enable drawing of element normals.

showElementNormalArrow

public void showElementNormalArrow(boolean flag)
Set flag to enable drawing of arrow of element normal.

showElementTexture

public void showElementTexture(boolean flag)
Set flag to enable drawing of element texture.

showOutline

public void showOutline(boolean flag)
Set flag to enable drawing of outline element edges.

showEdges

public void showEdges(boolean flag)
Set flag to enable drawing of element edges.

showTaggedEdges

public void showTaggedEdges(boolean flag)
Set flag to enable drawing of element edges.

showBoundaries

public void showBoundaries(boolean flag)
Set flag to enable drawing of boundary curves.

showTaggedBoundaries

public void showTaggedBoundaries(boolean flag)
Set flag to enable drawing of boundary curves.

showElementColors

public void showElementColors(boolean flag)
Set flag of using global element color instead of coloring each element individually.

showEdgeColors

public void showEdgeColors(boolean flag)
Set flag of using global edge color instead of coloring each edge individually.

getMaxNumElements

public int getMaxNumElements()
Get total length of allocated element array. Usually, only a subset is filled with data. Method is for internal use, see getNumElements() for daily work.

setMaxNumElements

protected void setMaxNumElements(int numElements)
Major memory allocation routine, all element allocation should be done here. Element and neighbour array are adjusted to new size. All element property arrays, such as element normals, are adjusted if they where allocated before. Method should not be called directly, only subclass.setMaxNumElements() may call it. The user should change the number of elements via setNumElements().

getNumElements

public int getNumElements()
Get number of elements in element array. Note, that the actual size of the element array may be larger for efficiency reasons. Therefore, do not use m_element.length.

setNumElements

public void setNumElements(int aNumElements)
Allocate given number of elements, and allocate normals, colors etc. if they already exist. Internally, there may exist more elements than requested serving as buffer and to reduce allocation times.

Note, the neighbour array might be initialized to -1 when its size changes.


getDimOfElements

public int getDimOfElements()
Retrieve number of vertices per element, if it is the same for all elements, otherwise return -1.
See Also:
setDimOfElements(int)

setDimOfElements

public void setDimOfElements(int aSize)
Let all elements have same number of vertices 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.

Parameters:
aSize - Number of vertices for all elements.
See Also:
setNumElements(int)

setDimOfElement

protected void setDimOfElement(int ind,
                               int aSize)
Set size of a single element and associated data like neighbour list. Element must exist already, and index of element must be in range [0,m_numElements-1]. Method may modify instance variable m_dimOfElements. It is more efficient to call method before 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.

Parameters:
ind - Index of element to change size.
aSize - New number of vertices of element, must be larger than 3.
See Also:
setDimOfElements(int), setElement(int, PiVector)

setDimOfColors

public void setDimOfColors(int aSize)
Let all colors have same number of components aSize<>0.
Overrides:
setDimOfColors in class PgPointSet
Parameters:
aSize - Number of components of each color vector.

setDimOfVectors

public void setDimOfVectors(int aSize)
Let all vectors have same number of vectors aSize<>0. It is more efficient to call method before setNumVertices().
Overrides:
setDimOfVectors in class PgPointSet
Parameters:
aSize - Number of coordinates of each element.
See Also:
PgPointSet.setDimOfVectors(int)

assureDimOfElements

public boolean assureDimOfElements()
Assure correctness of value m_dimOfElements specifying the number of vertices per Element. If value is incorrect then 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}.
Returns:
true if m_dimOfElements had the correct value.
See Also:
setDimOfElements(int)

assureNeighbours

protected void assureNeighbours()
Assures correct length of neighbour array and, if this method needs to adjust any array of m_neighbour, then initialize the whole array with -1. Length of array is equal to all lengths of element array. Variable m_dimOfElements is used to determine length of neighbour array for each element if m_dimOfElement!=-1. Initialization of neighbour array with -1 marks each edge as boundary edge.

If neighbour array or any individual vector changes length, then neighbour is set to -1.


hasElementColors

public boolean hasElementColors()
Check if element colors have been allocated.
See Also:
assureElementColors()

hasElementNormals

public boolean hasElementNormals()
Check if element normals have been allocated.
See Also:
assureElementNormals()

hasElementTextures

public boolean hasElementTextures()
Check if element textures have been allocated.
See Also:
assureElementTextures()

assureElementColors

public void assureElementColors()
Assures respectively allocates correct length of element color array. Length of array is equal to length of element array.

assureElementBackColors

public void assureElementBackColors()
Assures respectively allocates correct length of element color array. Length of array is equal to length of element array.

assureElementNormals

public void assureElementNormals()
Assures respectively allocates correct length of element normal array. Length of array is equal to length of element array. Dimension of normal vectors is equal to dimension of vertices.

assureElementTextures

public void assureElementTextures()
Assures respectively allocates correct length of element texture array. Length of array is equal to length of element array. Dimension of normal vectors is equal to getDimOfTextures(). Texture values are lost if maximal number of elements changes.

paint

public void paint(PvGeometryIf dc)
Major rendering method fills an internal container class supplied by the display. See jv.project.PgGeometryIf for detailed information.
Overrides:
paint in class PgPointSet
See Also:
PgGeometryIf

makeQuadrVertexTexture

public void makeQuadrVertexTexture(int uDiscr,
                                   int vDiscr)
Generate default vertex texture in [0,1]*[0,1] for a quadrilateral surface.
Parameters:
uDiscr, - vDiscr Number of lines in u and v direction.

makeQuadrElementTexture

public void makeQuadrElementTexture(int uDiscr,
                                    int vDiscr)
Generate default element texture in [0,1]*[0,1] for a quadrilateral surface.
Parameters:
uDiscr, - vDiscr Number of lines in u and v direction.

makeQuadrConn

public void makeQuadrConn(int uDiscr,
                          int vDiscr)
Generate element and neighbourhood information for a quadrilateral surface. Method generates only topological information, no coordinates are required.
Parameters:
uDiscr, - vDiscr Number of lines in u and v direction.
See Also:
makeCylinderConn(int, int)

makeAlternatingQuadrConn

public void makeAlternatingQuadrConn(int uDiscr,
                                     int vDiscr,
                                     boolean alternateUDir)
Make quadrilateral connectivity with quadrilaterals being alternately triangulated.
Parameters:
uDiscr, - vDiscr Number of lines in u and v direction.
See Also:
makeCylinderConn(int, int)

makeCylinderConn

public void makeCylinderConn(int uDiscr,
                             int vDiscr)
Generate element and neighbourhood information for a cylindrical surface. Method generates only topological information, no coordinates are required. Remark: In contrast to makeQuadrConn this method produces a cylinder with exactly vDiscr vertices and vDiscr elements around the tube. Therefore, the number of elements differ between makeQuadrConn and makeCylinderConn.
Parameters:
uDiscr, - vDiscr Number of lines in u and v direction.
See Also:
makeQuadrConn(int, int)

makeQuadrBnd

public void makeQuadrBnd(int uDiscr,
                         int vDiscr)
Generate boundary information for a quadrilateral surface. Method generates only topological information, no coordinates are required. Boundary runs counter-clockwise around (i,j) domain, where i increments by vDiscr along x-axis and j increments by 1 along y-axis.
Parameters:
uDiscr, - vDiscr Number of lines in u and v direction.
See Also:
makeQuadrConn(int, int), getBoundaries()

makeTriangleConn

public void makeTriangleConn(int discr)
Generate the connectivity for a macro triangle where all edges are subdivided into 'discr' points. Method generates only topological information, no coordinates are required.
Parameters:
discr - number of points on each edge
See Also:
makeTriangleBnd(int)

makeTriangleBnd

public void makeTriangleBnd(int discr)
Generate the boundary of a macro triangle where all edges are subdivided into 'discr' points. Method generates only topological information, no coordinates are required.
Parameters:
discr - number of points on each edge
See Also:
makeTriangleConn(int)

makePatchConn

public void makePatchConn(int discr)
Generate the connectivity for a macro polygon where all edges are subdivided into 'discr' points. Method generates only topological information, no coordinates are required. TODO: Method has not been written yet.
Parameters:
discr - number of points on each edge
See Also:
makeQuadrConn(int, int)

flipOrientation

public void flipOrientation()
Change orientation of all elements and invert normal vectors.
Overrides:
flipOrientation in class PgPointSet
See Also:
PgPointSet.flipOrientation()

flipEdges

public void flipEdges()
Flip edge of pairs of adjacent triangles if sum of opposite angles is larger than sum of spatial angles at common edge. Valid for triangulations only.

getEdgeList

public PgElementEdge[] getEdgeList()
Generate list of edges from element information. 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 polyhedrons. Method consists of code from previous version of makeNeighbour(), which now calls getEdgeList(). 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 a java.util.Vector which contains all edges emanting from vertex with index i to vertices with higher index.

This algorithm requires the array edgesAtVertex to have size equal to m_numVertices but allows linear runtime when finding entries with identical edges. When collection is finsihed, usually some array entries will null. The return parameter is an array of edges constructed from edgesAtVertex.

Note, think about using getEdge to obtain just a few edges.

Returns:
array with all edge, size equals number of edges.
See Also:
getNumEdges(), #getEdge()

printEdgeList

public java.lang.String printEdgeList()
Generate list of edges from element information. The routine computes an array of edges temporarily in a single pass through all elements. Additionally, it stores the elements sharing an edge.
Print list of edges to console.

makeNeighbour

public boolean makeNeighbour()
Generate neighbourhood information for a given manifold polyhedron. The routine computes an array of edges temporarily in a single pass through all elements, and uses this information to fill out the neighbour instance variable. The diagram details this.

Since version 2.60 the construction of the edge list is outsourced in getEdgeList().

Edges belonging to more than two elements become a boundary edge in each element.

Returns:
boolean false, if polyhedron is not a manifold, i.e. an edge is shared by more than two elements.

makeElementNormals

public boolean makeElementNormals()
Compute element normals from edge crossproducts. For each element, a normal is computed at each of its vertices as the crossproduct of the adjacent edges. These vertex normals are then added, and the normalized sum used as element normal. This strategy reduces the effect of non-planar elements.

Method works for convex elements only.

See Also:
makeVertexNormals()

makeVertexNormals

public boolean makeVertexNormals()
Compute vertex normals by adding all adjacent element normals, and final normalization. TODO: This method computes first all element normals and stores them, which is not nice.
Overrides:
makeVertexNormals in class PgPointSet
See Also:
makeElementNormals()

buildQuadr

public void buildQuadr(PdVector[] quadr,
                       int uDiscr,
                       int vDiscr)
Create a rectangular elements by bilinear interpolation of four given vertices and discretization. This method creates the vertices, the connectivity is generated in makeQuadrConn. TODO: The diagram shows how the macro vertices of the rectangle must be ordered, and shows the micro boxes.
Parameters:
quadr - array with four vertices of macro patch
uDiscr - number of vertices along u-direction
vDiscr - number of vertices along v-direction
See Also:
makeQuadrConn(int, int)

buildTriangle

public void buildTriangle(PdVector[] triangle,
                          int discr)
Generate the vertices for a macro triangle where all edges are subdivided into 'discr' points. This method creates the vertices, the connectivity is generated in makeTriangleConn. TODO: Method should be split, and coordinate stuff move to PgPointSet.
Parameters:
triangle - array with three vertices of macro patch
discr - number of points on each edge
See Also:
makeTriangleBnd(int)

buildPolygon

public void buildPolygon(PdVector[] polygon,
                         int discr)
Generate the vertices for a macro polygon where all edges are subdivided into 'discr' points. This method creates the vertices, the connectivity is generated in makePolygonConn. TODO: Method should be split, and coordinate stuff move to PgPointSet.
Parameters:
triangle - array with three vertices of macro patch
discr - number of points on each edge
See Also:
makeTriangleBnd(int)

buildTriangleFromCurve

public void buildTriangleFromCurve(PgPolygon[] curve,
                                   PgBndConstraint[] bndConstr)
Generate the vertices for a macro triangle given by three polygons with same discretization. This method creates the vertices, the connectivity is generated in makeTriangleConn. Boundary constraints are assigned to boundary curves of resulting element set. TODO: Method should be split, and coordinate stuff move to PgPointSet.
Parameters:
curve - array with three polygons with same number of vertices
bndConstr - boundary constraints assigned to boundary polygons
See Also:
makeTriangleConn(int)

buildQuadrFromCurve

public void buildQuadrFromCurve(PgPolygon[] curve,
                                PgBndConstraint[] bndConstr)
Generate the vertices for a macro quadrilateral given by four polygons with pairwise same discretization. curve[0] and curve[2] respectively curve[1] and curve[3] must have same discretization. This method creates the vertices, the connectivity is generated in makeTriangleConn. Boundary constraints are assigned to boundary curves of resulting element set. TODO: Method should be split, and coordinate stuff move to PgPointSet.
Parameters:
curve - array with four polygons with pairwise same number of vertices
bndConstr - boundary constraints assigned to boundary polygons
See Also:
makeTriangleConn(int)

buildPolygonFromCurve

public void buildPolygonFromCurve(PgPolygon[] curve)
Generate the vertices for a macro polygon given by a set of polygons, all with same discretization. This method creates the vertices, the connectivity is generated in makeTriangleConn. Boundary constraints are assigned to boundary curves of resulting element set. TODO: Method has not been written yet.
Parameters:
curve - array with polygons with same number of vertices
See Also:
makeTriangleConn(int)

close

public boolean close()
Identify and remove all interior boundaries of a geometry, and compress vertex array. Currently, the method requires a list of precomputed boundary curves. The method should be extend to use edge and neighbour information to determine boundaries.
Returns:
true if successful
See Also:
removeUnusedVertices()

removeUnusedVertices

public boolean removeUnusedVertices()
Remove all points not referenced by elements. E.g. after application of method 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). The implementation is based on GRAPE method "sort-points-send" of Bernd Oberknapp.
Returns:
true if method was successfull

removeMarkedVertices

public int[] removeMarkedVertices()
Remove vertices marked with tag PsObject#IS_DELETED from elements. Remove all elements containing a marked vertex, and remove all marked vertices. It is neccessary to keep a valid element set after removal of vertices in the superclass.
Overrides:
removeMarkedVertices in class PgPointSet
Returns:
array with indices of new positions of vertices

removeElement

public int[] removeElement(int ind)
Remove element with given index, and decrement index of all elements with higher index. Method just marks element with tag PsObject.IS_DELETED and invokes #removeMarkedElements().
Overrides:
removeElement in class PgGeometry
Returns:
Array with indices of new positions of elements

removeMarkedElements

public int[] removeMarkedElements()
Remove all elements which have been marked 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 upredictable results.

Returns:
Array with indices of new positions of elements

merge

public boolean merge(PgGeometryIf aGeom)
Merge element set with current object and store union of both objects in 'this'. Number of points and elements is the sum of both objects. List of boundary curves is the union of both objects, i.e. both objects are not identified along common boundary curves. This identification can be made by a later call to close().
Overrides:
merge in class PgPointSet
Parameters:
aGeom - elementSet to be merged into 'this'
Returns:
true if method was successfull
See Also:
close()

refineGlobalIntoFour

public boolean refineGlobalIntoFour()

getElementWithVertex

public int getElementWithVertex(int vertexInd)
Find first element referencing a given vertex.

getEdge

public PgElementEdge getEdge(int vInd1,
                             int vInd2)
Create an edge structure with information about edge and adjacent elements. Two vertex indices of an edge are given as parameters. Method does not use neighbour information of element set.

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 getEdgeList().

Parameters:
vInd1, - vInd2 Indices of edge vertices in global vertex array of elementSet.
Returns:
Edge structure with information about adjacent elements
See Also:
getEdgeList()

clearTagElement

public void clearTagElement(int anIndex,
                            int aTag)
Clear a single tag of a element. For possible tags see PvGeometryIf.
Overrides:
clearTagElement in class PgGeometry

hasTagElement

public boolean hasTagElement(int anIndex,
                             int aTag)
Check whether element has given tag. For possible tags see PvGeometryIf.
Overrides:
hasTagElement in class PgGeometry

setTagElement

public void setTagElement(int anIndex,
                          int aTag)
Set a tag of a element. For possible tags see PvGeometryIf.
Overrides:
setTagElement in class PgGeometry

getElementVertices

public PdVector[] getElementVertices(int elemInd)
Get an array with pointers to all vertices of an element. Vertices appear in the array in the same order as in the element.

getElement

public PiVector getElement(int anIndex)
Get a reference to an individual element.
Overrides:
getElement in class PgGeometry
Parameters:
anIndex - index of element

getNeighbour

public PiVector getNeighbour(int anIndex)
Get a reference to an individual neighbour vector.
Parameters:
anIndex - index of element

getElementColor

public java.awt.Color getElementColor(int anIndex)
Get a reference to an individual element color.
Parameters:
anIndex - index of element

getElementBackColor

public java.awt.Color getElementBackColor(int anIndex)
Get a reference to an individual backside element color.
Parameters:
anIndex - index of element

getElementNormal

public PdVector getElementNormal(int anIndex)
Get a reference to an individual element normal.
Parameters:
anIndex - index of element

setElementVertices

public boolean setElementVertices(int elemInd,
                                  PdVector[] vArray)
Copy new element vertices at specified position in the vertex array of PgPointSet. Destination element including data array must already exists.
Parameters:
elemInd - index of element
vArray - array with new coordinates of element vertices
Returns:
boolean false, if index out of range, or argument missing

setElement

public void setElement(int elemInd,
                       int a,
                       int b,
                       int c)
Copy new vertex indices to element at specified position in the element list. Number of elements is increased if required. Dimension of elements is adjusted if necessary.
Parameters:
elemInd - index of vertex
a,b,c - new vertex indices of element

setElement

public 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. Number of elements is increased if required. Dimension of elements is adjusted if necessary.
Parameters:
elemInd - index of vertex
a,b,c,d - new vertex indices of element

setElement

public boolean setElement(int elemInd,
                          int[] anIndArray)
Copy new vertex indices to element at specified position in the element list. Number of elements is increased if required. Dimension of elements is adjusted if necessary.
Parameters:
anIndex - index of element
anIndArray - array with new vertex indices of element
Returns:
boolean false, if element and array have different

setElement

public boolean setElement(int anIndex,
                          PiVector newElem)
Copy new vertex indices to element at specified position in the element list. Number of elements is increased if required.
Overrides:
setElement in class PgGeometry
Parameters:
anIndex - index of element
newElem - vector with new indices of element
Returns:
boolean false, if element and array have different

setElementColor

public boolean setElementColor(int anIndex,
                               java.awt.Color aColor)
Copy new color to element color at specified position in the color list
Parameters:
anIndex - index of element
aColor - color to be copied to color list
Returns:
boolean false, if index out of range, or argument missing

setElementBackColor

public boolean setElementBackColor(int anIndex,
                                   java.awt.Color aColor)
Copy new color to element color at specified position in the color list
Parameters:
anIndex - index of element
aColor - color to be copied to color list
Returns:
boolean false, if index out of range, or argument missing

setElementNormal

public boolean setElementNormal(int anIndex,
                                PdVector aNormal)
Copy new normal to element normal at specified position in the normal list
Parameters:
anIndex - index of element
aNormal - normal to be copied to normal list
Returns:
boolean false, if index out of range, or argument missing

setElementTexture

public boolean setElementTexture(int anIndex,
                                 PdVector[] aTexture)
Copy new texture coordinates to element texture at specified position in the element texture list
Parameters:
anIndex - index of element
aTexture - array with texture coordinates to be copied
Returns:
boolean false, if index out of range, or argument missing

setElements

public void setElements(PiVector[] element)
Copy the first 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().
Parameters:
element - array of element vectors to be copied

setElementColors

public void setElementColors(java.awt.Color[] color)
Copy element colors of list to existing array of element colors. Length of argument list must be equal or larger than getNumElements().
Parameters:
color - array with new element colors

setElementBackColors

public void setElementBackColors(java.awt.Color[] color)
Copy backface element colors of list to existing array of element colors. Length of argument list must be equal or larger than getNumElements().
Parameters:
color - array with new element colors

setElementNormals

public void setElementNormals(PdVector[] normal)
Copy element normals of list to existing array of element normals. Length of argument list must be equal or larger than getNumElements(). All element normals are copied. The dimension of all argument normals must be equal same as dimension of vectors.
Parameters:
normal - array with new element normals

setElementTextures

public void setElementTextures(PdVector[][] texCoords)
Copy element textures of list to existing array of element textures. Length of argument list must be equal or larger than getNumElements(). All element textures are copied. The dimension of all argument textures must be equal to getDimOfTextures() of the geometry.
Parameters:
texCoords - array with new element textures

setNeighbours

public void setNeighbours(PiVector[] neighbour)
Copy neighbour array to existing array of neighbours. Length of argument list must be equal or larger than getNumElements(). All neighbour information is copied.
Parameters:
neighbour - array with neighbour information
See Also:
makeNeighbour()

getNeighbourLocInd

public int getNeighbourLocInd(int elemInd,
                              int vInd,
                              int wInd)
For a given edge return the local index of the vertex containing the neighbourhood information. For triangles, return the local index of the third vertex in the element[anElem], i.e. the vertex not on the edge (vInd, 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.
Parameters:
vInd, - wInd vertex indices specifying an element edge, not local indices
elemInd - an element index
Returns:
local index of the vertex containing the neighbourhood information for given edge
See Also:
getOppVertexLocInd(int, int)

getOppVertexInd

public int getOppVertexInd(int elemInd,
                           int locInd)
In the adjacent element find the vertex containing the neighbourhood information for the original element. Return the index of the vertex in the adjacent element whose neighbour entry references to the original element.
Parameters:
elemInd - an element index
locInd - local index such that m_neighbour[elemInd].m_data[locInd]==neighElemInd is the adjacent element.
Returns:
index of the vertex in adjacent triangle containing the neighbourhood information for common edge, or -1.
See Also:
getOppVertexLocInd(int, int)

getOppVertexLocInd

public int getOppVertexLocInd(int elemInd,
                              int locInd)
In the adjacent element find the vertex containing the neighbourhood information for the original element. Return the local index of the vertex in the adjacent element whose neighbour entry references to the original element. Modified to handle elements with more than three edges too. The 'otherVertex' 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-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.
Parameters:
elemInd - an element index
locInd - local index such that m_neighbour[elemInd].m_data[locInd]==neighElemInd is the adjacent element.
Returns:
local index of the vertex in adjacent triangle containing the neighbourhood information for common edge.
See Also:
getNeighbourLocInd(int, int, int)

getAreaOfElement

public double getAreaOfElement(int elemInd)
Compute area of polyhedral element with given index.

getArea

public double getArea()
Compute total area of polyhedral surface.

getVolumeOfElement

public double getVolumeOfElement(int elemInd)
Compute volume of the cone of a polyhedral element with the origin.

getVolume

public double getVolume()
Compute total volume of polyhedral surface. If surface is not closed, then the volume of the cone of the surface with the origin is computed.

getL2Norm

public double getL2Norm()
Compute L2 norm of identity map of element set. Elements are temporarily triangulated if they have more than three vertices.

getL2Matrix

public PdMatrix getL2Matrix(PdMatrix mat)
Compute L2 matrix S such that L2-norm(u)^2 = u*S*u. Elements must be triangulated.

getEdgeLength

public double getEdgeLength(int anElem,
                            int locInd)
Compute length of triangle edge specified by element index and vertex index.
Parameters:
elemInd - index of element
locInd - local index of vertex whose neighbour refers to this edge
Returns:
length of edge

getVertexAngle

public double getVertexAngle(int elemInd,
                             int locInd)
Compute length of triangle edge specified by element index and vertex index.
Parameters:
elemInd - index of element
locInd - local index of vertex
Returns:
angle between edges at vertex

computeRotation

public void computeRotation(PgPolygon meridian,
                            int numULines)
Generate rotational symmetric surface from given meridian around x-axis. Surface has connectivity of a rectangle. Use close() to remove interior boundaries. Compute vertex normals.
Overrides:
computeRotation in class PgPointSet
Parameters:
numULines - discretization in angular direction

computeCylinder

public void computeCylinder(int numULines,
                            int numVLines,
                            double radius,
                            double length)
Generate cylinder in z-direction with given radius and length. Surface has connectivity of a rectangle. Use close() to remove interior boundaries. Compute vertex normals. Sample method to have simple geometry available for test purposes.
Overrides:
computeCylinder in class PgPointSet
Parameters:
numULines - discretization in angular direction
numVLines - discretization in z-axis direction
radius - radius of cylinder
length - height of cylinder

computeDisk

public void computeDisk(int numULines,
                        int numVLines,
                        double radius)
Generate disk in xy-plane with given radius. Surface has connectivity of a rectangle. Use close() to remove interior boundaries. Compute vertex normals. Sample method to have simple geometry available for test purposes.
Overrides:
computeDisk in class PgPointSet
Parameters:
numULines - discretization in radial direction
numVLines - discretization in angular direction
radius - radius of disk

computePlane

public 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. Surface has connectivity of a rectangle. Use close() to remove interior boundaries. Compute vertex normals. Sample method to have simple geometry available for test purposes.
Overrides:
computePlane in class PgPointSet
Parameters:
numULines - discretization in x direction
numVLines - discretization in y direction
uMin, - vMin, uMax, vMax size of rectangle

computeSphere

public void computeSphere(int numULines,
                          int numVLines,
                          double radius)
Generate sphere with given radius. Surface has connectivity of a rectangle. Use close() to remove interior boundaries. Compute vertex normals. Sample method to have simple geometry available for test purposes.
Overrides:
computeSphere in class PgPointSet
Parameters:
numULines - discretization in angular direction
numVLines - discretization in meridian direction
radius - radius of sphere

computeTorus

public 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. Surface has connectivity of a rectangle. Use close() to remove interior boundaries. Compute vertex normals. Sample method to have simple geometry available for test purposes.
Overrides:
computeTorus in class PgPointSet
Parameters:
numULines - discretization in angular direction
numVLines - discretization in meridian direction
radius - radius of soal
thick - radius of torus tube

computeSnail

public void computeSnail(int numULines,
                         int numVLines,
                         double numWindings)
Generate a winding snail. Sample method to have simple geometry available for test purposes.
Overrides:
computeSnail in class PgPointSet
Parameters:
numULines - discretization in angular direction
numVLines - discretization in meridian direction
numWindings - number of half-turns of snail house

getNumBoundaries

public int getNumBoundaries()
Return number of boundary polygons, i.e. length of array m_bndList. This number may be different from number of boundary components and number of boundary edges.
Returns:
length of boundary array, number of boundary segments used
See Also:
getNumBoundaryComponents(), getNumBoundaryEdges()

getNumBoundaryComponents

public int getNumBoundaryComponents()
Compute number of boundary components of a trianglation. Triangulation must be oriented and boundary components must be disjoint This number may be different from number of boundary segments and number of boundary edges. For triangulation use formula: F = 2V_i + V_b - 2 + 2(B-1) for arbitrary pl-surface use: V-E+F = 2-B
Returns:
number of boundary components of triangulation
See Also:
getNumBoundaries(), getNumBoundaryEdges()

getNumBoundaryEdges

public int getNumBoundaryEdges()
Calculate number of boundary edges. This number may be different from number of boundary components and number of boundary segments.
Returns:
number of boundary edges
See Also:
getNumBoundaryComponents(), getNumBoundaries()

getNumEdges

public int getNumEdges()
Calculate number of edges. If neighbour information is missing, then each element edge is counted. Algorithm runs once over all elements.
Returns:
number of edges
See Also:
getEdgeList()

fixBoundaries

public void fixBoundaries()
Constrain all boundary vertices not to move during variations. This is method imposes the simplest kind of constraints to boundary polygons used in variational problems.

markBoundary

public void markBoundary()
Tag all boundary vertices as those. Assume a correct neighbour connectivity. Method is used in conjunction with getNumBoundaryVertices(). Method handles non-conforming element sets too.

getNumBoundaryVertices

public int getNumBoundaryVertices()
Count number of boundary vertices assuming boundary vertices have been previously marked.
See Also:
markBoundary()

blend

public boolean blend(double s,
                     PgGeometry ag,
                     double t,
                     PgGeometry bg)
Blend between two elementSets, used in interpolation and computing the associate surfaces this = s*a + t*b.
Overrides:
blend in class PgPointSet
Parameters:
double - s, t weights of vertices of each elementSet
PgElementSet - a, b two elementSets used for blending
Returns:
true on success

isConforming

public boolean isConforming()
Return true if elementSet is conforming, else false.

setConforming

public void setConforming(boolean flag)
Set conformality state of geometry and boundary curves, and do not modify connectivity. Mainly used to temporarily switch conformality state, use a conforming method, and the restore the previous state by calling makeNonConformal().

triangulate

public static boolean triangulate(PgElementSet geom)
Triangulate the given element set in place. Each element is split into triangles using the method PgUtil.triangulate.
Parameters:
geom - Surface with polygonal faces. Modified after this calling method.
Returns:
true on success
See Also:
PgUtil.triangulate(jv.vecmath.PdVector[])

checkNeighbour

public boolean checkNeighbour()
Check correct neighbour connectivity. For each triangle ensure that - length of each neighbour array has same size as element array - it does not reference itself - it is neighbour of each adjacent triangle - it and its neighbour join an edge with common vertices.
Returns:
true if neighbour connectivity is correct

intersectionWithLine

public PvPickEvent intersectionWithLine(PdVector rayBase,
                                        PdVector rayDir)
Find intersection of element set with a given ray. Method is used for interactive picking.
Overrides:
intersectionWithLine in class PgGeometry
Parameters:
rayBase - base point of ray eventually hitting the surface
rayDir - direction point of ray eventually hitting the surface
Returns:
full information about hit element, barycentric coordinates etc.

getSavedNumVertices

public int getSavedNumVertices()
Only used when working with non-conforming triangulations.

setSavedNumVertices

public void setSavedNumVertices(int num)
Only used when working with non-conforming triangulations.

getSavedElements

public PiVector[] getSavedElements()
Only used when working with non-conforming triangulations.

setSavedElements

public void setSavedElements(PiVector[] element)
Only used when working with non-conforming triangulations.

makeElementColorsFromXYZ

public boolean makeElementColorsFromXYZ()
Create color from the element position within its bounding box which is interpreted as RGB cube. If dimension of vertices is smaller than three then only the first vertex components are used in the color computation.

makeElementColorsFromZ

public boolean makeElementColorsFromZ()
Create color from the vertical z-height within its bounding box ranging from red to blue. If dimension of vertices is smaller than three then the highest vertex component are used instead of the z-component in the color computation.

makeElementColorsFromZHue

public boolean makeElementColorsFromZHue()
Create color from the vertical z-height within its bounding box ranging through hue rainbow. If dimension of vertices is smaller than three then the highest vertex component are used instead of the z-component in the color computation.

reflect

public PgGeometry reflect(PdMatrix mat,
                          boolean bOrient,
                          boolean bVector)
Generate a cloned geometry and transform vertices by a matrix. For example, this method is called to calculate mirror images of a geometry. Orientation of geometry affects surface vectors.
Overrides:
reflect in class PgPointSet
Parameters:
mat - 3*3 or 4*4 transformation matrix
bOrient - flag whether to keep the orientation of the geometry
bVector - flag whether to keep the orientation of vectors

JavaView® v2.00.008

The software JavaView® is copyright protected. All Rights Reserved.