File tree Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -111,15 +111,15 @@ FixedPoint<> matrixDeterminant3(const Matrix33 *m);
111
111
* @param x The number to compute the square root of.
112
112
* @return psyqo::FixedPoint<> The square root.
113
113
*/
114
- psyqo:: FixedPoint<> squareRoot (psyqo:: FixedPoint<> x);
114
+ FixedPoint<> squareRoot (FixedPoint<> x);
115
115
116
116
/* *
117
117
* @brief Computes the norm of a 3D vector.
118
118
*
119
119
* @param v The vector.
120
120
* @return psyqo::FixedPoint<> The norm.
121
121
*/
122
- psyqo:: FixedPoint<> normOfVec3 (const Vec3 *v);
122
+ FixedPoint<> normOfVec3 (const Vec3 *v);
123
123
124
124
/* *
125
125
* @brief Normalizes a 3D vector.
@@ -128,6 +128,15 @@ psyqo::FixedPoint<> normOfVec3(const Vec3 *v);
128
128
*/
129
129
void normalizeVec3 (Vec3 *v);
130
130
131
+ /* *
132
+ * @brief Projects a 3D point onto a 2D plane.
133
+ *
134
+ * @param v The vector to project.
135
+ * @param h The height of the plane.
136
+ * @param out The vector to store the result in.
137
+ */
138
+ void project (const Vec3 *v, FixedPoint<> h, Vec2 *out);
139
+
131
140
} // namespace SoftMath
132
141
133
142
} // namespace psyqo
Original file line number Diff line number Diff line change @@ -231,3 +231,14 @@ void psyqo::SoftMath::normalizeVec3(Vec3 *v) {
231
231
v->y = y;
232
232
v->z = z;
233
233
}
234
+
235
+ void psyqo::SoftMath::project (const Vec3 *v, FixedPoint<> h, Vec2 *out) {
236
+ auto x = v->x ;
237
+ auto y = v->y ;
238
+ auto z = v->z ;
239
+ auto r = h / z;
240
+ x = x * r;
241
+ y = y * r;
242
+ out->x = x;
243
+ out->y = y;
244
+ }
You can’t perform that action at this time.
0 commit comments