GitHub link
PMP
The Polygon Mesh Processing Library
SurfaceFactory Class Reference

Factory class to generate different types of basic shapes.

#include <pmp/algorithms/SurfaceFactory.h>

Static Public Member Functions

static SurfaceMesh tetrahedron ()
 Generate tetrahedron.
 
static SurfaceMesh hexahedron ()
 Generate hexahedron.
 
static SurfaceMesh octahedron ()
 Generate octahedron.
 
static SurfaceMesh dodecahedron ()
 Generate dodecahedron.
 
static SurfaceMesh icosahedron ()
 Generate icosahedron.
 
static SurfaceMesh icosphere (size_t n_subdivisions=3)
 Generate icosphere refined by n_subdivisions . More...
 
static SurfaceMesh quad_sphere (size_t n_subdivisions=3)
 Generate quad sphere refined by n_subdivisions . More...
 
static SurfaceMesh uv_sphere (const Point &center=Point(0, 0, 0), Scalar radius=1.0, size_t n_slices=15, size_t n_stacks=15)
 Generate UV sphere with given center, radius, n_slices, and n_stacks.
 
static SurfaceMesh plane (size_t resolution=4)
 Generate a plane mesh. More...
 
static SurfaceMesh cone (size_t n_subdivisions=30, Scalar radius=1.0, Scalar height=2.5)
 Generate a cone mesh. More...
 
static SurfaceMesh cylinder (size_t n_subdivisions=30, Scalar radius=1.0, Scalar height=2.5)
 Generate a cylinder mesh. More...
 
static SurfaceMesh torus (size_t radial_resolution=20, size_t tubular_resolution=40, Scalar radius=1.0, Scalar thickness=0.4)
 Generate a torus mesh. More...
 

Member Function Documentation

◆ cone()

SurfaceMesh cone ( size_t  n_subdivisions = 30,
Scalar  radius = 1.0,
Scalar  height = 2.5 
)
static

Generates a polygonal mesh of a cone. The circular base lies in the x-y-plane and the tip points in positive z-direction.

Parameters
n_subdivisionsNumber of subdivisions of the base circle. Needs to be >= 3. Default: 30.
radiusRadius of the base circle. Default: 1.
heightHeight of the the cone. Default: 2.5.

◆ cylinder()

SurfaceMesh cylinder ( size_t  n_subdivisions = 30,
Scalar  radius = 1.0,
Scalar  height = 2.5 
)
static

Generates a polygonal mesh of a cylinder. The cylinder is oriented in z-direction.

Parameters
n_subdivisionsNumber of subdivisions of the cylinder. Needs to be >= 3. Default: 30.
radiusRadius of the cylinder. Default: 1.
heightHeight of the cylinder. Default: 2.5.

◆ icosphere()

SurfaceMesh icosphere ( size_t  n_subdivisions = 3)
static

Uses Loop subdivision to refine the initial icosahedron.

See also
SurfaceSubdivision

◆ plane()

SurfaceMesh plane ( size_t  resolution = 4)
static

Generates a pure quad mesh in the x-y plane with origin (0,0,0) and side length 1.

Parameters
resolutionNumber of faces in each direction. Needs to be >= 1. Default: 4.

◆ quad_sphere()

SurfaceMesh quad_sphere ( size_t  n_subdivisions = 3)
static

Uses Catmull-Clark subdivision to refine the initial hexahedron.

See also
SurfaceSubdivision

◆ torus()

SurfaceMesh torus ( size_t  radial_resolution = 20,
size_t  tubular_resolution = 40,
Scalar  radius = 1.0,
Scalar  thickness = 0.4 
)
static

Generates a quad mesh of a torus with its major circle in the x-y plane.

Parameters
radial_resolutionNumber of subdivisions of the major circle. Needs to be >= 3. Default: 20.
tubular_resolutionNumber of subdivisions of along the tube. Needs to be >= 3. Default: 40.
radiusRadius of the major circle. Default: 1.
thicknessThickness of the tube. Default: 0.4.