Skip to content

Discrete Connections

A connection is an object from differential geometry that maps between tangent planes. On a manifold, tangent planes are the local planar approximation of the surface. When comparing objects living in two adjacent planes, one must first align the plane and their corresponding bases. This can be done by parallel transporting objects from one plane to the other.

On a surface mesh, this process is discrete and not differential. The parallel transport is then simply the angle formed by the two bases of the two planes.

Interesting blog post on the topic: http://wordpress.discretization.de/geometryprocessingandapplicationsws19/connections-and-parallel-transport/

SurfaceConnectionVertices

Bases: SurfaceConnection

Local bases and parallel transport defined between tangent planes of the mesh at the vertices

Reference

Globally Optimal Direction Fields, Knöppel et al. (2013)

Parameters:

Name Type Description Default
mesh SurfaceMesh

the supporting mesh

required
feat FeatureEdgeDetector

feature edges of the mesh. If not provided, will be initialized with a FeatureEdgeDetector object that flags only the boundary. Defaults to None.

None

Other Parameters:

Name Type Description
vnormals Attribute

An attribute representing the vertex normals. If not provided, will be computed at initialization

angles Attribute)

An attribute representing angles at corners of faces. If not provided, will be computed at initialization

base(i)

Local basis of element i

Parameters:

Name Type Description Default
i int

index

required

Returns:

Type Description
(Vec, Vec)

the X vector and Y vector of the tangent basis.

Note

cross(X,Y) is the normal of element i

transport(iA, iB)

summary

Parameters:

Name Type Description Default
iA int

first vertex index

required
iB int

second vertex index

required

Returns:

Name Type Description
float float

angle needed to change from basis of iA to basis of iB

SurfaceConnectionFaces

Bases: SurfaceConnection

Local bases and parallel transport defined between tangent planes of the mesh at the vertices

Reference

Globally Optimal Direction Fields, Knöppel et al. (2013)

Parameters:

Name Type Description Default
mesh SurfaceMesh

the supporting mesh

required
feat FeatureEdgeDetector

feature edges of the mesh. If not provided, will be initialized with a FeatureEdgeDetector object that flags only the boundary. Defaults to None.

None

base(i)

Local basis of element i

Parameters:

Name Type Description Default
i int

index

required

Returns:

Type Description
(Vec, Vec)

the X vector and Y vector of the tangent basis.

Note

cross(X,Y) is the normal of element i

transport(iA, iB)

summary

Parameters:

Name Type Description Default
iA int

first vertex index

required
iB int

second vertex index

required

Returns:

Name Type Description
float float

angle needed to change from basis of iA to basis of iB

DiscreteExponentialMap

https://en.wikipedia.org/wiki/Exponential_map_(Riemannian_geometry)

Usage

conn = SurfaceConnectionVertices(mesh)
expm = DiscreteExponentialMap(mesh, conn, rad)
expm.run({0, 2, 42}) # computes map for vertices 0, 2 and 42

expm.run() # computes map for all vertices

u,v = expm.map(0, 3) # coordinates of vertex 3 in exp map of vertex 0
u,v = expm.map(3, 0) # coordinates of vertex 0 in exp map of vertex 3. Exp map of 3 is computed on the go if necessary

Bases: Worker

References
  • [1] Interactive decal compositing with discrete exponential maps, Schmidt et al., 2006
Example

https://github.com/GCoiffier/mouette/blob/main/examples/expmap.py

Parameters:

Name Type Description Default
mesh SurfaceMesh

input surface mesh

required
conn SurfaceConnectionVertices

connection over vertices for the mesh.

required
radius int

Radius in number of edges of the exponential map of each vertex. Defaults to 2.

2
verbose bool

verbose options. Defaults to False.

False

_compute_map(u)

Computes map originating from vertex u for all vertices v at most at distance 'self.d' from u in terms of number of edges

export_map_as_mesh(v_source)

Exports the map of vertex v_source as a flat surface mesh for visualization purposes

Parameters:

Name Type Description Default
v_source int

source vertex index

required

Returns:

Name Type Description
SurfaceMesh SurfaceMesh

exponential map of v_source as a surface mesh

map(v_source, v_target)

Returns the uv-coordinates of v_target in the tangent plane of v_source. If the map of v_source was not computed, it is computed on the go.

Parameters:

Name Type Description Default
v_source int

target vertex index, center of the exponential map

required
v_target int

query vertex index

required

Returns:

Name Type Description
Vec

uv-coordinates of v_target as projected in the tangent plane of v_source. Returns None if v_target is not in the map of v_source (vertex is invalid or too far)