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);
111111 * @param x The number to compute the square root of.
112112 * @return psyqo::FixedPoint<> The square root.
113113 */
114- psyqo:: FixedPoint<> squareRoot (psyqo:: FixedPoint<> x);
114+ FixedPoint<> squareRoot (FixedPoint<> x);
115115
116116/* *
117117 * @brief Computes the norm of a 3D vector.
118118 *
119119 * @param v The vector.
120120 * @return psyqo::FixedPoint<> The norm.
121121 */
122- psyqo:: FixedPoint<> normOfVec3 (const Vec3 *v);
122+ FixedPoint<> normOfVec3 (const Vec3 *v);
123123
124124/* *
125125 * @brief Normalizes a 3D vector.
@@ -128,6 +128,15 @@ psyqo::FixedPoint<> normOfVec3(const Vec3 *v);
128128 */
129129void normalizeVec3 (Vec3 *v);
130130
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+
131140} // namespace SoftMath
132141
133142} // namespace psyqo
Original file line number Diff line number Diff line change @@ -231,3 +231,14 @@ void psyqo::SoftMath::normalizeVec3(Vec3 *v) {
231231 v->y = y;
232232 v->z = z;
233233}
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