org.jcae.mesh.amibe.metrics
Class Metric2D

java.lang.Object
  extended by org.jcae.mesh.amibe.metrics.Metric2D

public class Metric2D
extends java.lang.Object

2D metrics. This class provides metrics on the tangent plane. A Metric3D is computed and projected onto the tangent plane. This metric is then attached to the Vertex at which it is computed, and is used to compute distance to other vertices in Calculus3D. It can be shown that vertices at a distance D of a point lies on an ellipsis centered at P.

If multiple constraints are combined, ellipsis are intersected so that the resulting metrics fulfill all requirements. There are several ways to perform this intersection, here is how it is done in Matrix2D.intersection(Matrix2D). If A and B are 2D metrics, there exists a matrix P such that A=tP d(a1,a2) P and B=tP d(b1,b2) P, where d(x,y) is the diagonal matrix of coefficients x and y. Then the metric C=tP d(max(a1,b1),max(a2,b2)) P defines an ellipsis which is interior to both ellipsis.


Constructor Summary
Metric2D()
           
Metric2D(CADGeomSurface surf, Vertex pt, MeshParameters mp)
          Creates a Metric2D instance at a given point.
 
Method Summary
 double det()
          Return the determinant of this matrix.
 double distance2(double[] p1, double[] p2)
          Returns square distance between two points with this metrics.
 double dot(double x0, double y0, double x1, double y1)
          Return the dot product of two vectors in this Riemannian metrics.
 double[] getBounds2D()
          Return width and height of surrounding bounding box.
static boolean interpolateSpecial(Metric2D mFirstInv, Metric2D mSecond, Metric2D mRet)
          Compute interpolation between two metrics.
 boolean inv(Metric2D ret)
          Compute inverse matrix and stores result into its argument.
 boolean isPseudoIsotropic()
          Test whether this metrics is Euclidian.
 double[] orth(double x0, double y0)
          Return an orthogonal vector in this metrics.
 java.lang.String stringCoefs()
           
 java.lang.String stringCoefs(double scaleX, double scaleY)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Metric2D

public Metric2D(CADGeomSurface surf,
                Vertex pt,
                MeshParameters mp)
Creates a Metric2D instance at a given point.

Parameters:
surf - geometrical surface
pt - node where metrics is computed.

Metric2D

public Metric2D()
Method Detail

det

public double det()
Return the determinant of this matrix.

Returns:
the determinant of this matrix.

inv

public boolean inv(Metric2D ret)
Compute inverse matrix and stores result into its argument.

Returns:
false if metric is singular, true otherwise.

interpolateSpecial

public static boolean interpolateSpecial(Metric2D mFirstInv,
                                         Metric2D mSecond,
                                         Metric2D mRet)
Compute interpolation between two metrics. If M(A) and M(B) are metrics at point a and b, we want to compute inv((inv(M(A)) + inv(M(B)))/2). This method is called by SmoothNodes2D with A fixed and B being iteratively A's neighbours.

Parameters:
mFirstInv - inverse metric at first point
mSecond - metric at second point
mRet - allocated metric to store result
Returns:
true if interpolated metric can be computed, false otherwise

getBounds2D

public double[] getBounds2D()
Return width and height of surrounding bounding box.

Returns:
width and height of surrounding bounding box.

dot

public double dot(double x0,
                  double y0,
                  double x1,
                  double y1)
Return the dot product of two vectors in this Riemannian metrics.

Parameters:
x0 - first coordinate of the first vector.
y0 - second coordinate of the first vector.
x1 - first coordinate of the second vector.
y1 - second coordinate of the second vector.
Returns:
the dot product of two vectors in this Riemannian metrics.

orth

public double[] orth(double x0,
                     double y0)
Return an orthogonal vector in this metrics. This vector O is such that dot(transp(O), O) = 0. dot(transp(O), transp(O)) = det(M) dot(V, V). Warning: for efficiency reasons, the returned array is a static class variable.

Parameters:
x0 - first coordinate
y0 - second coordinate
Returns:
a static array containing the orthogal vector.

isPseudoIsotropic

public boolean isPseudoIsotropic()
Test whether this metrics is Euclidian.

Returns:
true if this metrics is quasi-Euclidian, false otherwise.

distance2

public double distance2(double[] p1,
                        double[] p2)
Returns square distance between two points with this metrics.

Parameters:
p1 - coordinates of the first node
p2 - coordinates of the second node
Returns:
square distance between two points with this metrics.

stringCoefs

public java.lang.String stringCoefs()

stringCoefs

public java.lang.String stringCoefs(double scaleX,
                                    double scaleY)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object