scenepic 1.1.0
3D Visualization Made Easy
|
This class enables efficient Loop subdivision of triangle meshes. More...
#include <loop_subdivision_stencil.h>
Public Member Functions | |
LoopSubdivisionStencil (TriangleBuffer triangles, SparseMatrix subdiv) | |
Constructor. More... | |
const ConstTriangleBufferRef | triangles () const |
Returns the triangles of the subdivided mesh. More... | |
VertexBuffer | apply (const ConstVertexBufferRef vertices) const |
Applies the stencil to a vertex buffer. More... | |
std::size_t | vertex_count () const |
The number of vertices in the subdivided mesh. More... | |
std::size_t | triangle_count () const |
The number of triangles in the subdivided mesh. More... | |
Static Public Member Functions | |
static LoopSubdivisionStencil | create (const ConstTriangleBufferRef triangles, int steps=1, bool project_to_limit=false) |
Creates a new stencil by subdividing the provided triangles. More... | |
This class enables efficient Loop subdivision of triangle meshes.
The subdivision stencil specifies what linear combinations of existing vertices are needed, and stencils can be reused across meshes with different vertex positions but identical triangle topologies. Thus, the constructor only takes the triangles, and caches the stencil. The stencil can be applied to a set of vertices using the apply() method.
scenepic::LoopSubdivisionStencil::LoopSubdivisionStencil | ( | TriangleBuffer | triangles, |
SparseMatrix | subdiv | ||
) |
Constructor.
triangles | the triangles of the subdivided mesh |
subdiv | the subdivision matrix of size (num_new_verts, num_old_verts) that maps old vertices to new ones |
VertexBuffer scenepic::LoopSubdivisionStencil::apply | ( | const ConstVertexBufferRef | vertices | ) | const |
Applies the stencil to a vertex buffer.
vertices | the vertices to map. |
|
static |
Creates a new stencil by subdividing the provided triangles.
triangles | the initial triangle indices |
steps | specifies how many steps of subdivision to apply. Defaults to 1. |
project_to_limit | specifies whether the vertices should be projected onto the limit surface in the final step of subdivision. Defaults to false. |
std::size_t scenepic::LoopSubdivisionStencil::triangle_count | ( | ) | const |
The number of triangles in the subdivided mesh.
const ConstTriangleBufferRef scenepic::LoopSubdivisionStencil::triangles | ( | ) | const |
Returns the triangles of the subdivided mesh.
std::size_t scenepic::LoopSubdivisionStencil::vertex_count | ( | ) | const |
The number of vertices in the subdivided mesh.