Easy3D 2.5.3
surface_mesh_factory.h
1/********************************************************************
2 * Copyright (C) 2020-2021 by Liangliang Nan <liangliang.nan@gmail.com>
3 * Copyright (C) 2011-2020 the Polygon Mesh Processing Library developers.
4 *
5 * The code in this file is adapted from the PMP (Polygon Mesh Processing
6 * Library) with modifications.
7 * https://github.com/pmp-library/pmp-library
8 * The original code was distributed under a MIT-style license, see
9 * https://github.com/pmp-library/pmp-library/blob/master/LICENSE.txt
10 ********************************************************************/
11
12#ifndef EASY3D_ALGO_SURFACE_MESH_FACTORY_H
13#define EASY3D_ALGO_SURFACE_MESH_FACTORY_H
14
15#include <easy3d/core/surface_mesh.h>
16
17namespace easy3d {
18
24 public:
26 static SurfaceMesh tetrahedron();
27
29 static SurfaceMesh hexahedron();
30
32 static SurfaceMesh octahedron();
33
36
38 static SurfaceMesh icosahedron();
39
43 static SurfaceMesh icosphere(size_t n_subdivisions = 3);
44
48 static SurfaceMesh quad_sphere(size_t n_subdivisions = 3);
49
51 static SurfaceMesh uv_sphere(const vec3 &center = vec3(0, 0, 0),
52 float radius = 1.0, size_t n_slices = 15, size_t n_stacks = 15);
53
58 static SurfaceMesh plane(size_t resolution = 4);
59
66 static SurfaceMesh cone(size_t n_subdivisions = 30, float radius = 1.0, float height = 2.5);
67
74 static SurfaceMesh cylinder(size_t n_subdivisions = 30, float radius = 1.0, float height = 2.5);
75
82 static SurfaceMesh
83 torus(size_t radial_resolution = 20, size_t tubular_resolution = 40, float radius = 1.0, float thickness = 0.4);
84 };
85
86} // namespace easy3d
87
88#endif // EASY3D_ALGO_SURFACE_MESH_FACTORY_H
Factory class to generate different types of basic shapes.
Definition: surface_mesh_factory.h:23
static SurfaceMesh uv_sphere(const vec3 &center=vec3(0, 0, 0), float 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.
Definition: surface_mesh_factory.cpp:155
static SurfaceMesh quad_sphere(size_t n_subdivisions=3)
Generate quad sphere refined by n_subdivisions .
Definition: surface_mesh_factory.cpp:146
static SurfaceMesh octahedron()
Generate octahedron.
Definition: surface_mesh_factory.cpp:77
static SurfaceMesh cone(size_t n_subdivisions=30, float radius=1.0, float height=2.5)
Generate a cone mesh.
Definition: surface_mesh_factory.cpp:241
static SurfaceMesh cylinder(size_t n_subdivisions=30, float radius=1.0, float height=2.5)
Generate a cylinder mesh.
Definition: surface_mesh_factory.cpp:275
static SurfaceMesh tetrahedron()
Generate tetrahedron.
Definition: surface_mesh_factory.cpp:34
static SurfaceMesh hexahedron()
Generate hexahedron.
Definition: surface_mesh_factory.cpp:54
static SurfaceMesh torus(size_t radial_resolution=20, size_t tubular_resolution=40, float radius=1.0, float thickness=0.4)
Generate a torus mesh.
Definition: surface_mesh_factory.cpp:321
static SurfaceMesh icosahedron()
Generate icosahedron.
Definition: surface_mesh_factory.cpp:91
static SurfaceMesh plane(size_t resolution=4)
Generate a plane mesh.
Definition: surface_mesh_factory.cpp:211
static SurfaceMesh dodecahedron()
Generate dodecahedron.
Definition: surface_mesh_factory.cpp:84
static SurfaceMesh icosphere(size_t n_subdivisions=3)
Generate icosphere refined by n_subdivisions .
Definition: surface_mesh_factory.cpp:137
A halfedge data structure for polygonal meshes of 2-manifold.
Definition: surface_mesh.h:52
Definition: collider.cpp:182
Vec< 3, float > vec3
A 3D point/vector of float type.
Definition: types.h:45