29 int* numberOfCoordinatesPtr)
31 ASSERT(normalsPtrPtr != NULL,
32 "Cannot use null pointer while calculating coordinates.");
40 *normalsPtrPtr = (
float*) malloc(numberOfNormalsCoordinates *
sizeof(
float));
43 ASSERT(*normalsPtrPtr != NULL,
44 "Could not allocate memory for result array.");
51 (*normalsPtrPtr)[currentIndex++] = 0.0f;
52 (*normalsPtrPtr)[currentIndex++] = 1.0f;
53 (*normalsPtrPtr)[currentIndex++] = 0.0f;
56 if (numberOfCoordinatesPtr != NULL)
58 *numberOfCoordinatesPtr = numberOfNormalsCoordinates;
64 int* numberOfCoordinatesPtr,
77 const Vec3f coordinatesOfPointA = {-1.0f, 0.0f, -1.0f };
78 const Vec3f coordinatesOfPointB = { 1.0f, 0.0f, -1.0f };
79 const Vec3f coordinatesOfPointC = { 1.0f, 0.0f, 1.0f };
80 const Vec3f coordinatesOfPointD = {-1.0f, 0.0f, 1.0f };
82 ASSERT(coordinatesPtrPtr != NULL,
83 "Cannot use null pointer while calculating plane coordinates.")
91 *coordinatesPtrPtr = (
float*) malloc(numberOfSquareCoordinates *
sizeof(
float));
94 ASSERT(*coordinatesPtrPtr != NULL,
95 "Could not allocate memory for plane coordinates result array.")
102 (*coordinatesPtrPtr)[currentIndex++] = coordinatesOfPointA.
x;
103 (*coordinatesPtrPtr)[currentIndex++] = coordinatesOfPointA.
y;
104 (*coordinatesPtrPtr)[currentIndex++] = coordinatesOfPointA.
z;
107 (*coordinatesPtrPtr)[currentIndex++] = coordinatesOfPointB.
x;
108 (*coordinatesPtrPtr)[currentIndex++] = coordinatesOfPointB.
y;
109 (*coordinatesPtrPtr)[currentIndex++] = coordinatesOfPointB.
z;
112 (*coordinatesPtrPtr)[currentIndex++] = coordinatesOfPointC.
x;
113 (*coordinatesPtrPtr)[currentIndex++] = coordinatesOfPointC.
y;
114 (*coordinatesPtrPtr)[currentIndex++] = coordinatesOfPointC.
z;
118 (*coordinatesPtrPtr)[currentIndex++] = coordinatesOfPointA.
x;
119 (*coordinatesPtrPtr)[currentIndex++] = coordinatesOfPointA.
y;
120 (*coordinatesPtrPtr)[currentIndex++] = coordinatesOfPointA.
z;
122 (*coordinatesPtrPtr)[currentIndex++] = coordinatesOfPointC.
x;
123 (*coordinatesPtrPtr)[currentIndex++] = coordinatesOfPointC.
y;
124 (*coordinatesPtrPtr)[currentIndex++] = coordinatesOfPointC.
z;
126 (*coordinatesPtrPtr)[currentIndex++] = coordinatesOfPointD.
x;
127 (*coordinatesPtrPtr)[currentIndex++] = coordinatesOfPointD.
y;
128 (*coordinatesPtrPtr)[currentIndex++] = coordinatesOfPointD.
z;
130 if (scalingFactor != 1.0
f)
132 for (
int i = 0; i < numberOfSquareCoordinates; i++)
138 if (numberOfCoordinatesPtr != NULL)
140 *numberOfCoordinatesPtr = numberOfSquareCoordinates;
static void getTriangleRepresentation(int *numberOfCoordinates, float **coordinates)
Get coordinates of points which make up a plane. The plane is located in XZ space.
#define NUMBER_OF_TRIANGLE_VERTICES
Number of vertices which make up a triangle shape.
A 3D floating point vector.
static void getNormals(int *numberOfCoordinates, float **normals)
Get normals for plane placed in XZ space.
#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.