ddg.datastructures.halfedge.math module
- ddg.datastructures.halfedge.math.dehomogenize(hds, co_attr_homogeneous='co', co_attr_affine='co', in_place=True, atol=None, rtol=None)[source]
Dehomogenize a hds, removing infinity crossings.
Let x_i = 0 be the hyperplane at infinity. The function works by deleting vertices that are in this plane and edges (and therefore faces) that cross this plane. This depends on the representative vectors!
- Parameters:
- hdsSurface
- co_attr_homogeneousstr (default=’co’)
Name of attribute that stores homogeneous coordinates.
- co_attr_affinestr (default=’co’)
Name of attribute to store affine coordinates after dehomogenizing.
- in_placebool (default=True)
Whether to modify the
hdsor create a copy. The copy will only have the attributesco_attr_homogeneousandco_attr_affine.
- Returns:
- hdsSurface
The dehomogenized hds. Either the original, modified object or a copy with vertex attributes with names given in
co_attr_homogeneousandco_attr_affine.
- ddg.datastructures.halfedge.math.laplace_invariant(edge, co_attr='co', line_family_attr=None, atol=0.0001)[source]
Function to compute the Laplace invariant of an interior edge.
Namely the cross ratio q(e.tail, L^{(i)}_{j}, e.head, L^{(i)}_{-j}), where L^{(i)}_{pm j} are the intersection points of the previous and next lines of the same line family with the line given by the given edge. A line family is interpreted as either one of the two directions (e.g. horizontal and vertical) introduced by the preimage lattice of mathbb{Z}^2.
If a boundary edge (or an edge where e.opp is a boundary edge) is given the return value is None.
- Parameters:
- edge: ddg.halfedge.Surface.edges
Edge to compute the laplace invariant from.
- co_attr: str (default=’co’)
Coordinate attribute at the vertices used for computation.
- line_family_attr: NodeAttribute
Attribute of edges, that distinguishes the horizontal and vertical family of lines. If given, and True on an edge, than the reciprocal of the computed value is set to this edge.
- atol: float (default=1e-4)
Tolerance to verify computations for coefficients of the planes induces by the quads of either two edges.
- Returns:
- float, None
float for interior edges and None for boundary edges
- ddg.datastructures.halfedge.math.laplace_invariant_cross(v, laplace_inv_attr)[source]
Function to compute the product of the laplace invariants of the four edges incident to a single vertex.
Enumerating successive edges in a vertex star (L_0 * L_2) / (L_1 * L_3) is the value that is returned. For discrete Koenigs nets this value is 1.
- Parameters:
- v: ddg.halfedge.Surface.verts
Vertex to compute the laplace invariant from.
- laplace_inv_attr: NodeAttribute of edges
Attribute to read the laplace invariants of the edges from. Can be set e.g. using the laplace_invariant function.
- Returns:
- float, None
None if the given vertex is a boundary vertex else the computed value
- ddg.datastructures.halfedge.math.laplace_invariant_quad(face, laplace_inv_attr)[source]
Function to return the product of the laplace invariants of the four edges incident to a face. Enumerating successive edges in a face (L_0 * L_2) / (L_1 * L_3) is the value that is returned. For a Q-net that is build from the intersection points of the diagonals of faces of a discrete Koenigs net (the Doliwa dual) this value is 1.
- Parameters:
- face: ddg.halfedge.Surface.faces
Face to compute the laplace invariant from.
- laplace_inv_attr: NodeAttribute of edges
Attribute to read the laplace invariants of the edges from. Can be set e.g. using the laplace_invariant function.
- Returns:
- float, None
None if the given face is a boundary face else the computed value