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

Class PgPolygonSet

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, PsUpdateIf, PgGeometryIf
    Direct Known Subclasses:
    PgPolygonSetOnElementSet


    public class PgPolygonSet
    extends PgPointSet
    Basic class for collections of lines and polygons. The class contains an array with polygons, each polygon is given by a list of vertex indices in the vertex array of its superclass PgPointSet. Each polygon may have a different number of vertices.

    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 polygon may be the same for all polygons of the polygon set, and assigned using the method setDimOfPolygons(int num). Or, the size of polygons may differ in which case getDimOfPolygons()==-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 polygons, for example,

            setNumPolygons(int num)
     
    allocates num polygons. 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 polygons is changed, the class automatically adjusts the size of those polygon properties which are currently in use, i.e. whose array is not null.

    Applications may modify the entries of an polygon and of polygon properties by direct method calls such as

            setPolygon(int ind, PiVector v)
     
    which sets the polygon with index ind equal to the components of a vector v by copying. Alternatively, if an application modifies a larger number of polygons then the application may prefer to obtain the polygon array from the polygon set and directly modify the array
            PiVector [] polygon = polygonSet.getPolygons();
            for (int i=0; i<pointSet.getNumPolygons(); i++)
                    polygon[i].copy(v);
     
    The same choice is available for arrays containing polygon properties. Note, that the actual size of the polygon array may be larger than m_numPolygons efficiency reasons. Therefore, do not use polygon.length but use getNumPolygons().

    This class contains mainly basic methods for memory allocation and access to instance variables. Geometric methods operating on polygon 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 PgPolygon.computeEight(int) (if source code access to JavaView is available), or the tutorial applets of JavaView.

    See Also:
    Serialized Form
    Author:
    Konrad Polthier
    Version:
    22.09.15, 2.90 revised (kp) Getting and setting of smooth edge colors corrected.
    18.04.10, 2.80 revised (kp) Instance sharing implemented.
    11.07.02, 2.70 revised (kp) Explicit methods for removal of colors and normals added.
    22.03.02, 2.60 revised (ur) Internationalization.
    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.
    04.10.99, 1.10 revised (ur) m_dimOfPolygons added.
    23.09.99, 1.00 created (kp)
    • Constructor Detail

      • PgPolygonSet

        public PgPolygonSet()
        Constructor of a polygon set in three-dimensional space.
      • PgPolygonSet

        public PgPolygonSet(int aVertexDim)
        Constructor of a polygon set in a space of given dimension.
    • Method Detail

      • init

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

        public PgJvxSrc getJvx()
        Fills a geometry object with data from this instance, for example, to print to file.
        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.
        Specified by:
        setJvx in interface PgGeometryIf
        Overrides:
        setJvx in class PgPointSet
        Parameters:
        src - a geometry source used to fill this instance with data.
      • clone

        public java.lang.Object clone()
        Duplicate geometry by recursively cloning all instance variables except inspector panels and lists of registered listeners. The parent relationship is maintained only within this class but not to external classes. In general, all links of the clone to external objects are set to null.
        Specified by:
        clone in interface PgGeometryIf
        Overrides:
        clone in class PgPointSet
        See Also:
        copy(PsObject)
        Version:
        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.
      • copyPolygonSet

        public void copyPolygonSet(PgPolygonSet geom)
        Copy instance variables of this class but not of the superclass.
        Version:
        24.01.05, 1.10 revised (kp) Copy polygon sizes.
      • 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
      • 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)
      • getGlobalPolygonColor

        public java.awt.Color getGlobalPolygonColor()
        Get global polygon color which is used if no local colors are available.
      • getGlobalPolygonTagColor

        public java.awt.Color getGlobalPolygonTagColor()
        Get global color of tagged polygons.
      • getGlobalPolygonSize

        public double getGlobalPolygonSize()
        Get thickness in pixels of polygon when drawn in display.
      • getGlobalPolygonNormalColor

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

        public double getGlobalPolygonNormalLength()
        Get length factor of normal vectors when drawn in display.
      • getGlobalPolygonNormalSize

        public double getGlobalPolygonNormalSize()
        Get thickness in pixels of normals when drawn in display.
      • setGlobalPolygonColor

        public void setGlobalPolygonColor(java.awt.Color color)
        Set global polygon color to be used if no local colors are available.
      • setGlobalPolygonTagColor

        public void setGlobalPolygonTagColor(java.awt.Color color)
        Set global color of tagged polygons.
      • setGlobalPolygonSize

        public void setGlobalPolygonSize(double size)
        Set thickness in pixels of polygon when drawn in display.
      • setGlobalPolygonNormalColor

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

        public void setGlobalPolygonNormalLength(double length)
        Get length factor of normal vectors when drawn in display.
      • setGlobalPolygonNormalSize

        public void setGlobalPolygonNormalSize(double size)
        Get thickness in pixels of normals when drawn in display.
      • addPolygon

        public int addPolygon(PiVector poly)
        Add new polygon to the end of the polygon list. Method just calls setPolygon(numPolygons, PiVector).
        Specified by:
        addPolygon in interface PgGeometryIf
        Overrides:
        addPolygon in class PgGeometry
        Parameters:
        poly - polygon to be added to polygon list
        Returns:
        index of added polygon in polygon list
        Version:
        17.07.02, 2.20 revised (kp) Increase total size by 20 percent.
        12.10.00, 2.10 revised (ep) First set correct number of polygons then call method setPolygon(...).
        07.07.00, 2.00 revised (kp) Method addPolygon(PiVector,int) removed since insert should also move other instance variables.
        27.08.99, 1.00 created (sk)
      • getPolygons

        public PiVector[] getPolygons()
        Get polygon array for read and write access. Also note, that the actual size of the array may be larger than m_numPolygons for efficiency reasons. Therefore, do not use length of array.
      • getPolygonColors

        public java.awt.Color[] getPolygonColors()
        Get color array for read and write access, but do not modify the size of any color vector.
      • getPolygonNormals

        public PdVector[] getPolygonNormals()
        Get polygon normal array for read and write access, but do not modify the size of any normal vector.
      • getPolygonSizes

        public PdVector getPolygonSizes()
        Get polygon size array for read and write access.
      • isShowingEdgeLabels

        public boolean isShowingEdgeLabels()
        Determine whether showing of edge labels is enabled.
      • isShowingPolygonLabels

        public boolean isShowingPolygonLabels()
        Determine whether showing of polygon labels is enabled.
      • isShowingPolygons

        public boolean isShowingPolygons()
        Set flag to enable drawing of polygons.
      • isShowingPolygonColors

        public boolean isShowingPolygonColors()
        Set flag to enable drawing of polygon colors.
      • isShowingPolygonNormals

        public boolean isShowingPolygonNormals()
        Set flag to enable drawing of polygon normals.
      • isShowingPolygonSizes

        public boolean isShowingPolygonSizes()
        Set flag to enable usage of polygon sizes.
      • isShowingPolygonNormalArrow

        public boolean isShowingPolygonNormalArrow()
        Determines whether drawing of arrow of polygon normals is enabled.
      • isShowingPolygonStartArrow

        public boolean isShowingPolygonStartArrow()
        Determines whether drawing of arrow at first point of polygon is enabled.
      • isShowingPolygonEndArrow

        public boolean isShowingPolygonEndArrow()
        Determines whether drawing of arrow at last point of polygon is enabled.
      • isShowingTaggedPolygons

        public boolean isShowingTaggedPolygons()
        Determine whether showing of tagged polygons is enabled.
      • showTaggedPolygons

        public void showTaggedPolygons(boolean flag)
        Set flag to enable drawing of tagged polygons.
      • showEdgeLabels

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

        public void showPolygonLabels(boolean flag)
        Set flag to enable drawing of polygon labels in display.
      • showPolygons

        public void showPolygons(boolean flag)
        Set flag to enable drawing of polygons.
      • showPolygonColors

        public void showPolygonColors(boolean flag)
        Set flag to enable drawing of polygon colors.
      • showPolygonNormals

        public void showPolygonNormals(boolean flag)
        Set flag to enable drawing of polygon normals.
      • showPolygonSizes

        public void showPolygonSizes(boolean flag)
        Set flag to enable usage of individual polygon sizes.
      • showPolygonNormalArrow

        public void showPolygonNormalArrow(boolean flag)
        Set flag to enable drawing of arrow of polygon normal.
      • showPolygonStartArrow

        public void showPolygonStartArrow(boolean flag)
        Set flag to enable drawing of arrow at first point of polygons.
      • showPolygonEndArrow

        public void showPolygonEndArrow(boolean flag)
        Set flag to enable drawing of arrow at last point of polygons.
      • useGlobalPolygonColor

        public void useGlobalPolygonColor(boolean flag)
        Deprecated. use showPolygonColors(boolean)
        Set flag of using global polygon color instead of coloring each polygon individually.
      • getMaxNumPolygons

        public int getMaxNumPolygons()
        Get total length of allocated polygon array. Usually, only a subset is filled with data. Method is for internal use, see getNumPolygons() for daily work.
      • setMaxNumPolygons

        public void setMaxNumPolygons(int numPolygons)
        Allocate given number of polygons, and allocate normals, colors etc. if they already exist. All polygon 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 setNumPolygons().
        Version:
        18.04.10, 2.10 revised (kp) Call assure-methods to sync with PgElementSet and remove duplicate allocation code.
        18.04.10, 2.10 revised (kp) Instance sharing implemented.
        14.03.06, 2.00 revised (kp) Method made public to allow better control of allocations.
      • getNumPolygons

        public int getNumPolygons()
        Get number of polygons in vertex array. Note, that the actual size of the polygon array may be larger for efficiency reasons. Therefore, do not use m_polygon.length.
      • setNumPolygons

        public void setNumPolygons(int numPolygons)
        Allocate given number of polygons, and allocate normals, colors etc. if they already exist. Internally, there may exist more polygons than requested serving as buffer and to reduce allocation times.
        Version:
        18.04.10, 1.80 revised (kp) Invocation of setMaxNumPolygon adjusted to PgElementSet#setNumElements.
        11.12.04, 1.70 revised (kp) No longer update dimOfPolygons if numPolygons is reduced.
        05.08.04, 1.60 revised (kp) No action if same number is requested.
        28.06.03, 1.50 revised (kp) Update dimOfPolygons when numPolygons is reduced.
      • setSizeOfPolygon

        public void setSizeOfPolygon(int ind,
                                     int aSize)
        Set number of vertices of a specific polygon. Polygon must exist already, and index of polygon must be in range [0,m_numPolygons-1]. Method may modify instance variable m_dimOfPolygons.
        Parameters:
        ind - Index of polygon.
        aSize - Number of vertices given polygon.
        See Also:
        setNumPolygons(int)
        Version:
        30.03.01 1.50 revised (kp) Synchronized with PgElementSet#setDimOfElement(int).
        04.10.99 1.10 revised (kp) Now run until maxNumPolygons when changing dim.
        04.10.99 1.00 created (kp)
      • 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)
      • setDimOfPolygons

        public void setDimOfPolygons(int aSize)
        Let all polygons have same number of vertices aSize!=0, or individual aSize=-1. It is more efficient to call method before setNumPolygons().
        Parameters:
        aSize - Number of vertices for all polygons.
        See Also:
        setNumPolygons(int)
        Version:
        30.03.01 1.50 revised (kp) Synchronized with PgElementSet#setDimOfElements.
        04.10.99 1.10 revised (kp) Now run until maxNumPolygons when changing dim.
        04.10.99 1.00 created (kp)
      • getMaxDimOfPolygons

        public int getMaxDimOfPolygons()
        Get maximal number of vertices appearing in a polygon. Method returns the same value as getDimOfPolygons() if all polygons have the same size.
        Since:
        JavaView 2.84.000
        See Also:
        getDimOfPolygons()
        Version:
        28.06.03, 1.00 created (kp)
      • getDimOfPolygons

        public int getDimOfPolygons()
        Retrieve number of vertices per polygon, if it is the same for all polygons, otherwise return -1. Note: this check does not include the size of polygons with index in {m_numPolygons, m_maxNumPolygons-1}.
        See Also:
        setDimOfPolygons(int)
      • assureDimOfPolygons

        public boolean assureDimOfPolygons()
        Assure correctness of value m_dimOfPolygons specifying the number of vertices per polygon.
        Returns:
        true if m_dimOfPolygons had the correct value. Note: this check does not include the size of polygons with index in {m_numPolygons, m_maxNumPolygons-1}.
        See Also:
        setDimOfPolygons(int)
      • 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.
      • hasPolygonColors

        public boolean hasPolygonColors()
        Check if polygon colors have been allocated.
        See Also:
        assurePolygonColors()
      • hasPolygonNormals

        public boolean hasPolygonNormals()
        Check if polygon normals have been allocated.
        See Also:
        assurePolygonNormals()
      • hasPolygonSizes

        public boolean hasPolygonSizes()
        Check if polygon sizes have been allocated.
        See Also:
        assurePolygonSizes()
      • assurePolygonColors

        public void assurePolygonColors()
        Assures respectively allocates correct length of polygon color array. Length of array is equal to length of polygon array.
      • assurePolygonNormals

        public void assurePolygonNormals()
        Assures respectively allocates correct length of polygon normal array. Length of array is equal to length of polygon array. Dimension of normal vectors is equal to dimension of vertices.
      • assurePolygonSizes

        public void assurePolygonSizes()
        Assures respectively allocates correct length of polygon size vector. Length of vector is equal to length of polygon array. Dimension of size vector is equal to maximal number of vertices.
        Since:
        JavaView 3.09
        Version:
        07.02.04, 1.00 created (kp)
      • removeMarkedVertices

        public int[] removeMarkedVertices()
        Remove vertices marked with tag PsObject#IS_DELETED from polygons. It is neccessary to keep a valid polygon set after removal of vertices in the superclass.

        Polygons with no or one remaining vertex are removed.

        Overrides:
        removeMarkedVertices in class PgPointSet
        Returns:
        array with indices of new positions of vertices
        See Also:
        PgPointSet.removeMarkedVertices()
        Version:
        17.11.00, 1.10 revised (kp) Remove polygons with less than two vertices.
        20.07.00, 1.00 created (kp) From PgElementSet#removeMarkedVertices().
      • removePolygon

        public int[] removePolygon(int ind)
        Remove polygon with given index, and decrement index of all polygons with higher index. Method just marks polygon with tag PsObject.IS_DELETED and invokes removeMarkedPolygons().
        Specified by:
        removePolygon in interface PgGeometryIf
        Overrides:
        removePolygon in class PgGeometry
        Parameters:
        ind - index of polygon to be removed
        Returns:
        array with indices of new positions of polygons
        Author:
        Konrad Polthier
        Version:
        20.07.00, 1.00 revised (kp)
        20.07.00, 1.00 created (kp) From PgElementSet#removeElement(int).
      • removeMarkedPolygons

        public int[] removeMarkedPolygons()
        Remove all polygons which have been marked PsObject.IS_DELETED. First, the method computes where each polygon is moved to, then all polygon data is moved and the references to the polygon in bnd curves is changed. This routine is O(n).

        Method assumes that there exist no references to marked polygons. Otherwise application of this method would lead to unpredictable results.

        Returns:
        array with indices of new positions of polygons
        Author:
        Konrad Polthier
        Version:
        22.04.17, 1.20 revised (kp) Missing update of m_polygonSize added.
        19.01.05, 1.10 revised (kp) Remove affected vectors from vectorFields.
        20.07.00, 1.00 created (kp) From PgElementSet#removeMarkedElements().
      • removeUnusedVertices

        public boolean removeUnusedVertices()
        Remove all points not referenced by polygons. 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:
        19.01.05, 1.10 revised (kp) Remove affected vectors from vectorFields.
        23.09.99, 1.00 created (kp)
      • merge

        public boolean merge(PgGeometryIf aGeom)
        Merge polygon set with current object and store union of both objects in 'this'. Number of points and polygons is the sum of both objects.

        The merged geometry will local colors allocated and assignd 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 - Polygon set to be merged into 'this'
        Returns:
        true if method was successfull
        Author:
        Konrad Polthier
        Version:
        12.09.02, 1.20 revised (kp) Merging of colors revised.
        22.07.00, 1.10 revised (kp) Argument changed to class PgGeometryIf.
        01.06.99, 1.01 revised (kp) Added missing assurePolygonNormals(), -Colors()
        10.12.97, 1.00 created (kp)
      • getPolygonWithVertex

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

        public PdVector[] getPolygonVertices(int ind)
        Get an array with pointers to all vertices of an polygon. Vertices appear in the array in the same order as in the polygon.
        Returns:
        Array with vertices, or null if vertices are not available.
        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)
      • getPolygon

        public PiVector getPolygon(int ind)
        Get a reference to an individual polygon array with vertex indices.
        Specified by:
        getPolygon in interface PgGeometryIf
        Overrides:
        getPolygon in class PgGeometry
        Parameters:
        ind - index of polygon to be returned
        Returns:
        Vector with indices, or null if index out of range.
      • getPolygonAsPgPolygon

        public PgPolygon getPolygonAsPgPolygon(int polyId)
        Get the specified polygon from a polygon set as PgPolygon. TODO: The missing material properties should be copied to the new polygon.
        Author:
        Matthias Nieser
        Version:
        18.10.06, 1.00 created (mn)
      • setPolygonVertices

        public boolean setPolygonVertices(int ind,
                                          PdVector[] vArray)
        Copy new polygon vertices to polygon at specified position in the polygon list. Destination polygon must already exists.
        Parameters:
        ind - index of polygon
        vArray - array with new coordinates of polygon vertices
        Returns:
        boolean false, if index out of range, or argument missing
      • setPolygon

        public void setPolygon(int ind,
                               int a,
                               int b)
        Copy new vertex indices to polygon at specified position in the polygon list. Number of polygons is increased if required. Dimension of polygons is adjusted if necessary.
        Parameters:
        ind - index of polygon
        a - index of first vertex of new polygon edge
        b - index of second vertex of new polygon edge
        Version:
        30.03.01, 1.00 created (kp)
      • setPolygon

        public boolean setPolygon(int ind,
                                  PiVector aPolygon)
        Set index vector of polygon with given index. Copy new polygon to polygon at specified position in the polygon list. Number of polygons is increased if required. Size of polygon is adjusted if too small or too large.
        Specified by:
        setPolygon in interface PgGeometryIf
        Overrides:
        setPolygon in class PgGeometry
        Parameters:
        ind - index of polygon
        aPolygon - array with indices of new polygon
        Returns:
        false, if index out of range, or argument missing
      • getPolygonColor

        public java.awt.Color getPolygonColor(int ind)
        Get a reference to an individual polygon color.
        Returns:
        Vector with indices, or null if index out of range.
      • setPolygonColor

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

        public PdVector getPolygonNormal(int ind)
        Get a reference to an individual polygon normal.
        Returns:
        Vector with indices, or null if index out of range.
      • setPolygonNormal

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

        public double getPolygonSize(int ind)
        Get size of a single polygon.
        Returns:
        Thickness of specified polygon.
      • removePolygonSizes

        public void removePolygonSizes()
        Remove polygon sizes from a geometry.

        Showing of polygon sizes must be switched off explicitly using showPolygonSizes(boolean).

        Since:
        JavaView 3.09
        Version:
        07.02.04, 1.00 created (kp)
      • setPolygonSize

        public boolean setPolygonSize(int ind,
                                      double size)
        Set the thickness of the given polygon.
        Parameters:
        ind - index of polygon
        size - thickness of polygon
        Returns:
        false, if index out of range, or argument missing
      • setPolygonSizes

        public void setPolygonSizes(PdVector size)
        Copy polygon sizes of list to existing array of polygon sizes. Length of argument list must be equal or larger than getNumPolygons(). All polygon sizes are copied.

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

        Parameters:
        size - array with new polygon size for all polygons
        Since:
        JavaView 3.09
        Version:
        07.02.04, 1.00 created (kp)
      • setPolygons

        public void setPolygons(PiVector[] polygon)
        Copy all polygons of polygon list to existing array of polygons. Length of argument polygon list must be equal or larger than getNumPolygons(). All polygons are copied.
        Parameters:
        polygon - array with new polygons
        Version:
        12.01.05, 1.10 revised (ur) Set dimension of polygons to detected common size.
        07.02.04, 1.00 created (kp)
      • removePolygonColors

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

        Showing of polygon colors must be switched off explicitly using showPolygonColors(boolean).

      • setPolygonColors

        public void setPolygonColors(java.awt.Color[] color)
        Copy polygon colors of list to existing array of polygon colors. Length of argument list must be equal or larger than getNumPolygons(). All polygon colors are copied. The dimension of all argument colors must be equal to getDimOfColors() of the geometry.
        Parameters:
        color - array with new polygon colors
      • removePolygonNormals

        public void removePolygonNormals()
        Remove local polygon normals from a geometry.

        Showing of polygon normals must be switched off explicitly using showPolygonColors(boolean).

      • setPolygonNormals

        public void setPolygonNormals(PdVector[] normal)
        Copy polygon normals of list to existing array of polygon normals. Length of argument list must be equal or larger than getNumPolygons(). All polygon normals are copied. The dimension of all argument normals must be equal to getDimOfVectors() of the geometry.
        Parameters:
        normal - array with new polygon normals
      • isClosed

        public boolean isClosed(int ind)
        Check whether polygon is closed, i.e.if endpoints are identical.
        Returns:
        flag whether polygon is closed, false if index out of bounds
        See Also:
        setClosed(int, boolean)
        Version:
        25.07.00, 1.00 created (kp)
      • setClosed

        public boolean setClosed(int ind,
                                 boolean flag)
        Close a polygon such that first and last vertex are identical. Size of polygon increases if end points where different.

        The dimension of the polygon set may be affected when closing multiple polygons of a set. Therefore, this method uses #assureDimOfPolygons to restore the dimension.

        PgPolygonSet does not use a flag since PgPolygonSet uses explicit index vectors to determine the polygon. Therefore, the user may just add the first index at the end of the polygon to close it.

        Parameters:
        flag - true ensures identical endpoints of polygons
        Returns:
        false if index out of bounds
        See Also:
        isClosed(int)
        Version:
        12.01.05, 1.10 revised (ur) Check flag, implementation for (flag == false), assure dimension of polygons.
        25.07.00, 1.00 created (kp)
      • getLengthOfPolygon

        public double getLengthOfPolygon(int ind)
        Compute length of a single polygon with given index.
        Author:
        Konrad Polthier
        Version:
        23.09.99, 1.00 revised (kp)
        23.09.99, 1.00 created (kp)
      • getLength

        public double getLength()
        Compute total length of all polygons.
        Author:
        Konrad Polthier
        Version:
        23.09.99, 1.00 revised (kp)
        23.09.99, 1.00 created (kp)
      • getVertexAngle

        public double getVertexAngle(int ind,
                                     int locInd)
        Compute angle at vertex of polygon. If vertex index is 0 or length-1, then angle of closed polygon is taken.
        Parameters:
        ind - index of polygon
        locInd - local index of vertex
        Returns:
        angle between edges at vertex
        Author:
        Konrad Polthier
        Version:
        23.09.99, 1.00 revised (kp)
        23.09.99, 1.00 created (kp)
      • getNumEdges

        public int getNumEdges()
        Calculate total number of edges of all polygons.
        Returns:
        number of edges
        Author:
        Konrad Polthier
        Version:
        23.09.99, 1.00 revised (kp)
        23.09.99, 1.00 created (kp)
      • blend

        public boolean blend(double s,
                             PgGeometry ag,
                             double t,
                             PgGeometry bg)
        Blend between two polygon sets using 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:
        10.11.01, 2.00 revised (kp) Interpolation of material properties enabled.
        30.12.97, 1.00 created (kp)
      • intersectionWithLine

        public PvPickEvent intersectionWithLine(PdVector rayBaseWorld,
                                                PdVector rayDirWorld)
        Find intersection of polygon set with a given ray. Closest polygon edge is located. 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.50 revised (kp) Check for vertices.
        04.10.99, 1.00 created (kp)
      • makeVertexNormals

        public boolean makeVertexNormals()
        Compute normals at vertices as edge bisectors with unit length. All normals are oriented to show to the same side of the polygon as the first normal which is non-degenerate.

        This method correctly handles polygons with sequences of parallel edges and multiple vertices.

        Overrides:
        makeVertexNormals in class PgPointSet
        Author:
        Konrad Polthier
        Version:
        31.07.04, 3.00 revised (kp) Renamed to makeVertexNormals() from makeNormals().
        09.06.01, 2.00 revised (kp) Full revision to incorporate all degenerate cases.
        08.06.01, 1.00 created (kp) Created from former version of makeBiNormals().
      • makeNormals

        public void makeNormals()
        Deprecated. since JavaView 3.50.002, use makeVertexNormals().
        Compute normals at vertices as edge bisectors with unit length.
      • makeBiNormals

        public void makeBiNormals()
        Compute binormals at vertices which are orthogonal to both adjacent edges. All binormals lie in the span of the two edges of a vertex and all binormals have the same orientation as the normal vector of the enclosed patch surface.

        This method correctly handles polygons with sequences of parallel edges and multiple vertices.

        Author:
        Konrad Polthier
        Version:
        08.06.01, 1.00 revised (kp)
        08.06.01, 1.00 created (kp) Method simply calls makeNormals()
      • makeOffsetNormals

        public void makeOffsetNormals()
        Compute normals at vertices as edge bisectors whose tip lies on an offset==1 curve. All normals are oriented to show to the same side of the polygon as the first normal which is non-degenerate.

        This method correctly handles polygons with sequences of parallel edges and multiple vertices.

        Author:
        Konrad Polthier
        Version:
        08.06.01, 1.00 revised (kp)
        08.06.01, 1.00 created (kp) Method simply calls makeNormals()
      • makeCurvatureNormals

        public void makeCurvatureNormals()
        Compute normals at vertices as edge bisectors with length equal to (Pi-vertexAngle). All normals are oriented to show to the same side of the polygon as the first normal which is non-degenerate.

        This method correctly handles polygons with sequences of parallel edges and multiple vertices.

        Author:
        Konrad Polthier
        Version:
        08.06.01, 1.00 revised (kp)
        08.06.01, 1.00 created (kp) Method simply calls makeNormals()
      • makeNormals

        public void makeNormals(int type,
                                double length)
        Compute normals at vertices which lie in the span of the adjacent edges. All normals are oriented to show to the same side of the polygon as the first normal which is non-degenerate.

        This method correctly handles polygons with sequences of parallel edges and multiple vertices.

        Author:
        Konrad Polthier
        Version:
        15.07.05, 2.20 revised (kp) Bug with 2d normals removed, vectors now remain 2d.
        22.11.01, 2.10 revised (kp) Bug with polygons of three vertices removed.
        09.06.01, 2.00 revised (kp) Full revision to incorporate all degenerate cases.
        08.06.01, 1.00 created (kp) Created from former version of makeBiNormals().
      • makePolygonColorsFromXYZ

        public boolean makePolygonColorsFromXYZ()
        Create color from the edge 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)
      • makePolygonColorsFromZ

        public boolean makePolygonColorsFromZ()
        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 is 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)
      • makePolygonColorsFromZHue

        public boolean makePolygonColorsFromZHue()
        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 is 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)
      • getFVector

        public int[] getFVector()
        Compute F-vector that is the number of points, edges, faces, etc.
        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)
      • triangulate

        public PiVector[] triangulate()
        The method triangulates the polygon patches by successively removing the vertex with the smallest interior angle. The method can handle non-convex polygons.
        Returns:
        Array of vectors each containing the vertex indices of a triangle.
        Author:
        Ulrich Reitebuch
        Version:
        07.11.02, 1.10 revised (ur) Handling of closed polygons corrected.
        19.11.01, 1.00 created (ur) Adapted from PgPolygon.triangulate().
      • flipOrientation

        public void flipOrientation()
        Change orientation of the polygon, i.e. the end point becomes the first point. This method just multiplies each normal vector with -1 and, therefore, must be overwritten by subclasses such as PgElementSet and PgPolygon.
        Overrides:
        flipOrientation in class PgPointSet
        Author:
        Konrad Polthier
        Version:
        22.11.01, 1.00 created (kp)
      • isShowingSmoothLighting

        public boolean isShowingSmoothLighting()
        Determines whether smooth lighting is enabled, requires vertex normals.
        Since:
        JavaView 2.69
        Version:
        26.04.03, 1.00 created (kp)
      • showSmoothLighting

        public void showSmoothLighting(boolean flag)
        Set flag to enable smooth lighting, requires vertex normals.
        Since:
        JavaView 2.69
        Version:
        26.04.03, 1.00 created (kp)
      • isShowingSmoothEdgeColors

        public boolean isShowingSmoothEdgeColors()
        Determines whether smooth coloring of polygons is enabled, currently requires vertex colors.
        Since:
        JavaView 2.69
        Version:
        26.04.03, 1.00 created (kp)
      • showSmoothEdgeColors

        public void showSmoothEdgeColors(boolean flag)
        Set flag to enable smooth coloring of edges, currently requires vertex colors.
        Since:
        JavaView 2.69
        Version:
        26.04.03, 1.00 created (kp)
      • isShowingEdgeColorFromVertices

        public boolean isShowingEdgeColorFromVertices()
        Determines whether smooth edge coloring uses vertex colors at vertices, requires vertex colors.
        Since:
        JavaView 2.69
        Version:
        26.04.03, 1.00 created (kp)
      • showEdgeColorFromVertices

        public void showEdgeColorFromVertices(boolean flag)
        Set flag to enable smooth edge coloring using vertex colors at vertices, requires vertex colors.
        Since:
        JavaView 2.69
        Version:
        26.04.03, 1.00 created (kp)
      • isShowingEdgeFromVertexColors

        public boolean isShowingEdgeFromVertexColors()
        Deprecated. since JavaView 3.96.031, use #isShowingEdgeColorFromVertices()
        Determines whether smooth edge coloring uses vertex colors at vertices, requires vertex colors.
        Since:
        JavaView 2.69
        Version:
        26.04.03, 1.00 created (kp)
      • showEdgeFromVertexColors

        public void showEdgeFromVertexColors(boolean flag)
        Deprecated. since JavaView 3.96.031, use #showEdgeColorFromVertices(boolean)
        Set flag to enable smooth edge coloring using vertex colors at vertices, requires vertex colors.
        Since:
        JavaView 2.69
        Version:
        26.04.03, 1.00 created (kp)
      • makePolygonFromVertexColors

        public boolean makePolygonFromVertexColors()
        Create polygon colors as average of the color of its vertices. Vertex colors must be available.
        Since:
        JavaView 2.69
        Author:
        Konrad Polthier
        Version:
        24.04.03, 1.00 created (kp)
      • makeVertexFromPolygonColors

        public boolean makeVertexFromPolygonColors()
        Create vertex colors as average of color of all adjacent polygons. Polygon colors must be available.
        Since:
        JavaView 2.69
        Author:
        Konrad Polthier
        Version:
        24.04.03, 1.00 created (kp)
      • makePolygonColorsFromLength

        public boolean makePolygonColorsFromLength()
        Create polygon color from the polygon length ranging through hue rainbow. If polygon is closed then both end points have the same color red, otherwise color ranges from red to bluish.
        Since:
        JavaView 2.70
        Author:
        Konrad Polthier
        Version:
        02.05.03, 1.00 created (kp)
      • makeVertexColorsFromLength

        public boolean makeVertexColorsFromLength()
        Create vertex color from the polygon length ranging through hue rainbow. If polygon is closed then both end points have the same color red, otherwise color ranges from red to bluish.
        Since:
        JavaView 2.70
        Author:
        Konrad Polthier
        Version:
        02.05.03, 1.00 created (kp)
      • convert

        public static PgPolygonSet convert(PgPolygon poly)
        Convert a PgPolygon into a PgPolygonSet. The polygon is converted to a single polygon in the new set, therefore, individual edge settings are ignored.
        Since:
        JavaView 3.11.003
        Author:
        Konrad Polthier
        Version:
        03.03.04, 1.00 created (kp)
"JavaView? v5.03.003"

"

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

You see the box below because you did not login.