Documentation of 'jv.geom.PgElementSet' Java class
PgElementSet ("JavaView Reference Manual")
"JavaView? v5.03.003"
jv.geom

Class PgElementSet

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, PsUpdateIf, PgGeometryIf
    Direct Known Subclasses:
    MySurface, PgBndElementSet, PgCatenoid, PgCubeBndElementSet, PgDomain, PgGenusSurface, PgGraph, PgGraphF, PgHelicoid, PgLantern, PgMaxPrinciple, PgParmSurface, PgSmallCubes, PgSmallTetrahedra, PgSphere, PgSurface, PgSurfaceGraph, PgSurfaceOfRotation, 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.

    See Also:
    Serialized Form
    Author:
    Konrad Polthier
    Version:
    02.07.06, 3.50 revised (kp) Edge handling improved, including color and size.
    17.01.04, 3.20 revised (kp) Use area-weighted element normals to compute vertex normals.
    02.01.04, 3.10 revised (kp) Crease angle added.
    09.11.02, 3.00 revised (kp) New method setElementTexturesFromList(PdVector[]) added.
    11.07.02, 2.90 revised (kp) Explicit methods for removal of colors and normals added.
    23.12.01, 2.80 revised (ep) Internationalization.
    19.09.01, 2.72 revised (ur) Copy method removes those features, that don't exist in the original PgElementSet.
    14.08.01, 2.71 revised (ep) Set vector field names in setJvx.
    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 split 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 which draws a silhouette of a shape.
    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)
    • Constructor Detail

      • PgElementSet

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

        This constructor allows to create a geometry by specifying the class name as string. By default, showing of vertices is enabled.

      • PgElementSet

        public PgElementSet(int aVertexDim)
        Constructor of a polyhedral surface in a space of given dimension. This constructor should be preferred by all applications. By default, showing of vertices is disabled.
    • 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.
        Specified by:
        getJvx in interface PgGeometryIf
        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.

        If src geometry has missing neighbour information then method calculates neighbour information using makeNeighbour(), unless PsJavaView.m_bAutoNeighbour==false.

        If src geometry has missing element or vertex normals then method re-calculates normals using makeElementNormals() or makeVertexNormals(), unless PsJavaView.m_bAutoNormals==false.

        Specified by:
        setJvx in interface PgGeometryIf
        Overrides:
        setJvx in class PgPointSet
        Parameters:
        src - a geometry source used to fill this instance with data.
        Version:
        07.04.02, 1.20 revised (kp) Adjust range of PuDouble/PuInteger variables.
        25.09.00, 1.10 revised (kp) Bug in handling of backface color removed.
      • applyModelingMatrix

        public boolean applyModelingMatrix()
        Multiply the modeling matrix to all vertices and vectors. The modeling matrix of this geometry is set to the identity matrix.
        Overrides:
        applyModelingMatrix in class PgPointSet
        Returns:
        true if operation was applied successfully.
        Since:
        JavaView 2.36
        Version:
        04.09.02, 1.00 created (kp)
      • projectFromAmbientSpace

        public boolean projectFromAmbientSpace()
        Apply projection matrix and perform projection determined by projection flag of the surface in a Euclidean model R3, R2, or R1 with parallel projection. Dimension of vertices may be decremented by one after this operation.
        Overrides:
        projectFromAmbientSpace in class PgPointSet
        Returns:
        true if operation was applied successfully.
        Since:
        JavaView 3.99.007
        Version:
        14.11.07, 1.20 revised (kp) Update existing element normals.
        11.11.07, 1.00 created (kp)
      • 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.
        Specified by:
        clone in interface PgGeometryIf
        Overrides:
        clone in class PgPointSet
        See Also:
        copy(PsObject)
        Version:
        27.07.03, 1.20 revised (kp) Missing assignment of parent to cloned backColor added.
        16.09.00, 1.10 revised (kp) Cloning of boundary curves added.
        05.07.00, 1.00 created (kp)
      • copy

        public void copy(PsObject object)
        Copy instance variables by duplication, not by copying a reference.

        The argument was changed from PgGeometry to PsObject since there were problems in J/Link which preferred to use jv.object.PsObject#copy(PsObject) instead of jv.project.PgGeometry#copy(PsObject).

        Overrides:
        copy in class PgPointSet
        See Also:
        clone()
        Version:
        08.11.02, 1.10 revised (kp) Argument changed to PsObject from PgGeometry.
      • 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.
      • copySelect

        public void copySelect(PsObject object,
                               PiVector elemIndex)
        Copy only selected elements of argument geometry plus all related attributes and material data.

        Overrides:
        copySelect in class PgPointSet
        See Also:
        copy(PsObject)
        Version:
        25.04.13, 1.00 created (kp) Created based on copy(PsObject).
      • copyConnectivitySelect

        public void copyConnectivitySelect(PgElementSet geom,
                                           PiVector vertexIndex,
                                           PiVector elemIndex)
        Copy connectivity of mesh, i.e. element and neighbour array.

        See Also:
        copyConnectivity(PgElementSet)
        Version:
        25.04.13, 1.00 created (kp) Created based on copyConnectivity(PgElementSet).
      • copyElementSetSelect

        public void copyElementSetSelect(PgElementSet geom,
                                         PiVector vertexIndex,
                                         PiVector elemIndex)
        Copy instance variables of this class but not of its superclass.

        See Also:
        copyElementSet(PgElementSet)
        Version:
        25.04.13, 1.00 created (kp) Created based on copycopyElementSet(PgElementSet).
      • toString

        public java.lang.String toString()
        Create a multi-line string representation with detailed information about all instance variables.
        Specified by:
        toString in interface PgGeometryIf
        Overrides:
        toString in class PgPointSet
        Version:
        11.07.03, 1.10 revised (kp) Print element normals.
      • addElement

        public int addElement(PiVector elem)
        Add a new element to the end of the element list and increment the number of elements. The neighbour array is automatically updated.

        If element normals exist then the normal is calculated for the new element too. Note, if vertex normals exist then the normals of the element vertices are currently not recalculated (this behavior might change in the future).

        If element colors exist then the color of the new element is the global element color.

        Specified by:
        addElement in interface PgGeometryIf
        Overrides:
        addElement in class PgGeometry
        Parameters:
        elem - element to be added to element list
        Returns:
        int index of new element in element list
        Version:
        11.07.03, 2.20 revised (kp) Compute normal of new element if normals exist.
        17.07.02, 2.10 revised (kp) Increase total size by 20 percent.
        26.05.02, 2.00 revised (kp) Create neighbour and color of new element.
        05.12.00, 1.00 created (kp)
      • addElement

        public boolean addElement(PiVector elem,
                                  int ind)
        Deprecated. method is no longer supported, use addElement(PiVector).
        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:
        elem - element to be added to element list
        ind - index of element position
        Returns:
        false, if index out of range
        Author:
        Samy Khadem-Al-Charieh
        Version:
        13.06.00, 1.10 revised (kp) Assure that argument element has more than two vertices.
        27.08.99, 1.00 created (sk)
      • 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.

        Note, currently element normal attributes like color, length and size are identical with the settings for vertex normals. The reason is that the material panel would become too messed up if there are sliders for both types of normal vectors. In the future the synchronization of the two normal vectors may be skipped, so it is a good programming practice to make use of the individual methods of each type.

      • setGlobalElementNormalLength

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

        Note, currently element normal attributes like color, length and size are identical with the settings for vertex normals. The reason is that the material panel would become too messed up if there are sliders for both types of normal vectors. In the future the synchronization of the two normal vectors may be skipped, so it is a good programming practice to make use of the individual methods of each type.

      • setGlobalElementNormalSize

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

        Note, currently element normal attributes like color, length and size are identical with the settings for vertex normals. The reason is that the material panel would become too messed up if there are sliders for both types of normal vectors. In the future the synchronization of the two normal vectors may be skipped, so it is a good programming practice to make use of the individual methods of each type.

      • setGlobalVertexNormalColor

        public void setGlobalVertexNormalColor(java.awt.Color color)
        Set global element normal color to be used if no local colors are available.
        Overrides:
        setGlobalVertexNormalColor in class PgPointSet
      • setGlobalVertexNormalLength

        public void setGlobalVertexNormalLength(double length)
        Set length factor of element normal vectors when drawn in display.
        Overrides:
        setGlobalVertexNormalLength in class PgPointSet
      • setGlobalVertexNormalSize

        public void setGlobalVertexNormalSize(double size)
        Set thickness in pixels of element normals when drawn in display.
        Overrides:
        setGlobalVertexNormalSize in class PgPointSet
      • getCreaseAngle

        public double getCreaseAngle()
        Get crease angle which is a threshold determining sharp crease edges.
        Since:
        JavaView 3.03.007
        See Also:
        setCreaseAngle(double)
        Version:
        02.01.04, 1.00 created (kp)
      • setCreaseAngle

        public void setCreaseAngle(double angle)
        Set crease angle which is a threshold determining sharp crease edges. In smooth lighting and shading there is no interpolation across crease edges. An edge is a crease edge if the dihedral angle (positive angle between normals) between the two adjacent faces is equal or larger than the crease angle threshold. The crease angle is measure in radians in [0,Pi]. A crease angle 0 induces flat shading and prevents all smoothing, and a crease angle Pi+eps shows all edges with smooth shading.
        Since:
        JavaView 3.03.007
        See Also:
        getCreaseAngle()
        Version:
        02.01.04, 1.00 created (kp)
      • 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.
      • isShowingEdgeColors

        public boolean isShowingEdgeColors()
        Determine whether showing of edge colors is enabled.
      • showEdgeColors

        public void showEdgeColors(boolean flag)
        Set flag to enable drawing of individual edge colors.
      • isShowingEdgeSizes

        public boolean isShowingEdgeSizes()
        Determine whether showing of edge sizes is enabled.
      • showEdgeSizes

        public void showEdgeSizes(boolean flag)
        Set flag to enable drawing of edge sizes.
      • 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.
      • isEnabledEdges

        public boolean isEnabledEdges()
        Check if storage and maintenance of edges is enabled.
        Since:
        JavaView 3.96.026
        Author:
        Konrad Polthier
        Version:
        02.07.06, 1.00 created (kp)
      • setEnabledEdges

        public void setEnabledEdges(boolean flag)
        Enable storage and maintenance of edges. By default, element edges are not permanently stored to reduce memory consumption.

        When enabled, then just a flag is set. Call makeEdgeStars() to rebuilt the edge array.

        When disabled, then internal edge variables are deleted.

        Since:
        JavaView 3.96.026
        See Also:
        makeEdgeStars()
        Author:
        Konrad Polthier
        Version:
        02.07.06, 1.00 created (kp)
      • getNumEdgeStars

        public int getNumEdgeStars()
        Get number of allocated edge stars. Edge stars are allocated only if isEnabledEdges()==true.

        See also getNumEdges() which returns the number of edges of the underlying simplicial complex. Note, getNumEdgeStars() will return 0 if no edgeStars are allocated while getNumEdges() always returns a number related to the simplicial complex. Use getNumEdgesStars() when working with edgeStar array, and use getNumEdges() in combinatorial calculations.

        See Also:
        getNumEdges()
      • getEdgeStars

        public PgEdgeStar[] getEdgeStars()
        Get edge array for read and write access, but do not modify the size of any edge. Use makeEdgeStars() or makeNeighbour() to generate edge array. Also note, that the actual size of the array may be larger than number of edges for efficiency reasons. Therefore, do not use length of array.
        Since:
        JavaView 3.96.026
        Author:
        Konrad Polthier
        Version:
        02.07.06, 1.00 created (kp)
      • getEdgeStar

        public PgEdgeStar getEdgeStar(int ind)
        Get edge object for read and write access, but do not modify the size of any edge. Use makeEdgeStars() or makeNeighbour() to generate edge array.
        Since:
        JavaView 3.96.026
        Author:
        Konrad Polthier
        Version:
        02.07.06, 1.00 created (kp)
      • getEdge

        public PiVector getEdge(int ind)
        Deprecated. since JavaView 3.96.031, use getEdgeStar(int).
        Get a reference to index vector of edge with given index.
      • setEdgeStar

        public boolean setEdgeStar(int ind,
                                   PgEdgeStar edgeStar)
        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:
        ind - index of edge
        edgeStar - array with indices of new edge
        Returns:
        boolean false, if index out of range, or argument missing
        Since:
        JavaView 3.96.026
        Author:
        Konrad Polthier
        Version:
        02.07.06, 1.00 created (kp)
      • getElementEdges

        public PiVector[] getElementEdges()
        Get an array which stores for each element the indices of its incident edges. For each element, the indices of the incident edges are ordered in the same way as the neighbour array.
        Returns:
        array of length=numElements with indices of edges
        Since:
        JavaView 3.96.026
        Author:
        Konrad Polthier
        Version:
        02.07.06, 1.00 created (kp)
      • getElementEdge

        public int getElementEdge(int elementInd,
                                  int locNeighbInd)
        Get the index of an edge incident to the given element. The local index of edge is in the same order as the neighbour array.
        Parameters:
        elementInd - Index of an element.
        locNeighbInd - Local neighbour index of the edge.
        Returns:
        index of edge
        Since:
        JavaView 3.96.026
        Author:
        Konrad Polthier
        Version:
        30.03.07, 1.01 revised (fk) Check if edge index array exists. 02.07.06, 1.00 created (kp)
      • setElementEdges

        public void setElementEdges(PiVector[] elementEdge)
        Set an array which stores for each element the indices of its incident edges. For each element, the indices of the incident edges are ordered in the same way as the neighbour array.
        Since:
        JavaView 3.96.026
        Author:
        Konrad Polthier
        Version:
        02.07.06, 1.00 created (kp)
      • removeElementEdges

        public void removeElementEdges()
        Remove element-edge incidence information from element set.
        Since:
        JavaView 3.96.026
        Author:
        Konrad Polthier
        Version:
        02.07.06, 1.00 created (kp)
      • getEdgeColors

        public java.awt.Color[] getEdgeColors()
        Get color array for read and write access, but do not modify the size of any color vector. Also note, that the actual size of the array may be larger than the number of used edges for efficiency reasons. Therefore, do not use length of array.
        Since:
        JavaView 3.96.026
        Author:
        Konrad Polthier
        Version:
        02.07.06, 1.00 created (kp)
      • hasEdgeColors

        public boolean hasEdgeColors()
        Check if edge colors have been allocated.
        Since:
        JavaView 3.96.026
        See Also:
        assureEdgeColors()
        Author:
        Konrad Polthier
        Version:
        02.07.06, 1.00 created (kp)
      • assureEdgeColors

        public void assureEdgeColors()
        Assures respectively allocates correct length of edge color array. Length of array is equal to length of edge array.
        Since:
        JavaView 3.96.026
        Author:
        Konrad Polthier
        Version:
        02.07.06, 1.00 created (kp)
      • removeEdgeColors

        public void removeEdgeColors()
        Remove local edge colors from a geometry and use global edge color instead.

        Showing of edge colors must be switched off explicitly using showEdgeColors(boolean).

        Since:
        JavaView 3.96.026
        Author:
        Konrad Polthier
        Version:
        02.07.06, 1.00 created (kp)
      • setEdgeColors

        public void setEdgeColors(java.awt.Color[] colorList)
        Copy edge colors of list to existing array of edge colors. Length of argument list must be equal or larger than getNumEdgeStars(). All edge colors are copied. The dimension of all argument colors must be equal to getDimOfColors() of the geometry.

        Showing of edge colors must be switched on in order to be visible.

        Parameters:
        colorList - array with new edge colors
        Since:
        JavaView 3.96.026
        Author:
        Konrad Polthier
        Version:
        02.07.06, 1.00 created (kp)
      • getEdgeSizes

        public PdVector getEdgeSizes()
        Get array of relative edge sizes for read and write access. Also note, that the actual size of the array may be larger than the number of used edges for efficiency reasons. Therefore, do not use length of array.
        Since:
        JavaView 3.96.026
        Author:
        Konrad Polthier
        Version:
        02.07.06, 1.00 created (kp)
      • hasEdgeSizes

        public boolean hasEdgeSizes()
        Check if relative edge sizes have been allocated.
        Since:
        JavaView 3.96.026
        See Also:
        assureEdgeSizes()
        Author:
        Konrad Polthier
        Version:
        02.07.06, 1.00 created (kp)
      • assureEdgeSizes

        public void assureEdgeSizes()
        Assures respectively allocates correct length of edge size array. Length of array is equal to length of edge array. Dimension of size vector is equal to maximal number of vertices.
        Since:
        JavaView 3.96.026
        Author:
        Konrad Polthier
        Version:
        02.07.06, 1.00 created (kp)
      • removeEdgeSizes

        public void removeEdgeSizes()
        Remove edge sizes from a geometry.

        Showing of edge sizes must be switched off explicitly using showEdgeSizes(boolean).

        Since:
        JavaView 3.96.026
        Author:
        Konrad Polthier
        Version:
        02.07.06, 1.00 created (kp)
      • setEdgeSizes

        public void setEdgeSizes(PdVector edgeSize)
        Assign a set of relative edge sizes. Length of argument list must be equal or larger than getNumEdgeStars(). All edge sizes are copied.

        Showing of edge sizes must be switched on in order to be visible.

        Parameters:
        edgeSize - array with new edge size for all edges
        Since:
        JavaView 3.96.026
        Author:
        Konrad Polthier
        Version:
        02.07.06, 1.00 created (kp)
      • getElements

        public PiVector[] getElements()
        Get element array for read and write access.

        Do not modify the size of any element vector.

        Note, that the actual size of the array may be larger than m_numElements for efficiency reasons. Therefore, do not use the length of array.

      • 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.
      • getElementTexture

        public PdVector[] getElementTexture(int ind)
        Get element texture array of an individual element. Returns null if no element texture available, or index out of range.
        Since:
        JavaView 2.80.000
        Version:
        06.06.03, 1.00 created (kp)
      • 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.
      • getVertexTextures

        public PdVector[] getVertexTextures()
        Get array of all texture coordinates both for vertex and element based textures. This method overwrites PgPointSet#getVertexTextures if texture is element based.
        Overrides:
        getVertexTextures in class PgPointSet
        Returns:
        plain array of 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.
      • getNumBoundaries

        public int getNumBoundaries()
        Return number of (living) boundary polygons. This number may be different from number of boundary components and number of boundary edges.
        Returns:
        number of boundary segments used
        See Also:
        getNumBoundaryEdges()
        Author:
        Konrad Polthier
        Version:
        23.04.05, 2.00 revised (kp) Count boundaries only which are not deleted.
        16.09.98, 1.00 created (kp)
      • 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.
        Version:
        23.04.05, 2.00 revised (kp) No longer count boundaries which are marked deleted.
      • 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.
        Version:
        23.04.05, 2.00 revised (kp) No longer return boundaries which are marked deleted.
      • getSelectedBndPolygon

        public PgBndPolygon getSelectedBndPolygon()
        Get the currently selected boundary polygon, or null if there is none.
        Version:
        20.07.07, 1.00 created (kp)
      • selectBndPolygon

        public int selectBndPolygon(PgBndPolygon bnd)
        Select a boundary polygon.
        Version:
        20.07.07, 1.00 created (kp)
      • getIndexOfBndPolygon

        public int getIndexOfBndPolygon(PgBndPolygon bnd)
        Get index of vector fields, assumes user data is stored in a vector.
        Returns:
        index of vector field, or -1 if it does not exist
      • removeBoundaries

        public void removeBoundaries()
        Remove all boundary curves.
        Version:
        11.12.04, 1.10 revised (kp) Explicitly remove link to this elementSet before nulling bnd.
        16.09.00, 1.00 created (kp)
      • removeDeletedBoundaries

        public int removeDeletedBoundaries()
        Remove all boundary curves which are marked PsObject.IS_DELETED.
        Returns:
        number of deleted boundaries.
        Version:
        23.04.05, 1.00 created (kp)
      • 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.
        Version:
        16.09.00, 1.10 revised (kp) Use num of bnd polygons instead of bnd components.
      • 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.
      • isShowingEdges

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

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

        public boolean isShowingEdgeColorFromElements()
        Determines whether local edge color is induced from element or vertex colors.
      • showEdgeColorFromElements

        public void showEdgeColorFromElements(boolean flag)
        Set flag if edge colors are induced from local element or vertex colors.
      • isShowingSmoothEdgeColors

        public boolean isShowingSmoothEdgeColors()
        Determines whether smooth coloring of edges is enabled, currently requires vertex colors.
      • showSmoothEdgeColors

        public void showSmoothEdgeColors(boolean flag)
        Set flag to enable smooth coloring of edges, currently requires vertex colors.
      • isShowingEdgeColorFromVertices

        public boolean isShowingEdgeColorFromVertices()
        Determines whether smooth edge coloring uses vertex colors at vertices, requires vertex colors.
      • showEdgeColorFromVertices

        public void showEdgeColorFromVertices(boolean flag)
        Set flag to enable smooth edge coloring using vertex colors at vertices, requires vertex colors.
      • isShowingEdgeLabels

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

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

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

        public void showTaggedEdges(boolean flag)
        Set flag to enable drawing of element edges.
      • 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()
        Deprecated. use isShowingElementTexture()
        Determines whether drawing of element texture is enabled.
      • isShowingElementTexture

        public boolean isShowingElementTexture()
        Determines whether drawing of element texture is enabled.
      • isShowingSilhouette

        public boolean isShowingSilhouette()
        Determines whether a polygon is shown along the silhouette if a shape.
      • showSilhouette

        public void showSilhouette(boolean flag)
        Set flag to enable if a polygon is shown along the silhouette if a shape.
      • 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.
      • isShowingElementBackColor

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

        public boolean isShowingSmoothLighting()
        Determines whether smooth lighting is enabled, requires vertex normals.
      • showSmoothLighting

        public void showSmoothLighting(boolean flag)
        Set flag to enable smooth lighting, requires vertex normals.
      • isShowingSmoothElementColors

        public boolean isShowingSmoothElementColors()
        Determines whether smooth coloring of elements is enabled, currently requires vertex colors.
      • showSmoothElementColors

        public void showSmoothElementColors(boolean flag)
        Set flag to enable smooth coloring of elements, currently requires vertex colors.
      • isShowingElementColorFromVertices

        public boolean isShowingElementColorFromVertices()
        Determines whether smooth element coloring uses vertex colors at vertices, requires vertex colors.
        Since:
        JavaView 4.20.015
        Version:
        10.05.14, 1.00 created (kp)
      • showElementColorFromVertices

        public void showElementColorFromVertices(boolean flag)
        Set flag to enable smooth element coloring using vertex colors at vertices, requires vertex colors.
        Since:
        JavaView 4.20.015
        Version:
        10.05.14, 1.00 created (kp)
      • isShowingElementFromVertexColors

        public boolean isShowingElementFromVertexColors()
        Deprecated. since JavaView 4.20.015, use #isShowingElementColorFromVertices()
        Determines whether smooth element coloring uses vertex colors, requires vertex colors.
      • showElementFromVertexColors

        public void showElementFromVertexColors(boolean flag)
        Deprecated. since JavaView 4.20.015, use #showingElementColorFromVertices(boolean)
        Set flag to enable smooth element coloring using vertex colors at vertices, requires vertex colors.
      • 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 backface is disabled and element set has no element normals then method creates element normals.
        Version:
        16.05.05, 1.60 revised (kp) No longer create element normals, must be done elsewhere.
        04.02.05, 1.50 revised (kp) Create element normals only if flag!=true.
        15.11.00, 1.10 revised (kp) Create element normals only if flag==true.
      • 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.
      • showVertexTexture

        public void showVertexTexture(boolean flag)
        Set flag to enable drawing of vertex texture. This method disables element texture whenever vertex texture is enabled, and vice versa.
        Overrides:
        showVertexTexture in class PgPointSet
      • 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.
      • 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

        public 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. All element allocation is done in this method. Method should not be called directly unless a specific allocation is required. Usually, a user would specify the number of elements via setNumElements().
        Version:
        14.03.06, 2.00 revised (kp) Method made public to allow better control of allocations.
        14.03.03, 1.50 revised (kp) Increase number of vectors of vector field is available.
        19.12.00, 1.25 revised (kp) Reset neighbour array if number of elements is decreased.
        16.07.00, 1.20 revised (kp) Assure length of element textures if allocated.
        11.07.00, 1.10 revised (kp) Assure neighbours if dimOfElements==-1.
      • 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.
      • getNumElementIndices

        public int getNumElementIndices()
        Get total number of vertex entries in all elements. If instance variable m_dimOfElements is unequal to -1 then total number is equal to m_numElements*m_dimOfElements.
        Returns:
        int total number of all vertex indices of all elements
      • setNumElements

        public void setNumElements(int numElements)
        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.

        Version:
        18.04.10, 2.90 revised (kp) Invocation of setMaxNumElements and check for instanceSharing adjusted to PgPointSet#setNumVertices.
        11.12.04, 2.80 revised (kp) No longer update dimOfElements of numElements is reduced.
        05.08.04, 2.70 revised (kp) No action if same number is requested.
        24.07.03, 2.60 revised (kp) Cache of maxNumElements reduced if numElements too small.
        28.06.03, 2.50 revised (kp) Update dimOfElements when numElements is reduced.
        25.03.03, 2.10 revised (kp) Update vector fields too.
      • getMaxDimOfElements

        public int getMaxDimOfElements()
        Get maximal number of vertices appearing in an element. Method returns the same value as getDimOfElements() if all elements have the same size.
        Since:
        JavaView 2.84.000
        See Also:
        getDimOfElements()
        Version:
        28.06.03, 1.00 created (kp)
      • getDimOfElements

        public int getDimOfElements()
        Get number of vertices per element if it is the same for all elements, otherwise return -1. If elements have different size, then use getMaxDimOfElements() to obtain the maximal size of an element.
        See Also:
        getMaxDimOfElements(), getDimOfElement(int), 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)
        Version:
        13.06.00, 1.20 revised (kp) Assure that argument is =-1 or >=3.
        30.07.99, 1.10 revised (kp) Now run until maxNumElements when changing dim.
        00.00.98, 1.00 created (kp)
      • setDimOfElement

        public 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:
        getDimOfElement(int), setDimOfElements(int), setElement(int, PiVector)
        Version:
        19.05.02, 1.40 revised (kp) Method made public.
        27.12.01, 1.30 revised (kp) Adjust size of elementTexture too if available.
        04.08.00, 1.20 revised (kp) Call setDimOfElements(-1) if new size is different.
        13.06.00, 1.10 revised (kp) Assure that argument is =-1 or >=3.
        07.03.00, 1.00 created (kp)
      • 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.
      • setDimOfVertices

        public void setDimOfVertices(int dim)
        Set dimension of vertices. Make rare use, and try to assign dimension of vertices already in the constructor.
        Overrides:
        setDimOfVertices in class PgPointSet
        Version:
        11.11.04, 1.00 created (kp)
      • 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)
        Version:
        17.10.00, 2.00 revised (ep) Corrected bounds of loop for element normals.
      • 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)
      • hasElementColors

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

        public boolean hasElementBackColors()
        Check if element back colors have been allocated.
        See Also:
        assureElementBackColors()
      • hasElementNormals

        public boolean hasElementNormals()
        Check if element normals have been allocated.
        See Also:
        assureElementNormals()
        Version:
        13.12.00, 1.10 revised (kp) No longer check for unit length of normals.
      • 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().
        Version:
        24.06.05, 1.10 revised (kp) No longer remove vertex textures.
      • makeQuadrElementTexture

        public void makeQuadrElementTexture(int uDiscr,
                                            int vDiscr)
        Generate default element texture in [0,1]*[0,1] for a quadrilateral surface.
        Parameters:
        uDiscr - Number of lines in u direction.
        vDiscr - Number of lines in v direction.
        Author:
        Konrad Polthier
        Version:
        28.12.08, 1.10 revised (kp) If discretization is too small then setNumElements(0).
        20.08.99, 1.02 revised (ur) Orientation of all elements changed to be counter-clockwise in (i,j) domain.
        03.08.99, 1.00 created (kp)
      • 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 - Number of lines in u direction.
        vDiscr - Number of lines in v direction.
        See Also:
        makeCylinderConn(int, int)
        Author:
        Konrad Polthier
        Version:
        28.12.08, 1.10 revised (kp) If discretization is too small then setNumElements(0).
        20.08.99, 1.02 revised (ur) Orientation of all elements changed to be counter-clockwise in (i,j) domain.
        13.02.99, 1.01 revised (kp) Orientation of triangles changed to be counter-clockwise and identical to rectangular case.
        19.10.97, 1.00 created (kp)
      • makeAlternatingQuadrConn

        public void makeAlternatingQuadrConn(int uDiscr,
                                             int vDiscr,
                                             boolean alternateUDir)
        Make quadrilateral connectivity with quadrilaterals being alternately triangulated. Quadrilaterals are triangulated along a diagonal. If alternateUDir==true then along uDir the diagonal is changed from one quadrilateral to the next, and kept the same along the vDir. Otherwise the flipping happens along the vDir.
        Parameters:
        uDiscr - Number of lines in u direction.
        vDiscr - Number of lines in v direction.
        alternateUDir - Determines if diagonals are flipped along uDir or vDir.
        See Also:
        makeCylinderConn(int, int)
        Author:
        Konrad Polthier
        Version:
        28.12.08, 1.10 revised (kp) If discretization is too small then setNumElements(0).
        20.08.99, 1.02 revised (ur) Orientation of all elements changed to be counter-clockwise in (i,j) domain
        13.02.99, 1.01 revised (kp) Orientation of triangles changed to be counter-clockwise and identical to rectangular case.
        19.10.97, 1.00 created (kp)
      • 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 - Number of lines in u direction.
        vDiscr - Number of lines in v direction.
        See Also:
        makeQuadrConn(int, int)
        Author:
        Konrad Polthier
        Version:
        28.12.08, 1.40 revised (kp) If discretization is too small then setNumElements(0).
        29.10.03, 1.30 revised (kp) Case vDiscr==2 now produces a topological cylinder instead of a band.
        07.11.99, 1.20 revised (kp) Degenerate case with vDiscr==1 no longer allowed since problems with makeNeighbour().
        20.08.99, 1.10 revised (ur) Orientation of all elements changed to be counter-clockwise in (i,j) domain.
        13.02.99, 1.00 created (kp) from makeQuadrConn
      • 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 - Number of lines in u direction.
        vDiscr - Number of lines in v direction.
        See Also:
        makeQuadrConn(int, int), getBoundaries()
        Author:
        Konrad Polthier
        Version:
        11.08.14, 1.50 revised (kp) Reset closedness status of bndPolygons.
        21.12.97, 1.00 created (kp)
      • 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)
        Author:
        Konrad Polthier
        Version:
        28.12.08, 1.10 revised (kp) If discretization is too small then setNumElements(0).
        20.08.99, 1.20 revised (ur) Orientation of all elements changed to be counter-clockwise in (i,j) domain, analog to makeQuadrConn
        11.04.99, 1.10 revised (kp) Orientation of triangle changed.
        21.10.97, 1.00 created (kp)
      • 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)
        Author:
        Konrad Polthier
        Version:
        21.12.97, 1.00 created (kp)
      • flipOrientation

        public void flipOrientation()
        Change orientation of all elements and invert normal vectors.
        Overrides:
        flipOrientation in class PgPointSet
        See Also:
        PgPointSet.flipOrientation()
        Author:
        Konrad Polthier
        Version:
        15.06.06, 1.20 revised (kp) Direct replacement rules which avoid internal array allocations, missing inversion of element textures added.
        30.01.99, 1.05 revised (kp) Neighbour corrected.
        04.10.98, 1.02 revised (kp) Invert normals too.
        21.12.97, 1.01 revised (kp) Use invert().
        21.10.97, 1.00 created (kp)
      • getVertexValence

        public static PiVector getVertexValence(PgElementSet geom)
        Compute valence of each vertex, that is, the number of incoming edges. This method requires correct neighbour information.
        Returns:
        vector with the valence of each vertex, its length equals the number of vertices.
      • 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. This algorithm tries to avoid degenerate triangulations, say, having valence 3 vertices.
        Author:
        Konrad Polthier
        Version:
        15.10.03, 2.30 revised (ur) Handling of triangles with different orientation corrected.
        15.01.03, 2.20 revised (kh) Do not flip edge if both vertices are selected.
        07.09.02, 2.10 revised (kp) Flip until no more flips useful.
        25.01.02, 2.00 revised (kp) Stability increased, no longer depends on normal.
        30.10.98, 1.00 created (kp)
      • allocateEdgeStars

        public void allocateEdgeStars()
        Enable edges and make edges stars if no edge stars available.
        Author:
        Matthias Nieser, Konrad Polthier
        Version:
        12.02.2008, 1.00 created (kp)
      • makeEdgeStars

        public PgEdgeStar[] makeEdgeStars()
        Generate list of edges from element information of a possibly non-manifold surface. Method does not use neighbour information but computes the edge list solely based on information of the m_element array.

        The routine computes an array of edges temporarily in a single pass through all elements. Additionally, it stores the (1, 2, ..) elements sharing an edge.

        The method allows an edge to be shared by more than two elements, i.e. non-manifold polyhedra. Method consists of code from previous version of makeNeighbour(), which now calls makeEdgeStars(). Therefore, the method does not use any neighbour information.

        During edge collection, each edge is stored in the array edgesAtVertex at an index equal to the lowest of its two vertex indices. After the collection, each entry of edgesAtVertex is a vector containing those edges emanating from this vertex to vertices with higher vertex index. The entry at index i in edgesAtVertex is an array which contains all edges emanating from vertex with index i to vertices with higher index.

        This algorithm requires the array edgesAtVertex to have size equal to largest vertex index referenced from an element, but has a linear runtime when finding entries with identical edges. When collection is finished, usually some array entries will be null. The return parameter is an array of edges constructed from edgesAtVertex.

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

        If element set is non-manifold then the number of edges returned by this method may differ from the number which getNumEdgeStars() returns and getNumEdges() since the later relies on a correct neighbour information which is not used here.

        Returns:
        array with all edges, size equals number of edges.
        See Also:
        getNumEdgeStars(), getEdgeStars(), getEdge(int, int)
        Author:
        Konrad Polthier
        Version:
        02.07.06, 3.00 revised (kp) Renamed to makeEdgeStars() from getEdgeList().
        17.09.00, 2.10 revised (kp) Bug removed in vertex counting, one vertex was missing.
        23.06.00, 2.00 revised (kp) List of edges changed from vector to array.
        22.08.99, 1.10 revised (kp) Method now also works if vertices haven't been created yet.
        10.04.99, 1.00 created (kp) Code taken from method makeNeighbour().
      • makeEdgeStarsFromNeighbour

        public PgEdgeStar[] makeEdgeStarsFromNeighbour()
        Generate list of edges from the neighbourhood information of a possibly non-manifold surface. Method computes the edge list based on information of the m_neighbour and m_element arrays.

        The routine computes an array of edges temporarily in a single pass through all elements. Additionally, it stores the 1 or 2 elements sharing an edge.

        This method does not allow an edge to be shared by more than two elements; for non-manifold edges the neighbourhood information must be set correctly in m_neighbour. By this method the edge list can be reconstructed for models saved to a jvx file.

        During edge collection, each edge is stored in the array edgesAtVertex at an index equal to the lowest of its two vertex indices. After the collection, each entry of edgesAtVertex is a vector containing those edges emanating from this vertex to vertices with higher vertex index.

        This algorithm requires the array edgesAtVertex to have size equal to largest vertex index referenced from an element, but has a linear runtime when finding entries with identical edges. When collection is finished, usually some array entries will be null. The return parameter is an array of edges constructed from edgesAtVertex.

        Returns:
        array with all edges, size equals number of edges.
        See Also:
        getNumEdgeStars(), getEdgeStars(), getEdge(int, int), makeEdgeStars()
        Author:
        Ulrich Reitebuch
        Version:
        07.01.08, 1.00 created (ur) Code taken from method makeEdgeStars() and modified.
      • printEdgeList

        public java.lang.String printEdgeList()
        Print list of edges to console if previously computed.
        Author:
        Konrad Polthier
        Version:
        23.06.00, 1.10 revised (kp) Edge list change from vector to an array.
        10.04.99, 1.00 created (kp)
      • 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 neighbour connectivity details this.

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

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

        Returns:
        boolean false, if polyhedron is not a manifold, i.e. an edge is shared by more than two elements.
        Author:
        Konrad Polthier
        Version:
        21.12.00, 2.70 revised (kp) Edges with more than two elements all become boundary edges.
        10.04.99, 2.60 revised (kp) Edge construction moved into separate method.
        31.10.98, 2.50 revised (kp) Opposite vertex local index change from k+2 to k-1, no difference for triangulations
        16.09.98, 2.00 revised (kp) Optimized, O(n*n) replaced with O(n) algorithm
        23.11.97, 1.00 created (kp)
      • makeElementNormals

        public boolean makeElementNormals()
        Compute element normals from edge cross products. For each element, a normal is computed at each of its vertices as the cross product 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 reliably only for convex planar elements.

        Dimension of vertices must be equal to 3.

        See Also:
        makeVertexNormals()
        Author:
        Konrad Polthier
        Version:
        12.03.14, 2.00 revised (kp) Optimized for triangle meshes.
        22.08.07, 1.70 revised (kp) Return false if dimension not 3.
        11.11.04, 1.60 revised (kp) Keep dimension of normals and vertices the same.
        24.02.01, 1.50 revised (kp) Speed enhanced.
        23.12.97, 1.00 created (kp)
      • makeVertexNormals

        public boolean makeVertexNormals()
        Compute vertex normals from adjacent elements (without using element normals). For each vertex compute for each element a normal vector from two edges. The contribution of these element normals is proportional to the element area.

        Dimension of vertices must be equal to 3.

        Overrides:
        makeVertexNormals in class PgPointSet
        See Also:
        makeElementNormals()
        Author:
        Konrad Polthier
        Version:
        12.03.14, 3.00 revised (kp) Optimized for triangle meshes.
        22.08.07, 2.50 revised (kp) Return false if dimension not 3.
        14.03.05, 2.40 revised (kp) Better normal computation at faces with degenerate edges.
        14.12.04, 2.30 revised (kp) Normals are now aligned to a half-space of first normal at each vertex.
        11.11.04, 2.20 revised (kp) Keep dimension of normals and vertices the same.
        16.04.04, 2.10 revised (kp) Contribution of adjacent element normals weighted by element area.
        25.03.01, 2.00 revised (kp) Compute vertex normal independent of element normal.
        23.12.97, 1.00 created (kp) Original version takes average of all adjacent element normals.
      • 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.
        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)
        Author:
        Konrad Polthier
        Version:
        07.12.97, 1.00 revised (kp)
        07.12.97, 1.00 created (kp)
      • 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)
        Author:
        Konrad Polthier
        Version:
        07.12.97, 1.00 created (kp)
      • 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:
        polygon - triangle array with three vertices of macro patch
        discr - number of points on each edge
        See Also:
        makeTriangleBnd(int)
        Author:
        Konrad Polthier
        Version:
        07.12.97, 1.00 created (kp)
      • 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)
        Author:
        Konrad Polthier
        Version:
        07.12.97, 1.00 created (kp)
      • 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)
        Author:
        Konrad Polthier
        Version:
        07.12.97, 1.00 created (kp)
      • 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()
        Author:
        Konrad Polthier
        Version:
        19.04.99, 1.01 revised (kp) Call to method removeUnusedVertices() added
        10.12.97, 1.00 created (kp)
      • getNumUnusedVertices

        public int getNumUnusedVertices()
        Get the number of unused vertices which are not references by elements. This method is very cheap and should be
        Returns:
        number of unused vertices
        Author:
        Konrad Polthier
        Version:
        26.12.01, 1.00 revised (kp)
        26.12.01, 1.00 created (kp)
      • 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).
        Returns:
        true if method was successful
        Author:
        Konrad Polthier
        Version:
        26.12.01, 1.50 revised (kp) Early quit if there are no unused vertices.
        17.12.00, 1.30 revised (ep) Handle vector fields.
        12.02.00, 1.20 revised (kp) Additional check whether bnd refers to valid vertices.
        17.10.99, 1.10 revised (kp) Rename from previous name compress(). Texture added.
        00.00.98, 1.00 created (kp)
      • 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 necessary 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 all previously existing vertices
        Version:
        22.04.02, 1.50 revised (kp) Update list of boundary vertices. 15.06.00, 1.00 created (kp)
      • 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().
        Specified by:
        removeElement in interface PgGeometryIf
        Overrides:
        removeElement in class PgGeometry
        Parameters:
        ind - index of element which is to be deleted
        Returns:
        Array with indices of new positions of all previously existing elements
        Author:
        Konrad Polthier
        Version:
        20.07.00, 1.10 revised (kp) Return value changed to index array from boolean.
        14.07.00, 1.00 created (kp)
      • 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 unpredictable results.

        Returns:
        Array with indices of new positions of all previously existing elements
        Author:
        Konrad Polthier
        Version:
        17.12.00, 1.20 revised (ep) Handle vector fields.
        20.07.00, 1.10 revised (kp) Return value changed to index array from boolean.
        13.01.00, 1.01 revised (kp) Slight bug found by (ur) removed.
        17.10.99, 1.00 created (kp)
      • 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().

        The merged geometry will local colors allocated and assigned if

                        1. both the global color of both geometries are different, or
                        2. either geometry has local colors.
         
        If local colors are allocated but one of the geometries does not have local colors then its local colors are be assumed to be its global color. The merged geometry will show globalVertexColors if
                        1. the global color of both geometries is the same, and
                        2. both geometries are showing the global color.
         
        In all other cases the merged geometry will show local colors. The global color of the merged geometry is never changed.
        Specified by:
        merge in interface PgGeometryIf
        Overrides:
        merge in class PgPointSet
        Parameters:
        aGeom - elementSet to be merged into 'this'
        Returns:
        true if method was successful
        See Also:
        close()
        Author:
        Konrad Polthier
        Version:
        08.07.06, 2.50 revised (kp) Handling of edges implemented.
        12.09.02, 2.20 revised (kp) Merging of colors revised.
        01.10.01, 2.11 revised (ur) Set individual element colors to global color in a geometry, if only the other geometry has element colors.
        22.07.00, 2.10 revised (kp) Argument changed to class PgGeometryIf.
        15.06.00, 2.00 revised (kp) Argument changed to class PgGeometry.
        01.06.99, 1.01 revised (kp) Added missing assureElementNormals(), -Colors().
        10.12.97, 1.00 created (kp)
      • refineGlobalIntoFour

        public boolean refineGlobalIntoFour()
        Deprecated. use refineGlobalIntoFour(boolean) instead.
        Refine elementSet by dividing each triangle into four similar children.
      • refineGlobalIntoFour

        public boolean refineGlobalIntoFour(boolean bInsertMidPoints)
        Refine elementSet by dividing each triangle into four similar children. Initially we triangulate the elementSet; this method requires correct neighbour information. On return the neighbour information is correct. The refinement scheme is sketched in the following image Refinement Scheme.
        Parameters:
        bInsertMidPoints - flag, if new vertices shall be computed to edge mid points.
        Returns:
        true if method was successful
        Author:
        Konrad Polthier
        Version:
        22.08.05, 2.80 revised (ur) Normalize new normals.
        25.01.02, 2.70 revised (ur) Make correct neighbourhood for not oriented triangulations. Remove initial call of makeNeighbour().
        09.05.01, 2.60 revised (kp) Handling of vertex and element normals added.
        22.01.01, 2.50 revised (ep) Handling of vertex based vector fields.
        18.12.00, 2.40 revised (ep) Handling of element based vector fields.
        21.11.00, 2.30 revised (ur) Blending of element textures added.
        20.11.00, 2.20 revised (ur) Blending of vertex textures added.
        07.11.00, 2.10 revised (ur) Use colors of parent triangles for new subtriangles and blend vertex colors for new vertices.
        13.01.00, 2.00 revised (kp) Subdivision schemes incorporated.
        16.09.98, 1.00 created (kp)
      • getElementWithVertex

        public int getElementWithVertex(int vertexInd)
        Find first element referencing a given vertex.
        Author:
        Konrad Polthier
        Version:
        03.09.99, 1.00 revised (kp)
        03.09.99, 1.00 created (kp)
      • getEdge

        public PgEdgeStar 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 getEdgeStars().

        Parameters:
        vInd1 - Index of edge vertices in global vertex array of elementSet.
        vInd2 - Index of edge vertices in global vertex array of elementSet.
        Returns:
        Edge structure with information about adjacent elements
        See Also:
        getEdgeStars()
        Author:
        Konrad Polthier
        Version:
        24.02.01, 1.10 revised (kp) Speed up.
        03.09.99, 1.00 created (kp)
      • 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.
        Author:
        Konrad Polthier
        Version:
        08.06.99, 1.01 revised (kp) Cousin method removed allowing to pass vector array as argument.
        12.12.97, 1.00 created (kp)
      • getElement

        public PiVector getElement(int ind)
        Get a reference to an individual element.
        Specified by:
        getElement in interface PgGeometryIf
        Overrides:
        getElement in class PgGeometry
        Parameters:
        ind - index of element
        Returns:
        reference to element vector with given index
      • getNeighbour

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

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

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

        public PdVector getElementNormal(int ind)
        Get a reference to an individual element normal.
        Parameters:
        ind - 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
        Version:
        12.12.97, 1.00 created (kp)
      • 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 element
        a - new vertex index of element
        b - new vertex index of element
        c - new vertex index of element
        Version:
        28.11.00, 1.00 created (kp)
      • 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 element
        a - new vertex index of element
        b - new vertex index of element
        c - new vertex index of element
        d - new vertex index of element
        Version:
        28.11.00, 1.00 created (kp)
      • 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:
        elemInd - 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 ind,
                                  PiVector newElem)
        Copy new vertex indices to element at specified position in the element list. Number of elements is increased if required.
        Specified by:
        setElement in interface PgGeometryIf
        Overrides:
        setElement in class PgGeometry
        Parameters:
        ind - index of element
        newElem - vector with new indices of element
        Returns:
        boolean false, if element and array have different
      • setNeighbour

        public boolean setNeighbour(int ind,
                                    PiVector newNeigh)
        Set neighbour elements of given element. Index must be a valid element index, and length of neighbour entries must be equal to size of specified element.

        Usually, an applications calls makeNeighbour() instead of calling this low level method. This method is provided for efficiency.

        Parameters:
        ind - index of element
        newNeigh - vector with indices of neighbour elements
        Returns:
        boolean false, if element and array have different
        Since:
        JavaView 3.24.001
        Version:
        16.05.04, 1.00 created (kp)
      • setElementColor

        public boolean setElementColor(int ind,
                                       java.awt.Color aColor)
        Copy new color to element color at specified position in the color list
        Parameters:
        ind - index of element
        aColor - color to be copied to color list
        Returns:
        boolean false, if index out of range, or argument missing
        Version:
        24.02.01, 1.10 revised (kp) Invoke assureElement...() only if destination array too small.
      • setElementBackColor

        public boolean setElementBackColor(int ind,
                                           java.awt.Color aColor)
        Copy new color to element color at specified position in the color list
        Parameters:
        ind - index of element
        aColor - color to be copied to color list
        Returns:
        boolean false, if index out of range, or argument missing
        Version:
        24.02.01, 1.10 revised (kp) Invoke assureElement...() only if destination array too small.
      • setElementNormal

        public boolean setElementNormal(int ind,
                                        PdVector aNormal)
        Copy new normal to element normal at specified position in the normal list
        Parameters:
        ind - index of element
        aNormal - normal to be copied to normal list
        Returns:
        boolean false, if index out of range, or argument missing
        Version:
        24.02.01, 1.10 revised (kp) Invoke assureElement...() only if destination array too small.
      • setElementTexture

        public boolean setElementTexture(int ind,
                                         PdVector[] aTexture)
        Copy new texture coordinates to element texture at specified position in the element texture list
        Parameters:
        ind - index of element
        aTexture - array with texture coordinates to be copied
        Returns:
        boolean false, if index out of range, or argument missing
        Version:
        24.02.01, 1.10 revised (kp) Invoke assureElement...() only if destination array too small.
      • 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().

        Appearance of elements with 2 or less vertices should be avoid. They lead to a setting of m_dimOfElements=2.

        Parameters:
        element - array of element vectors to be copied
        Version:
        09.11.02, 2.00 revised (kp) Full revision handling elements with 2 or less vertices.
        24.02.01, 1.10 revised (kp) Call assureNeighbours() only if new value of m_dimOfElements==1.
      • removeElementColors

        public void removeElementColors()
        Remove local element colors from a geometry and use global element color instead.

        Showing of element colors must be switched off explicitly using showElementColors(boolean).

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

        Showing of element colors must be switched on in order to be visible.

        Parameters:
        color - array with new element colors
      • removeElementBackColors

        public void removeElementBackColors()
        Remove local backface element colors from a geometry and use global backface element color instead.

        Showing of backface element colors must be switched off explicitly using showElementBackColor(boolean).

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

        Showing of back element colors must be switched on in order to be visible.

        Parameters:
        color - array with new element colors
      • removeElementNormals

        public void removeElementNormals()
        Remove element normals from a geometry.

        Showing of element normals must be switched off explicitly using showElementColors(boolean).

      • 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.

        Showing of element normals must be switched on in order to be visible.

        Parameters:
        normal - array with new element normals
      • setElementTextures

        public void setElementTextures(PdVector[][] texCoords)
        Use the given textures coordinates as element-based texture coordinates. 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.

        Showing of textures must be switched on in order to be visible.

        Parameters:
        texCoords - array with new element textures
        See Also:
        setElementTexturesFromList(PdVector [])
      • setElementTexturesFromList

        public void setElementTexturesFromList(PdVector[] texCoords)
        Use the given textures coordinates as element-based texture coordinates. Length of argument list must be equal or larger than getNumElementIndices(). All textures coordinates are copied. The dimension of all argument texture vectors must be equal to getDimOfTextures() of the geometry.

        In contrast to the method setElementTextures(PdVector [][]) the texture coordinates of the double vector are simply linearized, that means, if the first element has n-vertices, then the first n-textures coordinates are used as texture coordinates of this element.

        Showing of textures must be switched on in order to be visible.

        Parameters:
        texCoords - array with new element textures
        Since:
        JavaView 2.45
        See Also:
        setElementTextures(PdVector [][])
        Version:
        09.11.02, 1.00 created (kp)
      • removeTexture

        public void removeTexture()
        Remove all texture information from surface and switch off showing of texture. Removes texture image and texture coordinates from elements and vertices both.
        Overrides:
        removeTexture in class PgPointSet
        Version:
        25.01.02, 1.00 created (kp)
      • 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 - index of first vertex of an element edge, not local indices
        wInd - index of second vertex of 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)
        Author:
        Konrad Polthier
        Version:
        03.09.99, 2.00 revised (kp) Renamed from getOtherVertexLocInd().
        11.04.99, 1.50 revised (kp) otherVertex redefined to allow general polygons, nothing changed in case of triangles. See documentation above.
        12.12.97, 1.00 created (kp)
      • 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)
        Author:
        Konrad Polthier
        Version:
        01.10.00, 1.10 revised (kp) Check if element edge is boundary.
        14.01.00, 1.00 created (kp)
      • 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.

        Returns -2 in case of bug in neighbourhood. Use makeNeighbour() to create a new neighbourhood.

        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)
        Author:
        Konrad Polthier
        Version:
        15.05.04, 1.90 revised (kp) Return -2 in case of error in neighbourhood.
        28.05.02, 1.80 revised (kp) Compare vertex indices of edge too if reference to element is found.
        11.04.99, 1.50 revised (kp) otherVertex redefined to allow general polygons, nothing changed in case of triangles. See documentation above.
        12.12.97, 1.00 created (kp)
      • getAreaOfElement

        public double getAreaOfElement(int elemInd)
        Compute area of polyhedral element with given index.
        Author:
        Konrad Polthier
        Version:
        12.12.97, 1.00 revised (kp)
        12.12.97, 1.00 created (kp)
      • getArea

        public double getArea()
        Compute total area of polyhedral surface.
        Author:
        Konrad Polthier
        Version:
        12.12.97, 1.00 revised (kp)
        12.12.97, 1.00 created (kp)
      • getVolumeOfElement

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

        A sphere with positively oriented triangles such that normals point outward will have a positive volume.

        Author:
        Konrad Polthier
        Version:
        04.09.02, 1.10 revised (kp) Sign of volume added.
        12.12.97, 1.00 created (kp)
      • 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.
        Author:
        Konrad Polthier
        Version:
        12.12.97, 1.00 revised (kp)
        12.12.97, 1.00 created (kp)
      • getL2Norm

        public double getL2Norm()
        Compute L2 norm of identity map of element set. Elements are temporarily triangulated if they have more than three vertices.
        Author:
        Konrad Polthier
        Version:
        21.07.99, 1.00 revised (kp)
        21.07.99, 1.00 created (kp)
      • getL2Matrix

        public PdMatrix getL2Matrix(PdMatrix mat)
        Compute L2 matrix S such that L2-norm(u)^2 = u*S*u. Elements must be triangulated.
        Author:
        Konrad Polthier
        Version:
        25.10.02, 1.01 revised (kp) Use m_dim.
        21.07.99, 1.00 created (kp)
      • getEdgeLength

        public double getEdgeLength(int elemInd,
                                    int locInd)
        Compute length of element 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
        Author:
        Konrad Polthier
        Version:
        24.06.99, 1.01 revised (kp) Adjusted to element sizes larger than 3
        12.12.97, 1.00 created (kp)
      • getVertexAngle

        public double getVertexAngle(int elemInd,
                                     int locInd)
        Compute the element angle specified by element index and local vertex index.
        Parameters:
        elemInd - index of element
        locInd - local index of vertex
        Returns:
        angle between edges at vertex
        Author:
        Konrad Polthier
        Version:
        24.06.99, 1.01 revised (kp) Adjusted to element sizes larger than 3
        12.12.97, 1.00 created (kp)
      • 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:
        meridian - meridian given as polygon
        numULines - discretization in angular direction
      • computeCone

        public void computeCone(int numULines,
                                int numVLines,
                                double bottomRadius,
                                double height)
        Generate cone in z-direction centered at the origin with given bottom radius and height. 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:
        computeCone in class PgPointSet
        Parameters:
        numULines - discretization in angular direction
        numVLines - discretization in z-axis direction
        bottomRadius - radius of bottom disk of cone
        height - height of cone from bottom disk to tip
        Version:
        29.12.03, 1.00 created (kp)
      • computeCylinder

        public void computeCylinder(int numULines,
                                    int numVLines,
                                    double radius,
                                    double length)
        Generate cylinder in z-direction centered at the origin 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 - u coordinate of lower left corner of rectangle
        vMin - v coordinate of lower left corner of rectangle
        uMax - u coordinate of upper right corner of rectangle
        vMax - v coordinate of upper right corner 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 soul 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 soul
        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
      • getNumBoundaryEdges

        public int getNumBoundaryEdges()
        Calculate number of boundary edges of a manifold surface using m_neighbour information. This number may be different from number of boundary components and number of boundary segments.

        If surface is non-manifold and neighbour information is not correct then this method may determine a wrong number of boundary edges.

        Returns:
        number of boundary edges
        See Also:
        getNumBoundaries(), getNumEdges()
        Author:
        Konrad Polthier
        Version:
        16.09.98, 1.00 revised (kp)
        16.09.98, 1.00 created (kp)
      • getNumEdges

        public int getNumEdges()
        Calculate number of edges of a manifold surface using m_neighbour information.

        If neighbour information is missing, then each element edge is counted. Algorithm runs once over all elements and counts an edge if the index of the adjacent element is smaller than the index of the current element.

        If surface is non-manifold and neighbour information is not correct then this method may determine a wrong number of edges.

        See also getNumEdges() which returns the number of edges of the underlying simplicial complex. Note, getNumEdgeStars() will return 0 if no edgeStars are allocated while getNumEdges() always returns a number related to the simplicial complex. Use getNumEdgesStars() when working with edgeStar array, and use getNumEdges() in combinatorial calculations.

        Returns:
        number of edges
        See Also:
        getNumEdgeStars(), getNumBoundaryEdges()
        Author:
        Konrad Polthier
        Version:
        31.12.97, 1.00 created (kp)
      • 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.
        Author:
        Konrad Polthier
        Version:
        19.04.00, 1.00 revised (kp)
        19.04.00, 1.00 created (kp)
      • 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.
        Author:
        Konrad Polthier
        Version:
        15.05.06, 1.30 revised (kp) Better check if neighbour has not been allocated.
        03.09.99, 1.20 revised (kp) Added switch for handling non-conforming elementSets.
        30.07.99, 1.10 revised (kp) Method failed on elements with different lengths.
        21.05.99, 1.00 created (kp)
      • getNumBoundaryVertices

        public int getNumBoundaryVertices()
        Count number of boundary vertices assuming boundary vertices have been previously marked.
        See Also:
        markBoundary()
        Author:
        Konrad Polthier
        Version:
        21.05.99, 1.00 revised (kp)
        21.05.99, 1.00 created (kp)
      • blend

        public boolean blend(double s,
                             PgGeometry ag,
                             double t,
                             PgGeometry bg)
        Blend between two element sets, used in interpolation and computing the associate surfaces this = s*ag + t*bg.
        Specified by:
        blend in interface PgGeometryIf
        Overrides:
        blend in class PgPointSet
        Parameters:
        s - weight of vertices of first geometry
        ag - first geometry used for blending
        t - weight of vertices of second geometry
        bg - second geometry used for blending
        Returns:
        true on success
        Author:
        Konrad Polthier
        Version:
        08.07.06, 2.50 revised (kp) Handling of edges implemented.
        10.03.02, 2.10 revised (kp) Interpolation of vector fields implemented.
        10.11.01, 2.00 revised (kp) Interpolation of material properties enabled.
        30.12.97, 1.00 created (kp)
      • 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(PdVector [], int).
        Parameters:
        geom - Surface with polygonal faces. Modified after this calling method.
        Returns:
        true on success
        See Also:
        PgUtil.triangulate(PdVector [], int)
        Author:
        Konrad Polthier
        Version:
        13.08.07, 1.91 revised (fk) Add argument check.
        , 20.01.05, 1.90 revised (kp) Copy tags and labels of patch to subtriangles.
        16.05.04, 1.80 revised (kp) Recompute normals if they exist.
        25.09.01, 1.70 revised (ur) Store new element textures before storing global indices for new triangles.
        02.03.01, 1.60 revised (kp) Assign element normals and backface element colors to children.
        12.02.01, 1.50 revised (kp) Element normals no longer needed for triangulation algorithm.
        21.11.00, 1.40 revised (ur) Adjust element textures added.
        15.11.00, 1.30 revised (kp) Removed bnd if method fails while updating the bnd.
        07.11.00, 1.20 revised (ur) use element colors of parent elements for new triangles.
        09.06.00. 1.10 revised (ep) Ensure correct maxNumElements.
        05.07.98, 1.00 created (kp)
      • checkNeighbour

        public boolean checkNeighbour()
        Deprecated. use checkNeighbour(boolean) instead.
        Check correct neighbour connectivity.
      • checkNeighbour

        public boolean checkNeighbour(boolean bMessage)
        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 element
                        - it and its neighbour join an edge with common vertices.
         
        Parameters:
        bMessage - Flag to send a message to the console.
        Returns:
        true if neighbour connectivity is correct
        Author:
        Konrad Polthier
        Version:
        17.12.08, 1.20 revised (ur) Don't generate message text if sending message is switched off.
        28.01.02, 1.10 revised (ur) Flag added to avoid the message to console.
        31.01.00, 1.01 revised (kp) Allow reference of adjacent elements even if differently oriented.
        31.10.98, 1.00 created (kp)
      • intersectionWithLine

        public PvPickEvent intersectionWithLine(PdVector rayBaseWorld,
                                                PdVector rayDirWorld)
        Find intersection of element set with a given ray. Method is used for interactive picking. Base and direction of ray must be given in 3D world coordinates.
        Specified by:
        intersectionWithLine in interface PgGeometryIf
        Overrides:
        intersectionWithLine in class PgPointSet
        Parameters:
        rayBaseWorld - 3D base point of ray eventually hitting the surface.
        rayDirWorld - 3D direction vector of ray eventually hitting the surface.
        Returns:
        full information about hit element, barycentric coordinates etc.
        Author:
        Konrad Polthier
        Version:
        04.09.06, 2.31 revised (kp) Bary now contains element index.
        01.04.06, 2.30 revised (kp) Conversion of world to model coordinate move to this method from PvDisplay.
        15.02.05, 2.20 revised (kp) Use horizontal distance, diameter constraint removed.
        25.03.01, 2.10 revised (kp) Use point on geometry as vertex, use rayBase as viewBase.
        04.03.01, 2.00 revised (kp) Rewritten intersectionWithLine() to handle vertices in dim 2 and 3.
        02.12.00, 1.10 revised (kp) Use minDist as distance, use rayBase as vertex.
        04.10.99, 1.00 created (kp)
      • 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.
        Author:
        Konrad Polthier
        Version:
        27.09.01, 1.10 revised (kp) Correct if vertex dimension larger than three.
        22.08.00, 1.00 created (kp)
      • makeElementColorsFromZ

        public boolean makeElementColorsFromZ()
        Create color from the vertical z-height within its bounding box ranging from low blue to high red. If dimension of vertices is smaller than three then the highest vertex component are used instead of the z-component in the color computation.
        Author:
        Konrad Polthier
        Version:
        16.04.05, 1.20 revised (kp) Both colors flipped to better sync with Maple.
        27.09.01, 1.10 revised (kp) Correct if vertex dimension larger than three.
        22.08.00, 1.00 created (kp)
      • 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.
        Author:
        Konrad Polthier
        Version:
        17.04.05, 1.20 revised (kp) Expand color spectrum to [magenta,red] from [blue,red].
        27.09.01, 1.10 revised (kp) Correct if vertex dimension larger than three.
        22.08.00, 1.00 created (kp)
      • makeElementColorsFromNormal

        public boolean makeElementColorsFromNormal()
        Create color from the element normals interpreted as RGB values. If dimension of vertices is smaller than three then the color wheel or stick is used.
        Author:
        Konrad Polthier
        Version:
        14.03.14, 1.00 created (kp)
      • makeElementFromVertexColors

        public boolean makeElementFromVertexColors()
        Create element colors as average of all colors of its vertices. Vertex colors must be available.
        Author:
        Konrad Polthier
        Version:
        18.03.01, 1.00 created (kp)
      • makeVertexFromElementColors

        public boolean makeVertexFromElementColors()
        Create vertex colors as average of individual color of all adjacent elements. Local element colors must be available.
        Author:
        Konrad Polthier
        Version:
        18.03.01, 1.00 created (kp)
      • makeElementFromVertexTexture

        public boolean makeElementFromVertexTexture()
        Create element textures from vertex textures and remove vertex textures. Vertex textures must be available.
        Author:
        Ulrich Reitebuch
        Version:
        23.04.05, 1.10 revised (kp) Remove vertex textures after conversion.
        04.12.01, 1.00 created (ur)
      • 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.
        Specified by:
        reflect in interface PgGeometryIf
        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
        Returns:
        new reflected copy of the geometry
        Author:
        Konrad Polthier
        Version:
        20.03.01, 1.20 revised (kp) Neighbour array of reflected geometry corrected.
        12.12.00, 1.10 revised (kp) Additional argument added for orientation of vectors.
        16.11.00, 1.00 created (kp)
      • resetBoundaryNormals

        public boolean resetBoundaryNormals()
        Remove boundary vertex normal. Often boundary vertex normals can not be determined correctly. This method allows to reset these normal to zero. The boundary is determined from the neighbour information.
        Returns:
        false if vertex normals are missing
        Author:
        Konrad Polthier
        Version:
        29.05.01, 1.00 revised (kp)
        29.05.01, 1.00 created (kp)
      • getFVector

        public int[] getFVector()
        Compute F-vector which shows the number of points, edges, faces, etc.

        Note, the number of vertices may include some vertices which are not referenced by elements. The number of unused vertices must be subtracted from the number of vertices found in the F-vector when computing the Euler characteristic.

        Overrides:
        getFVector in class PgPointSet
        Version:
        20.12.01, 1.10 revised (kp) Renamed to getFVector() from getEulerNumbers().
        04.11.01, 1.00 created (kp)
      • getCenterOfElement

        public PdVector getCenterOfElement(PdVector center,
                                           int e)
        Compute the barycenter of a geometry element.
        Parameters:
        center - Buffer for the center. May be null.
        e - Index of the element.
        Returns:
        Argument center is filled with the position of the barycenter.
        Version:
        22.06.09, 1.00 created (mn)
"JavaView? v5.03.003"

"

The software JavaView? is copyright protected. All Rights Reserved.
"

Ads help maintain this website.