vertex_normals#
- iskra.geometry.normals.vertex_normals(verts: Tensor, faces: Tensor, method: Literal['default', 'graph', 'area', 'angle'] = 'default') Tensor[SOURCE]#
Comptues per-vertex normals.
Normals are computed per face and then reduced to the vertices using a a weighted average. The weighting is determined via the argument
method. The function works for triangle meshes in 3D and polylines in 2D.- Parameters:
verts (
Tensor[Float, [V, 2 | 3]]) – Mesh vertex positions.faces (
Tensor[Int, [F, 2 | 3]]) – Mesh face indices.method (Literal["default", "graph", "area", "angle"]) –
Normal averaging method. One of:
- `default`: selects angle weighing for triangle meshes and area
weighing for polyline meshes. Chosen by default.
- `area`: weighs each face normal by that face’s hypervolume,
approximating an integrated normal vector.
- `angle`: angle-based normal vectors based on the heuristic from
[TODO: cite]. By far the most visually pleasent, but only work on 3D meshes and a bit less theoretically justified than others.
`graph`: each face normal gets weight 1.0.
- Raises:
ValueError – Passing
method=anglefor a polyline mesh with raise an error.ValueError –
methodmust be in["default", "graph", "area", "angle"]`.NotImplementedError – Simplices must have either 2 or 3 corners.
- Returns:
(
Tensor[Float, [V, 2 | 3]]) – Vertex-based normals