JavaView® v2.00.008

jvx.geom
Class PgPolygonOnElementSet

java.lang.Object
  |
  +--jv.object.PsObject
        |
        +--jvx.geom.PgPolygonOnElementSet
All Implemented Interfaces:
java.lang.Cloneable, PsUpdateIf, java.io.Serializable

public class PgPolygonOnElementSet
extends PsObject

A polygon that lives on an element set. Every point of a PolygonOnElementSet is given by the element index of the element the point lies on, and the barycentric coordinates in respect to this triangle. Only for triangulations.

Version:
28.09.00, 1.40 revised (ep) Changed handling of null-parameter in constructor.
28.08.00, 1.30 revised (ep) Added setAccuracy(double) and corresponding variable m_eps. Changed method exp(...) to match that.
28.08.00, 1.20 revised (ep) Added getGeometry().
21.11.99, 1.01 removed static methods to class PwBary (ep)
30.06.99, 1.00 created (ep)
Author:
Eike Preuß
See Also:
PgPolygon, PgElementSet, Serialized Form

Field Summary
static double BARYEPS
          Accuracy used at checks for zero in barycentric coordinates as default (used e.g. in exp(...)).
protected  PiVector m_elem
          Global element indices as in underlying element set.
 double m_eps
          This accuracy is actually used for zero-checks in barycentric coordinates (used e.g. in exp(...)).
protected  PgElementSet m_geom
          Underlying element set.
protected  int m_maxNum
          Maximum number of vertices, internal use only.
protected  PdBary[] m_pos
          Barycentric coordinates of the points.
protected  int m_size
          Number of vertices, do not set directly, use setNumVertices().
 
Fields inherited from class jv.object.PsObject
HAS_CONFIG_PANEL, HAS_INFO_PANEL, HAS_MATERIAL_PANEL, INSPECTOR_INFO, INSPECTOR_INFO_EXT, IS_DELETED, IS_FIXED, IS_SELECTED, IS_USED, m_infoPanel, m_name, m_panelList, m_parent, m_tag, m_updateList, NUM_TAGS
 
Constructor Summary
PgPolygonOnElementSet(PgElementSet geom)
          Constructs a new polygon on an element set.
 
Method Summary
 void addPolygon(PgPolygonOnElementSet poly)
          Concatenates two polygons on element sets, ignoring the underlying geometries.
 double eval(PdVector bary1, PdVector bary2, PdVector bary3, PiVector outelem, double step)
          Evaluates the polygon in given steps and returns the calculated points in order.
 PdBaryDir exp(int iniElem, PdBary iniBary, PdBaryDir iniDir, double length)
          Makes discret exponential map, i.e. the straightest geodesic from given initial values.
 PdBaryDir exp(int iniElem, PdBary iniBary, PdBaryDir iniDir, double length, PgPolygon outpoly)
          Makes discret exponential map, i.e. the straightest geodesic from given initial values.
 PdBary[] getBary()
          Returns a reference to the barycentric coordinates.
 PdBary getBary(int index)
          Returns barycentric coordinates of the vertex at given index
 PiVector getElemInd()
          Returns a reference to the global element indices.
 int getElemInd(int index)
          Returns global element index of the element the vertex at given index lies on
 PgElementSet getGeometry()
           
 double getLength()
          Shortcut to getPolygon().getLength().
 int getNumVertices()
          Returns the number of points of the polygon.
 PgPolygon getPolygon()
          Returns polygon in world coordinates.
 boolean getPolygon(PgPolygon out)
           
 void setAccuracy(double newacc)
          Sets the accuracy that is used at checks for zero in barycentric coordinates.
 void setGeometry(PgElementSet geom)
          Changes the underlying geometry.
protected  void setMaxNumVertices(int max)
          Method should not be called directly, only subclass.setMaxNumVertices may call it.
 void setNumVertices(int num)
          Existing vertices keep their values (if their position is less than num).
 void setVertex(int index, int elem, PdBary bary)
          Sets vertex at given index to be on given element with given barycentric coordinates.
 java.lang.String toString()
          a long long description
 
Methods inherited from class jv.object.PsObject
addInspector, addUpdateListener, clearTag, clone, clone, clone, copy, getFather, getInfoPanel, getInspector, getName, getNumObjects, hasInspector, hasTag, hasUpdateListener, init, instanceOf, instanceOf, removeInspector, removeUpdateListener, setName, setParent, setTag, update, updatePanels
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BARYEPS

public static double BARYEPS
Accuracy used at checks for zero in barycentric coordinates as default (used e.g. in exp(...)).

m_eps

public double m_eps
This accuracy is actually used for zero-checks in barycentric coordinates (used e.g. in exp(...)).

m_geom

protected PgElementSet m_geom
Underlying element set.

m_maxNum

protected int m_maxNum
Maximum number of vertices, internal use only.

m_size

protected int m_size
Number of vertices, do not set directly, use setNumVertices().

m_elem

protected PiVector m_elem
Global element indices as in underlying element set.

m_pos

protected PdBary[] m_pos
Barycentric coordinates of the points.
Constructor Detail

PgPolygonOnElementSet

public PgPolygonOnElementSet(PgElementSet geom)
Constructs a new polygon on an element set. If geometry is null, then the method setGeometry has to be called before it is useful to use the instance of this class.
Parameters:
geom - Underlying element set. Must be a triangulation. It is possible to triangulate an element set by the method PgElementSet.triangulate(...).
See Also:
PgElementSet.triangulate(jv.geom.PgElementSet)
Method Detail

setGeometry

public void setGeometry(PgElementSet geom)
Changes the underlying geometry.
Parameters:
geom - new underlying triangulation

getGeometry

public PgElementSet getGeometry()
Returns:
reference to underlying triangulation

setMaxNumVertices

protected void setMaxNumVertices(int max)
Method should not be called directly, only subclass.setMaxNumVertices may call it. The user should change the number of vertices via setNumVertices().
See Also:
#setNumVertices()

setNumVertices

public void setNumVertices(int num)
Existing vertices keep their values (if their position is less than num). Necessary memory is allocated.

setVertex

public void setVertex(int index,
                      int elem,
                      PdBary bary)
Sets vertex at given index to be on given element with given barycentric coordinates.
Parameters:
index - vertex index in vertex arrays
elem - global element index where the vertex shall lie on
bary - barycentric coordinates of vertex in element

getBary

public PdBary[] getBary()
Returns a reference to the barycentric coordinates.

getElemInd

public PiVector getElemInd()
Returns a reference to the global element indices.

getNumVertices

public int getNumVertices()
Returns the number of points of the polygon.

getBary

public PdBary getBary(int index)
Returns barycentric coordinates of the vertex at given index

getElemInd

public int getElemInd(int index)
Returns global element index of the element the vertex at given index lies on

eval

public double eval(PdVector bary1,
                   PdVector bary2,
                   PdVector bary3,
                   PiVector outelem,
                   double step)
Evaluates the polygon in given steps and returns the calculated points in order.
Parameters:
bary1 - output: contains the first barycentric coordinate of all evaluated points
bary1 - output: contains the second barycentric coordinate of all evaluated points
bary1 - output: contains the third barycentric coordinate of all evaluated points
outelem - output: element indices of all evaluated points
step - stepsize in world metrics
Returns:
distance of last step (that is less than step)

getPolygon

public PgPolygon getPolygon()
Returns polygon in world coordinates.

getPolygon

public boolean getPolygon(PgPolygon out)
Parameters:
out - output: here the polygon is put
Returns:
true at success

getLength

public double getLength()
Shortcut to getPolygon().getLength().
Returns:
length of polygon in world metrics

addPolygon

public void addPolygon(PgPolygonOnElementSet poly)
Concatenates two polygons on element sets, ignoring the underlying geometries.
Parameters:
poly - vertices of poly are added to the polygon

toString

public java.lang.String toString()
a long long description
Overrides:
toString in class PsObject

exp

public PdBaryDir exp(int iniElem,
                     PdBary iniBary,
                     PdBaryDir iniDir,
                     double length)
Makes discret exponential map, i.e. the straightest geodesic from given initial values.
Parameters:
geom - ElementSet on which the geodesic lives. must be a triangulation.
iniElem - index of starting point's element
iniBary - the barycentric coordinates of the initial point
iniDir - the initial direction in barycentric notation
length - the euclidian length of the geodesic is length*norm(iniDir)
Returns:
null at an error; else the last barycentric direction that was used

exp

public PdBaryDir exp(int iniElem,
                     PdBary iniBary,
                     PdBaryDir iniDir,
                     double length,
                     PgPolygon outpoly)
Makes discret exponential map, i.e. the straightest geodesic from given initial values.
Parameters:
geom - ElementSet on which the geodesic lives. Must be a triangulation.
iniElem - index of starting point's element
iniBary - barycentric coordinates of the initial point
iniDir - initial direction in barycentric notation
length - euclidian length of the geodesic is length*norm(iniDir)
outpoly - if outpoly is not null the method puts the whole geodesic here
Returns:
null at an error; else the last barycentric direction that was used

setAccuracy

public void setAccuracy(double newacc)
Sets the accuracy that is used at checks for zero in barycentric coordinates. Default is defined in static field BARYEPS.

JavaView® v2.00.008

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