MCPcopy Create free account
hub / github.com/cutdigital/mcut / makeCube

Function makeCube

tests/source/intersectionType.cpp:91–201  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89}
90
91Mesh makeCube(McDouble halfExtent, McDouble translX, McDouble translY, McDouble translZ)
92{
93 const McDouble h = halfExtent;
94
95 Mesh m;
96 m.numVertices = 8;
97 m.numFaces = 6;
98 std::vector<McDouble>& verts = m.vertices;
99
100 verts.resize((McSize)m.numVertices*3);
101
102 // front
103
104 McInt32 i = 0;
105 // v0 - bottom left
106 verts[i++] = -h; // x
107 verts[i++] = -h; // y
108 verts[i++] = h; // z
109
110 // v1 - bottom right
111 verts[i++] = h; // x
112 verts[i++] = -h; // y
113 verts[i++] = h; // z
114
115 // v2 - top right
116 verts[i++] = h; // x
117 verts[i++] = h; // y
118 verts[i++] = h; // z
119
120 // v3 - top left
121 verts[i++] = -h; // x
122 verts[i++] = h; // y
123 verts[i++] = h; // z
124
125 // back
126
127 // v4 - bottom left
128 verts[i++] = -h; // x
129 verts[i++] = -h; // y
130 verts[i++] = -h; // z
131
132 // v5 - bottom right
133 verts[i++] = h; // x
134 verts[i++] = -h; // y
135 verts[i++] = -h; // z
136
137 // v6 - top right
138 verts[i++] = h; // x
139 verts[i++] = h; // y
140 verts[i++] = -h; // z
141
142 // v7 - top left
143 verts[i++] = -h; // x
144 verts[i++] = h; // y
145 verts[i++] = -h; // z
146
147 for (McInt32 j = 0; j < 8; ++j)
148 {

Callers 1

UTEST_FFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected