public final class PwBary
extends java.lang.Object
Constructor and Description |
---|
PwBary() |
Modifier and Type | Method and Description |
---|---|
static void |
changeBarycentricOnEdge(PdBary inOut,
int locind1,
int locind2)
Switch to barycentric coordinates that represent same point on edge
wrt the other element adjacent to edge.
|
static boolean |
changeBarycentricOnEdge(PgElementSet geom,
PdBaryDir baryDir,
int locInd)
Changes the barycentric representation of a vector in an element with respect to
a neighbour element.
|
static int |
changeBarycentricOnEdge(PgElementSet geom,
PdBary inoutBary,
int locInd)
A given point in element e will be projected to an adjacent edge and its barycentric
coordinates in the neighbour triangle is returned.
|
static double |
computeLambda(PdBary pos,
PdBaryDir dir)
Computes the smallest positive solution of 'pos + lambda*dir lies on boundary' for lambda.
|
static PdBaryDir[] |
computeNormals(PgPolygonOnElementSet poly,
PdBaryDir[] normals,
PiVector elementind)
TODO: DOES NOT WORK WITH CLOSED POLYGONS YET!
|
static int |
equalizeElementIndex(PgPolygonOnElementSet poly,
int index1,
int index2,
PdBary out1,
PdBary out2)
Outputs the coordinates of two vertices on a barycentric polygon such that
their barycentric coordinates refer to the same element.
|
static PdBary[] |
getBaryDescriptions(PgElementSet geom,
PdBary bary,
double eps)
Get the barycentric coordinates of a given point in all elements, which
contains this point. (2, if it lies on an edge, more if it lies on a vertex).
|
static int |
getEdgeIndex(PdBary pos)
Checks for first occurrence of zero (i.e. |.|< eps) in the barycentric vector.
|
static PdBaryDir[] |
getGeodRepresentation(PgElementSet geom,
int origElem,
PdBaryDir origDir,
int localvertexindex,
PiVector elements,
PiVector localind)
Calculates the representations of a given vector
in all elements of a vertex star by completion to a
unnormalized angle of theta/2.
|
static double |
getOrientedAngle(PgElementSet geom,
int elemInd,
PdBaryDir a,
PdBaryDir b,
boolean recalc)
Oriented angle between two barycentric vectors in a triangle.
|
static double |
getOrientedAngleAtEdge(PgElementSet geom,
int elemind1,
PdBaryDir dir1,
int localedgeind1,
int elemind2,
PdBaryDir dir2,
int localedgeind2,
boolean recalc) |
static double |
getOrientedAngleAtVertex(PgElementSet geom,
int elemind1,
PdBaryDir dir1,
int localvertind1,
int elemind2,
PdBaryDir dir2,
int localvertind2,
boolean recalc)
Computes the normalized angle between two barycentric vectors based at the same vertex.
|
static PdBaryDir[] |
getProjRepresentation(PgElementSet geom,
int origElem,
PdBaryDir origDir,
int localvertexindex,
PiVector elements,
PiVector locind)
Calculates the representations of a given vector
in all elements of a vertex star by projection onto the plane the element lays in.
|
static PdBaryDir[] |
getTransRepresentation(PgElementSet geom,
int origElem,
PdBaryDir origDir,
int localvertexindex,
PiVector elements,
PiVector locind)
Calculates the representations of a given vector
in all elements of a vertex star by parallel translation
along a straightest geodesic (half angles).
|
static double |
getTransRepresentationValues(PgElementSet geom,
int origElem,
PdBaryDir origDir,
int localvertexindex,
PiVector elements,
PiVector locind,
PdVector betas)
Calculates the values (beta,theta) of a given vector
in all elements of a vertex star by parallel translation
along a straightest geodesic.
|
static PdVector |
getVector(PdVector dir,
PgElementSet geom,
PdBaryDir baryDir)
Get the coordinates of a vector from its barycentric coordinates.
|
static PdVector |
getVertex(PdVector vertex,
PgElementSet geom,
PdBary bary)
Get the coordinates of a vertex from its barycentric coordinates.
|
static PdVector |
getVertex(PdVector vertex,
PgPolygon polygon,
PdBary bary)
Get vertex from barycentric coordinates on a polygon.
|
static double |
getVertexAngles(PgVertexStar star,
PgElementSet geom,
PdVector angles)
Calculates inner angles of the elements of a vertex star.
|
static int |
liesOnEdge(PdBary pos)
Checks if given barycentric position lies within PuMath.EPS distance to
the interior of an edge, and away from vertices.
|
static int |
liesOnVertex(PdBary pos)
Checks if given barycentric position lies within PuMath.EPS range of a vertex,
and returns local index of that vertex.
|
static boolean |
makeBaryDescription(PgElementSet geom,
PdBary bary,
int newElement,
double eps)
Try to make a barycentric description of a point w.r.t. a specidied element
in the geometry.
|
static boolean |
makeCommonBaryDescription(PgElementSet geom,
PdBary bary1,
PdBary bary2,
double eps)
Convert the barycentric coordinates of two points on a surface, such that they are described
w.r.t. the same triangle of the surface.
|
static PdBary |
newVertexBary(int element,
int locVertInd)
Make a new PdBary instance representing a vertex on the given element set.
|
static double |
norm(PgElementSet geom,
int elemInd,
PdBaryDir x,
boolean geometryChanged)
Euclidean norm of two intrinsic (barycentric) vectors.
|
static PdBary |
projectOntoElement(PgElementSet geom,
int elementIdx,
PdVector point,
PdBary outBary)
Project a point from R^3 to an element of geom in normal direction.
|
static boolean |
projectOntoElement(PgElementSet geom,
int elemInd,
PdVector vector,
PdBaryDir outdir)
Projects given vector onto elements plane.
|
static PdBary |
projectOntoElement(PgElementSet geom,
int elementIdx,
PdVector point,
PdVector dir,
PdBary outBary)
Project a point from R^3 to an element of geom.
|
static void |
projectOntoElementEdge(int edgeInd,
PdBary bary)
Project the barycentric coordinates from a point to an edge of the barycentric triangle.
|
static void |
projectOntoElementEdge(PgElementSet geom,
PdBary bary,
int edgeInd)
Project a point from R^3 to an element edge of geom.
|
static PdBary |
projectOntoElementSet(PgElementSet geom,
PdVector point,
PdBary outBary)
Project a point from R^3 to a surface.
|
static double |
projectOntoPolygon(PdVector vertex,
PgPolygon polygon,
PdBary bary2D)
Project a vertex onto its nearest point on a given polygon.
|
static void |
projectToInside(PgElementSet target,
PdBary inOutBary)
Projects the given point inside the specified triangle.
|
static int |
rotateAtEdge(PgElementSet geom,
int elem,
PdBaryDir dir,
int localedgeind,
PdBaryDir out,
PdBary pos,
double angle,
boolean recalc)
Rotates a barycentric direction with base point on edge.
|
static int |
rotateAtVertex(PgElementSet geom,
int elemind,
int localvertexind,
PdBaryDir dir,
PdBaryDir outdir,
PdBary bary,
double angle)
Rotates direction at vertex in same orientation as the star.
|
static void |
rotateInElement(PgElementSet geom,
int elemInd,
PdBaryDir dir,
double angle,
PdBaryDir outdir,
boolean bForceRecalc)
Rotates direction in same orientation as the element's.
|
static double |
scalar(PgElementSet geom,
int elemInd,
PdBaryDir x,
PdBaryDir y,
boolean geometryChanged)
Computes scalar product of barycentric directions in world coordinates, that means the scalar product of
the vectors in euclidean space.
|
static boolean |
showsIntoElement(PdBaryDir dir,
int vertexindex)
Checks if given barycentric vector shows into its element.
|
static PdBaryDir |
subBary(PgElementSet geom,
PdBary b1,
PdBary b2,
PdBaryDir outDir)
Substract two points on a surface in barycentric coordinates.
|
static boolean |
transformBary(PgElementSet geom,
int origElem,
PdBary origBary,
int destElem,
PdBary outBary)
Tries to change a barycentric coordinate to the representation of the same space point wrt a different
triangle.
|
static void |
translatePolygonOnElementSet(PgPolygonOnElementSet poly,
PdBaryDir[] vf,
PiVector vfInd,
PdVector distField)
Translates the vertices of the polygon a given distance into a given direction.
|
static PdBary |
vertexToBary(PgElementSet geom,
int vertex,
int neighbourElement)
Create barycentric coordinates of a given vertex in a PgElementSet.
|
public static double scalar(PgElementSet geom, int elemInd, PdBaryDir x, PdBaryDir y, boolean geometryChanged)
scalar
and !geometryChanged
then some calculations are skipped.geom
- geometry the barycentric directions live onelemInd
- element the barycentric directions live onx
- one directiony
- other directiongeometryChanged
- if true
all variables are forced to be recalculated; should only
be used if the vertex positions may have changedpublic static double norm(PgElementSet geom, int elemInd, PdBaryDir x, boolean geometryChanged)
PwBary.scalar
and additional square root.geom
- the geometry the barycentric direction lives onelemInd
- the element the barycentric direction lives onx
- barycentric vectorgeometryChanged
- if true
all variables are forced to be recalculated; should only
be used if the vertex positions may have changedscalar(jv.geom.PgElementSet, int, jv.vecmath.PdBaryDir, jv.vecmath.PdBaryDir, boolean)
public static double getVertexAngles(PgVertexStar star, PgElementSet geom, PdVector angles)
star
- the stargeom
- the geometryangles
- output: vertex angles of elements in star,
in same order as PgVertexStar.getElement()
.
if necessary it is resized.public static PdBaryDir[] getGeodRepresentation(PgElementSet geom, int origElem, PdBaryDir origDir, int localvertexindex, PiVector elements, PiVector localind)
geom
- triangulationorigElem
- element in which the vector is givenorigDir
- vector that will be translated to the other elementslocalvertexindex
- local index in origElem
of the vertex
at which the vector is givenelements
- output: global element indices of the vertex starlocalind
- output: local vertex indices of common vertex in elements at vertex starpublic static PdBaryDir[] getTransRepresentation(PgElementSet geom, int origElem, PdBaryDir origDir, int localvertexindex, PiVector elements, PiVector locind)
geom
- triangulationorigElem
- element in which the vector is givenorigDir
- vector that will be translated to the other elementslocalvertexindex
- the local index in origElem
of the vertex in which the vector is givenelements
- output: global element indices of the vertex starlocind
- output: local vertex indices of the vertex starpublic static double getTransRepresentationValues(PgElementSet geom, int origElem, PdBaryDir origDir, int localvertexindex, PiVector elements, PiVector locind, PdVector betas)
geom
- set of elementsorigElem
- element in which the vector is givenorigDir
- vector that will be translated to the other elementslocalvertexindex
- the local index in origElem
of the vertex in which the vector is givenelements
- output: global element indices of the vertex star, beginning with origElemlocind
- output: local indices of common vertex of star, beginning with localvertexindexbetas
- output: beta valuespublic static PdBaryDir[] getProjRepresentation(PgElementSet geom, int origElem, PdBaryDir origDir, int localvertexindex, PiVector elements, PiVector locind)
geom
- set of elementsorigElem
- element on which the vector is givenorigDir
- vector that will be translated to the other elementslocalvertexindex
- the local index in origElem
of the vertex in which the vector is givenelements
- output: global element indicee of the vertex starlocind
- output: local vertex indices of the vertex starpublic static boolean projectOntoElement(PgElementSet geom, int elemInd, PdVector vector, PdBaryDir outdir)
geom
- underlying geometryelemInd
- global element indexvector
- in world coordinatesoutdir
- output: barycentric coordinates of the projected vectorpublic static PdBary projectOntoElement(PgElementSet geom, int elementIdx, PdVector point, PdBary outBary)
geom
- Underlying triangulated surface in R^3.elementIdx
- Index of a triangle in geom.point
- Point in R^3 to project.outBary
- Output for projected point. May be null.public static PdBary projectOntoElement(PgElementSet geom, int elementIdx, PdVector point, PdVector dir, PdBary outBary)
geom
- Underlying triangulated surface in R^3.elementIdx
- Index of a triangle in geom.point
- Point in R^3 to project.dir
- Projection direction.outBary
- Output for projected point. May be null.public static void projectOntoElementEdge(PgElementSet geom, PdBary bary, int edgeInd)
outBary
is null
, a new PdBary
is created and returned.geom
- Base geometry.bary
- Barycentric coordinates of point to be projected. Will be modified.edgeInd
- Target local edge index.public static void projectToInside(PgElementSet target, PdBary inOutBary)
target
- Base geometry.inOutBary
- Point in barycentric coordinates wrt the triangle
in which it should be projected.public static void projectOntoElementEdge(int edgeInd, PdBary bary)
edgeInd
- Target edge index.bary
- Input and output point.public static PdBary projectOntoElementSet(PgElementSet geom, PdVector point, PdBary outBary)
public static double projectOntoPolygon(PdVector vertex, PgPolygon polygon, PdBary bary2D)
vertex
- Vertex to project.polygon
- Given polygon.bary2D
- Barycentric coordinates of projected vertex will be copied here.public static double getOrientedAngle(PgElementSet geom, int elemInd, PdBaryDir a, PdBaryDir b, boolean recalc)
geom
- underlying geometryelemInd
- global element indexa
- first vectorb
- second vectorrecalc
- used for scalar producta
must be rotated
against the orientation of the triangle; -3*PI if an error occurredscalar(jv.geom.PgElementSet, int, jv.vecmath.PdBaryDir, jv.vecmath.PdBaryDir, boolean)
public static double getOrientedAngleAtVertex(PgElementSet geom, int elemind1, PdBaryDir dir1, int localvertind1, int elemind2, PdBaryDir dir2, int localvertind2, boolean recalc)
getOrientedAngle
if this is not the
case. Furthermore they must point into the element they lie on.
public static double getOrientedAngleAtEdge(PgElementSet geom, int elemind1, PdBaryDir dir1, int localedgeind1, int elemind2, PdBaryDir dir2, int localedgeind2, boolean recalc)
public static void rotateInElement(PgElementSet geom, int elemInd, PdBaryDir dir, double angle, PdBaryDir outdir, boolean bForceRecalc)
geom
- underlying geometryelemInd
- element on that vector liesdir
- barycentric directionangle
- radoutdir
- output: result of rotation; may be same instance as dirbForceRecalc
- used for scalar productscalar(jv.geom.PgElementSet, int, jv.vecmath.PdBaryDir, jv.vecmath.PdBaryDir, boolean)
public static int rotateAtVertex(PgElementSet geom, int elemind, int localvertexind, PdBaryDir dir, PdBaryDir outdir, PdBary bary, double angle)
geom
- underlying geometryelemind
- global element indexlocalvertexind
- local index of vertex that is base of the rotationdir
- original vectoroutdir
- output: result of rotationbary
- output: barycentric coordinates of the base point of the resultangle
- normalized angle [0;2*PI] ^= 360°public static int rotateAtEdge(PgElementSet geom, int elem, PdBaryDir dir, int localedgeind, PdBaryDir out, PdBary pos, double angle, boolean recalc)
geom
- underlying triangulationelem
- element index of barycentric directiondir
- barycentric direction with base point on element edge (pointing into element)localedgeind
- local index in element of the edge the direction lies onout
- output: rotated barycentric directionpos
- input/output: base point is converted to new element if necessaryangle
- in [0;2*PI]public static boolean showsIntoElement(PdBaryDir dir, int vertexindex)
dir
- barycentric vector that shall be checkedvertexindex
- local vertex index that is the base of the directionpublic static int liesOnVertex(PdBary pos)
pos
- barycentric point, must not be nullpublic static int liesOnEdge(PdBary pos)
Method works for triangles and higher dimensional simplices only.
pos
- barycentric positionpublic static double computeLambda(PdBary pos, PdBaryDir dir)
pos
- Must not be null. Must have same size as dir.dir
- Must not be null. Must have same size as pos.public static int getEdgeIndex(PdBary pos)
pos
- must not be nullpublic static PdBaryDir[] computeNormals(PgPolygonOnElementSet poly, PdBaryDir[] normals, PiVector elementind)
public static void translatePolygonOnElementSet(PgPolygonOnElementSet poly, PdBaryDir[] vf, PiVector vfInd, PdVector distField)
poly
- polygon to translatevf
- normalized barycentric directions for each vertex of polygonvfInd
- element indices for the barycentric directionsdistField
- the distance to move for each polygon vertexpublic static boolean transformBary(PgElementSet geom, int origElem, PdBary origBary, int destElem, PdBary outBary)
public static int equalizeElementIndex(PgPolygonOnElementSet poly, int index1, int index2, PdBary out1, PdBary out2)
poly
- the polygon on a triangulationindex1
- first point (index in poly)index2
- second point (index in poly)public static void changeBarycentricOnEdge(PdBary inOut, int locind1, int locind2)
inOut
- must have a zero at locind1, result is put herelocind1
- local index of edge in origin trianglelocind2
- local index of edge in destination trianglepublic static int changeBarycentricOnEdge(PgElementSet geom, PdBary inoutBary, int locInd)
geom
- A geometry.inoutBary
- Barycentric coordinates of a point on the surface.locInd
- Local edge index for the current element (inoutBary.getElementInd()).public static boolean changeBarycentricOnEdge(PgElementSet geom, PdBaryDir baryDir, int locInd)
geom
- Given element set.baryDir
- Barycentric coordinates of a vector on the geometry. Used for
input and output.locInd
- Local neighbour index for an incident element. The barycentric
coordinates will be rewritten with respect to this neighbour
element.public static PdBary[] getBaryDescriptions(PgElementSet geom, PdBary bary, double eps)
geom
- A geometry.bary
- Barycentric coordinates of a point on geom.eps
- Accuracy of the calculation. Points with a distance of < eps
to a vertex/edge will be treated as lying on that vertex/edge.public static boolean makeBaryDescription(PgElementSet geom, PdBary bary, int newElement, double eps)
geom
- Input geometry.bary
- Barycentric point on geom. If possible, the new barycentric
coordinates will be copied here.newElement
- New element index.eps
- Epsilon tolerance.public static boolean makeCommonBaryDescription(PgElementSet geom, PdBary bary1, PdBary bary2, double eps)
geom
- Underlying surface.bary1
- First point.bary2
- Second point.eps
- Accuracy of the test if a point lies on an edge.public static PdVector getVertex(PdVector vertex, PgElementSet geom, PdBary bary)
vertex
- Output vector for the coordinates of the point. May be null.geom
- Given geometry.bary
- Barycentric coordinates of the point on the geometry.public static PdVector getVertex(PdVector vertex, PgPolygon polygon, PdBary bary)
vertex
- Output vector for the coordinates of the point. May be null.polygon
- Given polygon.bary
- Barycentric coordinates. Must be of dimension 2.public static PdVector getVector(PdVector dir, PgElementSet geom, PdBaryDir baryDir)
dir
- Output direction for the coordinates of the vector. May be null.geom
- Geometry.baryDir
- Barycentric coordinates of the vector on the geometry.public static PdBary newVertexBary(int element, int locVertInd)
element
- Element index in the element set.locVertInd
- Local vertex index of the vertex in the element.public static PdBaryDir subBary(PgElementSet geom, PdBary b1, PdBary b2, PdBaryDir outDir)
public static PdBary vertexToBary(PgElementSet geom, int vertex, int neighbourElement)
"