jvx.geom
Class PgUtil
- java.lang.Object
-
- jvx.geom.PgUtil
-
public class PgUtil extends java.lang.ObjectUtil class containing static methods which provide analysis about geometries.- Since:
- JavaView 3.99.045 moved to jvx from dev.
- Version:
- 02.09.09, 2.00 moved (kp) Moved to jvx from dev.
20.11.08, 1.40 revised (mn) Added deriveTexture.
04.06.07, 1.30 revised (fk) Added boundary option, edgeLengthAverage(), and others.
27.05.07, 1.20 revised (kp) Method getEdgeLengths() and getVertexAngles() added.
01.03.07, 1.00 created (mn)
-
-
Constructor Summary
Constructors Constructor and Description PgUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method and Description static doubleaverageEdgeLength(PgElementSet geom)Deprecated.UsegetEdgeLengths(PgElementSet, null, true).average()instead.static PdVectorcalcLinearGradient(PdVector v1, PdVector v2, PdVector v3, PdVector values, PdVector grad)Computes the gradient of a linear function defined by its values in 3 points in space.static PdVectorcalcLinearGradient(PdVector v0, PdVector v1, PdVector v2, PdVector v3, PdVector values, PdVector grad)Computes the gradient of a linear function in R^3 defined by its values in 4 points.static PdVectorcalcLinearGradient(PgElementSet geom, int elementIdx, PdVector values, PdVector grad)Calculates the gradient of a linear scalar function whose values is given at three vertices in an element.static PdVectorcalcLinearGradient(PgTetraSet geom, int tetraInd, PdVector values, PdVector grad)Calculates the gradient of a linear scalar function whose values is given at four vertices in a tetra.static PdVectorcalcLinearGradientNonConforming(PgElementSet geom, int elementIdx, PdVector values, PdVector grad)Calculates the gradient of a linear scalar function whose values is given at three vertices in an element.static PdVectorcomputeTextureAreas(PgElementSet geom)Compute area of all triangles in texture space.static PgVectorField[]deriveTexture(PgElementSet geom)Compute two vector fields as the gradients of the actual textures.static PdVectorgetEdgeLengths(PgElementSet geom, PdVector edgeLength, boolean bUseBoundaryEdges)Get array of all edge lengths of a mesh in the traditional neighbourhood based iteration.static PdVectorgetVertexAngles(PgElementSet geom, PdVector vertexAngle, boolean bUseBoundaryVertices)Get array of all vertex angles of a mesh ordered by elements.
-
-
-
Method Detail
-
getEdgeLengths
public static PdVector getEdgeLengths(PgElementSet geom, PdVector edgeLength, boolean bUseBoundaryEdges)
Get array of all edge lengths of a mesh in the traditional neighbourhood based iteration. If boundary edges are considered, then the length of the output array equalsgeom.getNumElementIndices(); it is less otherwise.- Parameters:
geom- Input geometry.edgeLength- Output array of edge lengths. May be null.bUseBoundaryEdges- Flag to specify whether boundary edges should be considered.- Version:
- 13.09.09, 1.01 revised (kp) Check for possible nullPtr of neighbour.
27.05.07, 1.00 created (kp)
-
getVertexAngles
public static PdVector getVertexAngles(PgElementSet geom, PdVector vertexAngle, boolean bUseBoundaryVertices)
Get array of all vertex angles of a mesh ordered by elements. If boundary vertices are used, then the length of the output array equalsgeom.getNumElementIndices(); it is less otherwise. The method works correct if all elements are convex.- Parameters:
geom- Input geometry.vertexAngle- Output array of vertex arrays. May be null.bUseBoundaryVertices- Flag to specify whether boundary vertices should be considered.- Version:
- 27.05.07, 1.00 created (kp)
-
averageEdgeLength
public static double averageEdgeLength(PgElementSet geom)
Deprecated. UsegetEdgeLengths(PgElementSet, null, true).average()instead.
-
calcLinearGradient
public static PdVector calcLinearGradient(PgElementSet geom, int elementIdx, PdVector values, PdVector grad)
Calculates the gradient of a linear scalar function whose values is given at three vertices in an element.- Parameters:
geom- Geometry containing the domain element.elementIdx- Index of the element. The element will be considered to be a triangle. If it has more vertices, only the first 3 vertices will be used.values- Values of the scalar function at the vertices. Must have a length of 3.grad- The gradient will be copied there and returned. May be null or must have a length of 3.- Author:
- Matthias Nieser
-
calcLinearGradientNonConforming
public static PdVector calcLinearGradientNonConforming(PgElementSet geom, int elementIdx, PdVector values, PdVector grad)
Calculates the gradient of a linear scalar function whose values is given at three vertices in an element.- Parameters:
geom- Geometry containing the domain element.elementIdx- Index of the element. The element will be considered to be a triangle. If it has more vertices, only the first 3 vertices will be used.values- Values of the scalar function at the vertices. Must have a length of 3.grad- The gradient will be copied there and returned. May be null or must have a length of 3.- Author:
- Matthias Nieser
-
calcLinearGradient
public static PdVector calcLinearGradient(PdVector v1, PdVector v2, PdVector v3, PdVector values, PdVector grad)
Computes the gradient of a linear function defined by its values in 3 points in space.- Parameters:
v1- First point in space.v2- Second point in space.v3- Third point in space.values- PdVector containing the 3 function values.grad- Output for the gradient vector. May be null.- Returns:
- The gradient of the linear function as a vector of same dimension as input points.
- Author:
- Matthias Nieser
- Version:
- 06.05.09, 1.20 revised (fk) Use simpler formula.
12.02.08, 1.10 revised (mn) Moved to dev.geom.PgUtil and comment it.
xx.xx.xx, 1.00 created (mn)
-
calcLinearGradient
public static PdVector calcLinearGradient(PgTetraSet geom, int tetraInd, PdVector values, PdVector grad)
Calculates the gradient of a linear scalar function whose values is given at four vertices in a tetra.- Parameters:
geom- Geometry containing the domain tetraset.tetraInd- Index of the tetra.values- Values of the scalar function at the vertices. Must have a length of 4.grad- The gradient will be copied there and returned. May be null or must have a length of 4.- Author:
- Matthias Nieser
- Version:
- 15.04.10, 1.00 created (mn)
-
calcLinearGradient
public static PdVector calcLinearGradient(PdVector v0, PdVector v1, PdVector v2, PdVector v3, PdVector values, PdVector grad)
Computes the gradient of a linear function in R^3 defined by its values in 4 points. Calculation: Let v0, v1, v2, v3 be the vertices with values x0, x1, x2, x3. Define:w1 = v1-v0, w2 = v2-v0, w3 = v3-v0 grad = g + ((s2-s0) - <g,w3>)(w1 x w2) *6/volume(tet), with g := gradient in plane (w1,w2)- Parameters:
v1- First point in space.v2- Second point in space.v3- Third point in space.values- PdVector containing the 4 function values.grad- Output for the gradient vector. May be null.- Returns:
- The gradient of the linear function as a vector of same dimension as input points.
- Author:
- Matthias Nieser
- Version:
- 15.04.10, 1.00 created (mn)
-
deriveTexture
public static PgVectorField[] deriveTexture(PgElementSet geom)
Compute two vector fields as the gradients of the actual textures.- Author:
- Matthias Nieser
- Version:
- 20.11.08, 1.00 created (mn)
-
computeTextureAreas
public static PdVector computeTextureAreas(PgElementSet geom)
Compute area of all triangles in texture space. The area value will be signed, i.e. negative area means, that the texture map for this triangle flips the orientation. Geometry must be triangulated.- Returns:
- Vector filled with area of each triangle in texture space.
- Author:
- Matthias Nieser
- Version:
- 31.08.09, 1.00 created (mn)
-
-
"