net.von_gagern.martin.confoo.conformal
Class Conformal<V>

java.lang.Object
  extended by net.von_gagern.martin.confoo.conformal.Conformal<V>
Type Parameters:
V - the class used to represent vertices of the mesh
All Implemented Interfaces:
Callable<LocatedMesh<V>>

public class Conformal<V>
extends Object
implements Callable<LocatedMesh<V>>

Conformal transformations of triangle meshes.

A typical code snippet would look like this:

 Conformal<VertexType> c = Conformal.getInstance(mesh);
 c.fixedBoundaryCurvature(angles);
 c.transform();
 

Since:
1.0
Author:
Martin von Gagern
See Also:
Conformal Equivalence of Triangle Meshes by Springborn, Schröder and Pinkall

Method Summary
 LocatedMesh<V> call()
          Runnable interface to the transform method.
protected  void configureNewton(Newton newton)
          Configure the optimizer used for the transformation.
 void fixedBoundaryCurvature(Map<? extends V,Double> angles)
          Set boundary condition to given angles.
 double getAngleErrorBound()
          Get the maximal angle error during transformation.
static
<V> Conformal<V>
getInstance(MetricMesh<V> mesh)
          Convenience factory method.
 void isometricBoundaryCondition()
          Set boundary condition for preserved boundary edge lengths.
 void setAngleErrorBound(double epsilon)
          Set the maximal angle error during transformation.
 void throwInterceptedExceptions()
          Re-throw exceptions intercepted by call.
 LocatedMesh<V> transform()
          Perform transformation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static <V> Conformal<V> getInstance(MetricMesh<V> mesh)
                                throws MeshException
Convenience factory method. As the result type of this method can be derived from the argument type, you can do without the type argument, in contrast to a direct invocation of the constructor.

Type Parameters:
V - the class used to represent vertices of the mesh
Parameters:
mesh - the mesh to be transformed
Returns:
a transformer for the given mesh
Throws:
MeshException

setAngleErrorBound

public void setAngleErrorBound(double epsilon)
Set the maximal angle error during transformation. The default is 2e-14.

Parameters:
epsilon - the new error bound
See Also:
getAngleErrorBound()

getAngleErrorBound

public double getAngleErrorBound()
Get the maximal angle error during transformation.

Returns:
the bound for the maximum angle error
See Also:
setAngleErrorBound(double)

fixedBoundaryCurvature

public void fixedBoundaryCurvature(Map<? extends V,Double> angles)
Set boundary condition to given angles.

All vertices contained as keys in the map will be assigned a target angle according to the map value, given in radians. Other vertices will be assigned a target angle of 2π if they in the interior of the mesh or π if they lie on the boundary of the mesh. The result will be a polygon with corner angles specified by the map.

Parameters:
angles - the map of fixed corner angles
See Also:
isometricBoundaryCondition()

isometricBoundaryCondition

public void isometricBoundaryCondition()
Set boundary condition for preserved boundary edge lengths.

All boundary and corner vertices will be fixed in order to keep the lengths of boundary edges unmodified. Internal vertices will be assigned a target angle sum of 2π, resulting in a flat mesh.

See Also:
fixedBoundaryCurvature(Map)

transform

public LocatedMesh<V> transform()
                         throws MeshException,
                                TriangleInequalityException
Perform transformation. This is the main method of the class. Before this is invoked, you can tune the transformation process by setting various parameters.

Returns:
the transformed mesh
Throws:
IllegalStateException - if no boundary condition was set
MeshException - if the input mesh is malformed or too degenerate
TriangleInequalityException - if the result would violate the triangle inequality

configureNewton

protected void configureNewton(Newton newton)
Configure the optimizer used for the transformation.

Parameters:
newton - the optimizer to be configured

call

public LocatedMesh<V> call()
Runnable interface to the transform method.

This method allows performing the transformation in a different thread. However, as a call method may not throw any checked exceptions, special care has to be taken to catch these exceptions later on. The main thread that was waiting for the result should call throwInterceptedExceptions to re-throw any exceptions that occurred during execution in a different thread.

Any application not using multiple threads should rather call transform directly to deal with exceptions more easily.

Specified by:
call in interface Callable<LocatedMesh<V>>
Throws:
IllegalStateException - if there is an uncleared exception from a previous invocation
See Also:
transform(), throwInterceptedExceptions()

throwInterceptedExceptions

public void throwInterceptedExceptions()
                                throws MeshException
Re-throw exceptions intercepted by call. This method must be called after every invocation of call in order to clear and re-throw any exceptions which occurred during the execution of transform.

Throws:
MeshException
See Also:
call()


Copyright © 2008 Martin von Gagern. All Rights Reserved.