31 int* numberOfCoordinatesPtr,
32 int* numberOfPointsPtr,
35 ASSERT(coordinatesPtrPtr != NULL,
36 "Cannot use null pointer while calculating coordinates");
47 *coordinatesPtrPtr = (
float*) malloc(numberOfCubeTriangleCoordinates *
sizeof(
float));
50 ASSERT(*coordinatesPtrPtr != NULL,
51 "Could not allocate memory for result array.")
73 const Vec3f pointA = {-1.0f, 1.0f, 1.0f};
74 const Vec3f pointB = {-1.0f, 1.0f, -1.0f};
75 const Vec3f pointC = { 1.0f, 1.0f, -1.0f};
76 const Vec3f pointD = { 1.0f, 1.0f, 1.0f};
77 const Vec3f pointE = {-1.0f, -1.0f, 1.0f};
78 const Vec3f pointF = {-1.0f, -1.0f, -1.0f};
79 const Vec3f pointG = { 1.0f, -1.0f, -1.0f};
80 const Vec3f pointH = { 1.0f, -1.0f, 1.0f};
85 (*coordinatesPtrPtr)[currentIndex++] = pointA.
x;
86 (*coordinatesPtrPtr)[currentIndex++] = pointA.
y;
87 (*coordinatesPtrPtr)[currentIndex++] = pointA.
z;
89 (*coordinatesPtrPtr)[currentIndex++] = pointB.
x;
90 (*coordinatesPtrPtr)[currentIndex++] = pointB.
y;
91 (*coordinatesPtrPtr)[currentIndex++] = pointB.
z;
93 (*coordinatesPtrPtr)[currentIndex++] = pointC.
x;
94 (*coordinatesPtrPtr)[currentIndex++] = pointC.
y;
95 (*coordinatesPtrPtr)[currentIndex++] = pointC.
z;
98 (*coordinatesPtrPtr)[currentIndex++] = pointA.
x;
99 (*coordinatesPtrPtr)[currentIndex++] = pointA.
y;
100 (*coordinatesPtrPtr)[currentIndex++] = pointA.
z;
102 (*coordinatesPtrPtr)[currentIndex++] = pointC.
x;
103 (*coordinatesPtrPtr)[currentIndex++] = pointC.
y;
104 (*coordinatesPtrPtr)[currentIndex++] = pointC.
z;
106 (*coordinatesPtrPtr)[currentIndex++] = pointD.
x;
107 (*coordinatesPtrPtr)[currentIndex++] = pointD.
y;
108 (*coordinatesPtrPtr)[currentIndex++] = pointD.
z;
112 (*coordinatesPtrPtr)[currentIndex++] = pointF.
x;;
113 (*coordinatesPtrPtr)[currentIndex++] = pointF.
y;;
114 (*coordinatesPtrPtr)[currentIndex++] = pointF.
z;;
116 (*coordinatesPtrPtr)[currentIndex++] = pointE.
x;
117 (*coordinatesPtrPtr)[currentIndex++] = pointE.
y;
118 (*coordinatesPtrPtr)[currentIndex++] = pointE.
z;
120 (*coordinatesPtrPtr)[currentIndex++] = pointH.
x;
121 (*coordinatesPtrPtr)[currentIndex++] = pointH.
y;
122 (*coordinatesPtrPtr)[currentIndex++] = pointH.
z;
125 (*coordinatesPtrPtr)[currentIndex++] = pointF.
x;
126 (*coordinatesPtrPtr)[currentIndex++] = pointF.
y;
127 (*coordinatesPtrPtr)[currentIndex++] = pointF.
z;
129 (*coordinatesPtrPtr)[currentIndex++] = pointH.
x;
130 (*coordinatesPtrPtr)[currentIndex++] = pointH.
y;
131 (*coordinatesPtrPtr)[currentIndex++] = pointH.
z;
133 (*coordinatesPtrPtr)[currentIndex++] = pointG.
x;
134 (*coordinatesPtrPtr)[currentIndex++] = pointG.
y;
135 (*coordinatesPtrPtr)[currentIndex++] = pointG.
z;
139 (*coordinatesPtrPtr)[currentIndex++] = pointG.
x;
140 (*coordinatesPtrPtr)[currentIndex++] = pointG.
y;
141 (*coordinatesPtrPtr)[currentIndex++] = pointG.
z;
143 (*coordinatesPtrPtr)[currentIndex++] = pointC.
x;
144 (*coordinatesPtrPtr)[currentIndex++] = pointC.
y;
145 (*coordinatesPtrPtr)[currentIndex++] = pointC.
z;
147 (*coordinatesPtrPtr)[currentIndex++] = pointB.
x;
148 (*coordinatesPtrPtr)[currentIndex++] = pointB.
y;
149 (*coordinatesPtrPtr)[currentIndex++] = pointB.
z;
152 (*coordinatesPtrPtr)[currentIndex++] = pointG.
x;
153 (*coordinatesPtrPtr)[currentIndex++] = pointG.
y;
154 (*coordinatesPtrPtr)[currentIndex++] = pointG.
z;
156 (*coordinatesPtrPtr)[currentIndex++] = pointB.
x;
157 (*coordinatesPtrPtr)[currentIndex++] = pointB.
y;
158 (*coordinatesPtrPtr)[currentIndex++] = pointB.
z;
160 (*coordinatesPtrPtr)[currentIndex++] = pointF.
x;
161 (*coordinatesPtrPtr)[currentIndex++] = pointF.
y;
162 (*coordinatesPtrPtr)[currentIndex++] = pointF.
z;
166 (*coordinatesPtrPtr)[currentIndex++] = pointE.
x;
167 (*coordinatesPtrPtr)[currentIndex++] = pointE.
y;
168 (*coordinatesPtrPtr)[currentIndex++] = pointE.
z;
170 (*coordinatesPtrPtr)[currentIndex++] = pointA.
x;
171 (*coordinatesPtrPtr)[currentIndex++] = pointA.
y;
172 (*coordinatesPtrPtr)[currentIndex++] = pointA.
z;
174 (*coordinatesPtrPtr)[currentIndex++] = pointD.
x;
175 (*coordinatesPtrPtr)[currentIndex++] = pointD.
y;
176 (*coordinatesPtrPtr)[currentIndex++] = pointD.
z;
179 (*coordinatesPtrPtr)[currentIndex++] = pointE.
x;
180 (*coordinatesPtrPtr)[currentIndex++] = pointE.
y;
181 (*coordinatesPtrPtr)[currentIndex++] = pointE.
z;
183 (*coordinatesPtrPtr)[currentIndex++] = pointD.
x;
184 (*coordinatesPtrPtr)[currentIndex++] = pointD.
y;
185 (*coordinatesPtrPtr)[currentIndex++] = pointD.
z;
187 (*coordinatesPtrPtr)[currentIndex++] = pointH.
x;
188 (*coordinatesPtrPtr)[currentIndex++] = pointH.
y;
189 (*coordinatesPtrPtr)[currentIndex++] = pointH.
z;
193 (*coordinatesPtrPtr)[currentIndex++] = pointH.
x;
194 (*coordinatesPtrPtr)[currentIndex++] = pointH.
y;
195 (*coordinatesPtrPtr)[currentIndex++] = pointH.
z;
197 (*coordinatesPtrPtr)[currentIndex++] = pointD.
x;
198 (*coordinatesPtrPtr)[currentIndex++] = pointD.
y;
199 (*coordinatesPtrPtr)[currentIndex++] = pointD.
z;
201 (*coordinatesPtrPtr)[currentIndex++] = pointC.
x;
202 (*coordinatesPtrPtr)[currentIndex++] = pointC.
y;
203 (*coordinatesPtrPtr)[currentIndex++] = pointC.
z;
206 (*coordinatesPtrPtr)[currentIndex++] = pointH.
x;
207 (*coordinatesPtrPtr)[currentIndex++] = pointH.
y;
208 (*coordinatesPtrPtr)[currentIndex++] = pointH.
z;
210 (*coordinatesPtrPtr)[currentIndex++] = pointC.
x;
211 (*coordinatesPtrPtr)[currentIndex++] = pointC.
y;
212 (*coordinatesPtrPtr)[currentIndex++] = pointC.
z;
214 (*coordinatesPtrPtr)[currentIndex++] = pointG.
x;
215 (*coordinatesPtrPtr)[currentIndex++] = pointG.
y;
216 (*coordinatesPtrPtr)[currentIndex++] = pointG.
z;
220 (*coordinatesPtrPtr)[currentIndex++] = pointF.
x;
221 (*coordinatesPtrPtr)[currentIndex++] = pointF.
y;
222 (*coordinatesPtrPtr)[currentIndex++] = pointF.
z;
224 (*coordinatesPtrPtr)[currentIndex++] = pointB.
x;
225 (*coordinatesPtrPtr)[currentIndex++] = pointB.
y;
226 (*coordinatesPtrPtr)[currentIndex++] = pointB.
z;
228 (*coordinatesPtrPtr)[currentIndex++] = pointA.
x;
229 (*coordinatesPtrPtr)[currentIndex++] = pointA.
y;
230 (*coordinatesPtrPtr)[currentIndex++] = pointA.
z;
233 (*coordinatesPtrPtr)[currentIndex++] = pointF.
x;
234 (*coordinatesPtrPtr)[currentIndex++] = pointF.
y;
235 (*coordinatesPtrPtr)[currentIndex++] = pointF.
z;
237 (*coordinatesPtrPtr)[currentIndex++] = pointA.
x;
238 (*coordinatesPtrPtr)[currentIndex++] = pointA.
y;
239 (*coordinatesPtrPtr)[currentIndex++] = pointA.
z;
241 (*coordinatesPtrPtr)[currentIndex++] = pointE.
x;
242 (*coordinatesPtrPtr)[currentIndex++] = pointE.
y;
243 (*coordinatesPtrPtr)[currentIndex++] = pointE.
z;
246 if (scalingFactor != 1.0
f)
254 if (numberOfCoordinatesPtr != NULL)
259 if (numberOfPointsPtr != NULL)
#define NUMBER_OF_TRIANGLE_VERTICES
Number of vertices which make up a triangle shape.
A 3D floating point vector.
#define NUMBER_OF_CUBE_FACES
Number of faces which make up a cubic shape.
int numberOfCubeTriangleCoordinates
static void getTriangleRepresentation(float scalingFactor, int *numberOfCoordinates, float **coordinates)
Compute coordinates of points which make up a cube.
#define NUMBER_OF_POINT_COORDINATES
Number of coordinates for a point in 3D space.
#define NUMBER_OF_TRIANGLES_IN_QUAD
Number of triangles which make up a quad.