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

Class PwSymmetry

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, PsUpdateIf, PjWorkshopIf


    public class PwSymmetry
    extends PjWorkshop
    This workshop allows to automatically mirror objects which have a certain symmetry.
    Geometries can be mirrored along edges or planes which are defined through the boundary of the geometry.
    Also boundaries can be selected to be selectively mirrored.
    In automatic reflection mode, the combination of matrices which create the same planes can be returned (equivalent words).
    See Also:
    Serialized Form
    Author:
    Janis Bode
    Version:
    18.09.08, 1.01 revised (jb) Replaced PwCleanMesh.removeMarks with PwIdentify.removeMarks
    31.08.07, 1.00 created (jb)
    • Field Detail

      • serialVersionUID

        public static final long serialVersionUID
        Set to indicate serialization compatibility with a previous version of the class.
        See Also:
        Constant Field Values
    • Constructor Detail

      • PwSymmetry

        public PwSymmetry()
        Initialize and set names of project and sliders.
    • Method Detail

      • init

        public void init()
        Configure and initialize the viewer and the panel.
        Overrides:
        init in class PjWorkshop
      • setGeometry

        public void setGeometry(PgGeometry geom)
        Set the geometry for this workshop, adjust sliders and viewer accurately.
        Specified by:
        setGeometry in interface PjWorkshopIf
        Overrides:
        setGeometry in class PjWorkshop
        Parameters:
        geom - the workshop modifies this geometry.
      • reset

        public void reset()
        Resets to the initial state, which the workshop had at startup.
        Overrides:
        reset in class PjWorkshop
      • resetOptions

        public void resetOptions()
        Resets the Checkboxes and their actions in the display.
      • setCheckGeometricOverlap

        public void setCheckGeometricOverlap(boolean check)
        Parameters:
        check -
      • showMirroredGeoms

        public void showMirroredGeoms(int elemNum,
                                      PgElementSet geom)
        Shows mirrored geometries.
        Parameters:
        elemNum - is the number of elements which are supposed to be drawn- in order of the tree.
        geom - is the geometry, which was mirrored.
      • showAllGeoms

        public void showAllGeoms()
        Show all of the mirrored geometries and merge them.
      • partialMerge

        public void partialMerge()
        Merges geometries into an overlay geometry which makes it possible to mark all vertices of the mirrored geometries but leaves the mirrored parts for further work.
      • mergeVis

        public void mergeVis()
        Merges the currently visible geometries and removes the invisible ones from the workshop.
      • approxNormal

        public PdVector approxNormal(PdVector p,
                                     PdVector q,
                                     PdVector r)
        Approximate normal of plane derived from the PdVector class but with an epsilon-tolerance.
        Parameters:
        p - is the first vector defining the plane.
        q - is the second vector defining the plane.
        r - is the third vector defining the plane.
        Returns:
        the approximate normal vector of the given plane.
      • colorGeoms

        public void colorGeoms(boolean show)
        Colors different geometries in different colors if show is true and resets to the original coloring if false.
        Parameters:
        show - Indicates if geometries will be colored differently or not.
      • saveColors

        public void saveColors()
        Saves the color and properties of the generating geometry.
      • restoreColors

        public void restoreColors(PgElementSet geom)
        Restores original coloring of the geometry.
        Parameters:
        geom - geometry, whose color is to be restored.
      • selectBoundaries

        public int[] selectBoundaries(PgPolygon[] bound,
                                      PgPointSet selPoints)
        This method returns an integer-array which contains the indices of the polygons which contain at least two points from the pointcloud "selpoints".
        Parameters:
        bound - the bpolygon (boundary) to be compared with the given pointcloud
        selPoints - the currently by user selected vertices.
        Returns:
        an array which states if which boundary is selected and which not.
      • makeBoundaries

        public PgBndPolygon[] makeBoundaries(int critAngle,
                                             PgElementSet geom)
        Creates the boundary for an ElementSet adding a neighbour relation and splitting at points which do not fulfill the angle criterion (i.e. mostly that the polygon is not planar there).
        Parameters:
        critAngle - is the critical angle for splitting of the boundary.
        geom - is the geometry, of which a boundary will be created.
        Returns:
        the boundary of geom with respect to the critical angle.
      • showBoundaries

        public void showBoundaries(boolean show)
        Show or hide the boundaries of a geometry.
        Parameters:
        show - indicates whether the boundary will be shown or not.
      • showBoundaries

        public void showBoundaries(PgBndPolygon[] bound)
        Shows the given boundaries in different coloring.
        Parameters:
        bound - is a set of boundary-polygons to be highlighted in different colors.
      • selectPoints

        public PgPointSet selectPoints(PgElementSet geom)
        Returns a pointset which contains all selected points of the given geometry.
        Parameters:
        geom - geometry which is checked for selected points.
        Returns:
        the selected points of geom.
      • mirrorAlongSelected

        public void mirrorAlongSelected()
        Mirrors the geometry along all those edges which have at least two vertices marked.
      • mirrorBoundary

        public PdMatrix mirrorBoundary(int i,
                                       PgBndPolygon[] bound,
                                       PgElementSet geom)
        This function computes a reflection matrix if the i-th component of m_bound is 2 dimensional, a matrix which rotates by Pi if it is 1-dimensional or returns the zero matrix in any other cases. When the zero matrix is returned (means error), the variable m_badBound is set to true as the boundary is "bad" in consideration of its ability to be mirrored.
        Parameters:
        i - is the index of the boundary for which the reflection matrix will be computed.
        bound - is the boundary of geom.
        geom - is the geometry working with.
      • getPolyDimension

        public int getPolyDimension(PgPointSet poly)
        This method returns the dimension of a given PgPointSet, which it spans in space.
        Parameters:
        poly - Given pointset which is to be checked for dimension
        Returns:
        "-1" if the pointset is empty
        "0" if there is only one vertex
        "1" if the pointset defines an edge
        "2" if the pointset defines a plane
        "3" if the pointset defines a volume.
      • getSymmAndGeom

        public void getSymmAndGeom()
        Computes the symmetries of m_geom and shows its mirrored geometries.
      • createGeo

        public void createGeo(PdMatrix[] mat)
        Create mirrored geometries from matrices given.
        Parameters:
        mat - Reflection matrices that define the mirrored geometries generated from m_elSet.
      • getSymmetries

        public PdMatrix[] getSymmetries(int m_maxdepth,
                                        int critAngle,
                                        double eps)
        Computes the symmetries of a given object.
        Parameters:
        m_maxdepth - is the maximal tree depth to which the symmetries are computed.
        critAngle - is the critical angle for the boundary splitting.
        eps - is the tolerance for the tree computation.
        Returns:
        an array of matrices which describe the mirror planes.
      • getSymmetryMatrices

        public PdMatrix[] getSymmetryMatrices(PgPolygon[] bound)
        Creates symmetry matrices from the planes given in bound. Bound must be split into planes.
        Parameters:
        bound - is a boundary polygon.
        Returns:
        all matrices which are defined by the boundary.
      • getTreeAndEqui

        public void getTreeAndEqui(PdVector start,
                                   PdMatrix[] M,
                                   int numMatrices,
                                   double eps,
                                   int m_maxdepth)
        Returns equivalent words in "eq" and the tree in "tmplist" in the variables given. The vars must be initialized in the main program before used here. Does the same as makeTree and getEquivalents together. m_maxdepth = 0 means there is no maximal depth.
        Parameters:
        start - Startpoint
        M - Matrices
        numMatrices - Number of Matrices used
        eps - Tolerance
        m_maxdepth - maximal tree depth.
      • makeTree

        public jvx.geom.WordPoint[] makeTree(PdVector start,
                                             PdMatrix[] M,
                                             int numMatrices,
                                             double eps)
        Creates a tree in a vector of self-referring entries of type WordPoint. The algorithm tries for a flat approach of the tree means that each level is completely checked before it goes a level deeper. That results in shorter words in the end but may require more of the given matrices. The long approach would generate the same matrices but through other words.
        Parameters:
        start - The (well chosen) starting point
        M - The base-matrices to generate the symmetries with
        numMatrices - The number of matrices given (hopefully obsolete in the future)
        eps - The tolerance below which the difference between two vectors is (component wise) considered equal.
        Returns:
        the tree in form of a WordPoint-Array. Through parents and letters the words can be constructed from this structure.
      • getEquivalents

        public jvx.geom.EquiPoint[] getEquivalents(PdVector start,
                                                   PdMatrix[] M,
                                                   int numMatrices,
                                                   double eps)
        Returns pairs of words which are equivalent.
        Parameters:
        start - is the startpoint for the geometrical equivalence check.
        M - is an array of matrices which is to be checked for equivalence.
        numMatrices - is the number of matrices in M.
        eps - is the tolerance for the computation.
        Returns:
        the equivalent words.
      • getEquiWords

        public jvx.geom.EquiPoint getEquiWords(int i,
                                               int j,
                                               int k,
                                               java.util.Vector list)
        Returns two equivalent words of points which are already known to be the same.
        Parameters:
        i - letter of dead end
        j - index of first point with same coordinates
        k - index of second point with same coordinates
        list - the tree
        Returns:
        two equivalent words.
      • getWordMatrices

        public PdMatrix[] getWordMatrices(PiVector[] words,
                                          PdMatrix[] M)
        Returns the matrices which generate the whole space. Faster than other method but needs "better" input.
        Parameters:
        words - The words which generate an element
        M - The base-matrices.
        Returns:
        an array of matrices which generate the whole space.
      • getWordMatrices

        public PdMatrix[] getWordMatrices(jvx.geom.WordPoint[] list,
                                          PdMatrix[] M)
        Returns the matrices which generate the whole space.
        Parameters:
        list - The list which contains the tree
        M - The base-matrices
        Returns:
        an array of matrices which generate the whole space.
      • getWord

        public PiVector getWord(int i,
                                java.util.Vector list)
        Returns the word for a single element of the tree. For identity "-1" is returned - the numbers starting from 0 are the matrices given.
        Parameters:
        i - The index of the element to get the word for
        list - The tree.
        Returns:
        the word for a single element.
      • getWord

        public PiVector getWord(int i,
                                jvx.geom.WordPoint[] list)
        Returns the word for a single element of the tree. For identity "-1" is returned - the numbers starting from 0 are the matrices given.
        Parameters:
        i - The index of the element to get the word for
        list - The tree.
        Returns:
        the word for a single element.
      • getWords

        public PiVector[] getWords(jvx.geom.WordPoint[] list)
        Returns the words of a matrix composition given through a tree containing letters.
        Parameters:
        list - The tree to generate words from.
        Returns:
        an array of (usually differently sized) vectors which contain the words
      • getShortestPointDist

        public double getShortestPointDist(PgElementSet geom)
        Get the shortest distance between two points of a geometry (faster with kdtree?). Only exact to 3 digits. HACK (kp, 2011-02-05) This algorithm is quadratic and uses inefficient comparisons for length and in copyNew (sqrt!!!)
        Parameters:
        geom - geometry whose edge is to be checked.
        Returns:
        the length of the shortest edge
      • getHomogCenter

        public PdVector getHomogCenter(PgElementSet geom)
        Get the center of a geometry in homogeneous coordinates.
        Parameters:
        geom - geometry whose center is to be found.
        Returns:
        center of the geometry in homogeneous coordinates.
      • hasEquivPoint

        public int hasEquivPoint(java.util.Vector list,
                                 PdVector check,
                                 double eps)
        Method that checks if a given point is already contained in a wordlist or not.
        Parameters:
        list - the list, which contains the points.
        check - the vector to be compared with the list
        eps - tolerance for equality-check
        Returns:
        index of the point in the wordlist which is equal.
      • epsEqual

        public boolean epsEqual(PdVector vec1,
                                PdVector vec2,
                                double eps)
        Compares the two PdVectors vec1 and vec2 component-wise and marks them equal if they differ maximally by eps in each component.
        Parameters:
        vec1 - first vector to be checked for equality
        vec2 - second vector to be checked for equality
        eps - equality-threshold
        Returns:
        true if vectors are considers equal or false if not.
      • matmult

        public PdVector matmult(PdMatrix M,
                                PdVector x)
        Multiply PdMatrix with PdVector and get a PdVector.
        Parameters:
        M - Matrix to multiply vector with
        x - Vector to be multiplied
        Returns:
        Matrix-Vector product
"JavaView? v5.03.003"

"

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

Ads help maintain this website.