org.jcae.mesh.amibe.metrics
Class Quadric3DError
java.lang.Object
org.jcae.mesh.amibe.metrics.Quadric3DError
- All Implemented Interfaces:
- java.io.Serializable
public class Quadric3DError
- extends java.lang.Object
- implements java.io.Serializable
Garland's Quadric Error Metric. See
quadric error metrics.
A plane is fully determined by its normal N
and the signed
distance d
of the frame origin to this plane, or in other
words the equation of this plane is tN V + d = 0
.
The squared distance of a point to this plane is
D*D = (tN V + d) * (tN V + d)
= tV (N tN) V + 2d tN V + d*d
= tV A V + 2 tB V + c
The quadric Q=(A,B,c)=(N tN, dN, d*d)
is thus naturally
defined. Addition of these quadrics have a simple form:
Q1(V)+Q2(V)=(Q1+Q2)(V)
with
Q1+Q2=(A1+A2, B1+B2, c1+c2)
To compute the squared distance of a point to a set of planes, we can
then compute this quadric for each plane and sum each element of
these quadrics.
When an edge (V1,V2)
is contracted into V3
,
Q1(V3)+Q2(V3)
represents the deviation to the set of
planes at V1
and V2
. The cost of this
contraction is thus defined as Q1(V3)+Q2(V3)
.
We want to minimize this error. It can be shown that if A
is non singular, the optimal placement is for V3=-inv(A) B
.
- See Also:
- Serialized Form
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Quadric3DError
public Quadric3DError()
computeQuadric3DError
public void computeQuadric3DError(Quadric3DError q1,
Quadric3DError q2)
value
public double value(double[] vect)
addError
public void addError(double[] normal,
double d,
double a)
detA
public double detA()
optimalPlacement
public void optimalPlacement(Vertex v1,
Vertex v2,
Quadric3DError q1,
Quadric3DError q2,
Quadric3DError.Placement p,
Vertex ret)
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object