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<ResultMesh<V>>

public class Conformal<V>
extends Object
implements Callable<ResultMesh<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
 ResultMesh<V> call()
          Callable 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.
 Geometry getInputGeometry()
          Get the currently configured geometry of the input mesh.
static
<V> Conformal<V>
getInstance(MetricMesh<V> mesh)
          Convenience factory method.
 Geometry getOutputGeometry()
          Get the currently configured geometry of the output mesh.
 void isometricBoundaryCondition()
          Set boundary condition for preserved boundary edge lengths.
 void setAngleErrorBound(double epsilon)
          Set the maximal angle error during transformation.
 void setInputGeometry(Geometry inputGeometry)
          Set the geometry of the input mesh.
 void setLayoutStartTriangle(CorneredTriangle<? extends V> start)
          Set the triangle to be layed out first.
 void setOutputGeometry(Geometry outputGeometry)
          Set the geometry of the output mesh.
 void throwInterceptedExceptions()
          Re-throw exceptions intercepted by call.
 ResultMesh<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)

getInputGeometry

public Geometry getInputGeometry()
Get the currently configured geometry of the input mesh.

Since:
1.1
See Also:
setInputGeometry(net.von_gagern.martin.confoo.conformal.Geometry), getOutputGeometry()

setInputGeometry

public void setInputGeometry(Geometry inputGeometry)
Set the geometry of the input mesh.

Throws:
UnsupportedOperationException - if the geometry is neither EUCLIDEAN nor HYPERBOLIC
Since:
1.1
See Also:
getInputGeometry(), setOutputGeometry(net.von_gagern.martin.confoo.conformal.Geometry)

getOutputGeometry

public Geometry getOutputGeometry()
Get the currently configured geometry of the output mesh.

Since:
1.1
See Also:
setOutputGeometry(net.von_gagern.martin.confoo.conformal.Geometry), getInputGeometry()

setOutputGeometry

public void setOutputGeometry(Geometry outputGeometry)
Set the geometry of the output mesh.

Throws:
UnsupportedOperationException - if the geometry is neither EUCLIDEAN nor HYPERBOLIC
Since:
1.1
See Also:
getOutputGeometry(), setInputGeometry(net.von_gagern.martin.confoo.conformal.Geometry)

setLayoutStartTriangle

public void setLayoutStartTriangle(CorneredTriangle<? extends V> start)
Set the triangle to be layed out first. This triangle should be chosen to be pretty much in the center of the mesh, as errors increase with distance from this center. If not set, or set to null, a central triangle is automatically determined.

Parameters:
start - the triangle first to be layed out
Since:
1.1

transform

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

The returned object is defined to be a ResultMesh only since version 1.1. Before that it was only specified to be a LocatedMesh.

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
NoSuchVertexException - if a part of the boundary condition doesn't apply

configureNewton

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

Parameters:
newton - the optimizer to be configured

call

public ResultMesh<V> call()
Callable 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.

The returned object is defined to be a ResultMesh only since version 1.1. Before that it was only specified to be a LocatedMesh.

Specified by:
call in interface Callable<ResultMesh<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-2009 Martin von Gagern. All Rights Reserved.