Easy3D 2.6.1
Loading...
Searching...
No Matches
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:
29 static SurfaceMesh tetrahedron();
30
35 static SurfaceMesh hexahedron();
36
41 static SurfaceMesh octahedron();
42
48
53 static SurfaceMesh icosahedron();
54
62 static SurfaceMesh icosphere(size_t n_subdivisions = 3);
63
71 static SurfaceMesh quad_sphere(size_t n_subdivisions = 3);
72
81 static SurfaceMesh uv_sphere(const vec3 &center = vec3(0, 0, 0),
82 float radius = 1.0, size_t n_slices = 15, size_t n_stacks = 15);
83
90 static SurfaceMesh plane(size_t resolution = 4);
91
100 static SurfaceMesh cone(size_t n_subdivisions = 30, float radius = 1.0, float height = 2.5);
101
110 static SurfaceMesh cylinder(size_t n_subdivisions = 30, float radius = 1.0, float height = 2.5);
111
121 static SurfaceMesh
122 torus(size_t radial_resolution = 20, size_t tubular_resolution = 40, float radius = 1.0, float thickness = 0.4);
123 };
124
125} // namespace easy3d
126
127#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 a UV sphere mesh with given parameters.
Definition surface_mesh_factory.cpp:155
static SurfaceMesh quad_sphere(size_t n_subdivisions=3)
Generate a quad sphere mesh refined by a given number of subdivisions. The initial hexahedron is refi...
Definition surface_mesh_factory.cpp:146
static SurfaceMesh octahedron()
Generate an octahedron mesh.
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 a tetrahedron mesh.
Definition surface_mesh_factory.cpp:34
static SurfaceMesh hexahedron()
Generate a hexahedron mesh.
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 an icosahedron mesh.
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 a dodecahedron mesh.
Definition surface_mesh_factory.cpp:84
static SurfaceMesh icosphere(size_t n_subdivisions=3)
Generate an icosphere mesh refined by a given number of subdivisions. The initial icosahedron is refi...
Definition surface_mesh_factory.cpp:137
A halfedge data structure for polygonal meshes of 2-manifold.
Definition surface_mesh.h:51
Definition collider.cpp:182
Vec< 3, float > vec3
A 3D point/vector of float type.
Definition types.h:44