JavaView© v3.95.000

jvx.geom
Class PgPolygonOnElementSet

java.lang.Object
  extended byjv.object.PsObject
      extended byjvx.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 with respect to this triangle. Only for triangulations.

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(...)).
 double m_eps
          This accuracy is actually used for zero-checks in barycentric coordinates (used e.g. in exp(...)).
 
Fields inherited from class jv.object.PsObject
HAS_CONFIG_PANEL, HAS_INFO_PANEL, HAS_LABEL_PANEL, HAS_MATERIAL_PANEL, HAS_TEXTURE_PANEL, HAS_VECTOR_PANEL, INSPECTOR_INFO, INSPECTOR_INFO_EXT, IS_DELETED, IS_FIXED, IS_FOCUSSED, IS_PICKED, IS_SELECTED, IS_USED, 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.
 void copyIntrinsicData(PgPolygonOnElementSet source)
          Copies only element indices and barycentric coordinates.
 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 discrete exponential map, i.e. the straightest geodesic from given initial values.
 PdBaryDir exp(int iniElem, PdBary iniBary, PdBaryDir iniDir, double length, PgPolygon outpoly)
          Makes discrete exponential map, i.e. the straightest geodesic from given initial values.
 void flipOrientation()
          Change orientation of the PgPolygonOnElementSet by inverting the order of the vertices, i.e. the end point becomes the first point.
 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)
          Returns polygon in world coordinates.
 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.
 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, assureInspector, clearTag, clone, clone, clone, copy, getFather, getInfoPanel, getInspector, getName, getNumObjects, getSymbol, hasInspector, hasTag, hasUpdateListener, init, instanceOf, instanceOf, newInspector, newInspector, removeInspector, removeInspector, removeUpdateListener, setName, setParent, setSymbol, setTag, update, updatePanels
 
Methods inherited from class java.lang.Object
equals, 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(...)).

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

copyIntrinsicData

public void copyIntrinsicData(PgPolygonOnElementSet source)
Copies only element indices and barycentric coordinates. You have to take care that element indices are valid.

Since:
JavaView 2.65.000

setGeometry

public void setGeometry(PgElementSet geom)
Changes the underlying geometry.

Parameters:
geom - new underlying triangulation

getGeometry

public PgElementSet getGeometry()
Returns:
reference to underlying triangulation

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. (Barycentric coordinate is copied into another PdBary instance.)

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
bary2 - output: contains the second barycentric coordinate of all evaluated points
bary3 - 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)
Returns polygon in world coordinates.

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. That means, it simply concatenates the element indices and barycentric coordinates. You have to take care that element indices are valid.

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 discrete exponential map, i.e. the straightest geodesic from given initial values. THIS METHOD IS NOT THREAD SAFE! Calling this method on the same instance of PgPolygonOnElementSet in different threads might cause things to react weird. Calling this method on different instances in different threads is no problem.

Parameters:
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 discrete exponential map, i.e. the straightest geodesic from given initial values.

THIS METHOD IS NOT THREAD SAFE! Calling this method on the same instance of PgPolygonOnElementSet in different threads might cause things to react weird. Calling this method on different instances in different threads is no problem.

Parameters:
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. (E.g. in exponential map computation. Setting this to a high value produces a straight geodesic that behaves more often as if it crosses a vertex.) Default is defined in static field BARYEPS.


flipOrientation

public void flipOrientation()
Change orientation of the PgPolygonOnElementSet by inverting the order of the vertices, i.e. the end point becomes the first point.


JavaView© v3.95.000

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