Volume Cartographer 2.27.0
Plane.hpp
Go to the documentation of this file.
1#pragma once
2
5#include "ShapePrimitive.hpp"
6
7namespace volcart::shapes
8{
23class Plane : public ShapePrimitive
24{
25public:
26 Plane(int width = 5, int height = 5)
27 {
28 // generate the points along the y-axis
29 double y = 0;
30 for (double x = 0; x < width; x += 1) {
31 for (double z = 0; z < height; z += 1) {
32 addVertex_(x, y, z);
33 }
34 }
35
36 // generate the cells
37 for (int i = 1; i < height; ++i) {
38 for (int j = 1; j < width; ++j) {
39 int v1, v2, v3, v4;
40 v1 = i * width + j;
41 v2 = v1 - 1;
42 v3 = v2 - width;
43 v4 = v1 - width;
44 addCell_(v1, v2, v3);
45 addCell_(v1, v3, v4);
46 }
47 }
48
49 // Set this as an ordered mesh
50 ordered_ = true;
51 orderedWidth_ = width;
52 orderedHeight_ = height;
53
54 } // Constructor
55
56}; // Plane
57} // namespace volcart::shapes
Planar surface shape.
Definition: Plane.hpp:24
Base class for shape generators.
void addVertex_(double x, double y, double z)
Add a new vertex to the shape.
void addCell_(int v1, int v2, int v3)
Add a new triangular face to the mesh from vertex IDs.
Shape and mesh primitives.