Volume Cartographer
2.27.0
vc
core
shapes
Cube.hpp
Go to the documentation of this file.
1
#pragma once
2
5
#include <cmath>
6
7
#include "
ShapePrimitive.hpp
"
8
9
namespace
volcart::shapes
10
{
26
class
Cube
:
public
ShapePrimitive
27
{
28
public
:
29
Cube
(
double
len = 5)
30
{
31
// generate the 8 vertices
32
addVertex_
(0, 0, 0);
33
addVertex_
(0, len, 0);
34
addVertex_
(len, len, 0);
35
addVertex_
(len, 0, 0);
36
37
addVertex_
(0, 0, len);
38
addVertex_
(0, len, len);
39
addVertex_
(len, len, len);
40
addVertex_
(len, 0, len);
41
42
// generate the 12 cells for faces
43
addCell_
(0, 1, 2);
44
addCell_
(0, 2, 3);
45
addCell_
(3, 2, 6);
46
addCell_
(3, 6, 7);
47
addCell_
(7, 6, 5);
48
addCell_
(7, 5, 4);
49
addCell_
(4, 5, 1);
50
addCell_
(4, 1, 0);
51
addCell_
(0, 3, 7);
52
addCell_
(0, 7, 4);
53
addCell_
(5, 6, 2);
54
addCell_
(5, 2, 1);
55
}
// Constructor
56
57
};
// Cube
58
}
// namespace volcart::shapes
ShapePrimitive.hpp
volcart::shapes::Cube
Cube shape.
Definition:
Cube.hpp:27
volcart::shapes::ShapePrimitive
Base class for shape generators.
Definition:
ShapePrimitive.hpp:42
volcart::shapes::ShapePrimitive::addVertex_
void addVertex_(double x, double y, double z)
Add a new vertex to the shape.
volcart::shapes::ShapePrimitive::addCell_
void addCell_(int v1, int v2, int v3)
Add a new triangular face to the mesh from vertex IDs.
volcart::shapes
Shape and mesh primitives.
Generated by
1.9.4