Blender V5.3
BLI_math_geom_hh_test.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2024 Blender Authors
2 *
3 * SPDX-License-Identifier: Apache-2.0 */
4
13
14#include "testing/testing.h"
15
16#include "BLI_math_geom.hh"
17#include "BLI_math_geom_c.hh"
18#include "BLI_vector.hh"
19
20namespace blender::math {
21
22/* -------------------------------------------------------------------- */
25
26TEST(math_geom_hh, NormalQuad)
27{
28 const float3 v1(0, 0, 0), v2(1, 0, 0), v3(1, 1, 0), v4(0, 1, 0);
29
30 float c_n[3];
31 normal_quad_v3(c_n, &v1.x, &v2.x, &v3.x, &v4.x);
32
33 const float3 n = normal_quad(v1, v2, v3, v4);
34 EXPECT_NEAR(c_n[0], n.x, 1e-6f);
35 EXPECT_NEAR(c_n[1], n.y, 1e-6f);
36 EXPECT_NEAR(c_n[2], n.z, 1e-6f);
37}
38
39TEST(math_geom_hh, AreaTri)
40{
41 /* Unit right triangle in XY plane: area = 0.5. */
42 const float3 v1(0, 0, 0), v2(1, 0, 0), v3(0, 1, 0);
43 EXPECT_NEAR(0.5f, area_tri(v1, v2, v3), 1e-6f);
44
45 /* Cross-check with C API. */
46 EXPECT_NEAR(area_tri_v3(&v1.x, &v2.x, &v3.x), area_tri(v1, v2, v3), 1e-6f);
47
48 /* Degenerate triangle (all same point): area = 0. */
49 const float3 degen(1, 2, 3);
50 EXPECT_NEAR(0.0f, area_tri(degen, degen, degen), 1e-6f);
51}
52
53TEST(math_geom_hh, CotangentTriWeight)
54{
55 /* Equilateral triangle: all cotangent weights are equal (cot 60° ≈ 0.5774). */
56 const float sq3 = std::sqrt(3.0f);
57 const float3 v1(0, 0, 0), v2(1, 0, 0), v3(0.5f, sq3 * 0.5f, 0);
59 cotangent_tri_weight_v3(&v1.x, &v2.x, &v3.x), cotangent_tri_weight(v1, v2, v3), 1e-5f);
60
61 /* Degenerate (all on same point): returns 0. */
62 const float3 degen(1, 0, 0);
63 EXPECT_NEAR(0.0f, cotangent_tri_weight(degen, degen, degen), 1e-6f);
64}
65
67
68/* -------------------------------------------------------------------- */
71
72TEST(math_geom_hh, PlaneFromPointNormal)
73{
74 const float3 co(1, 2, 3), no(0, 0, 1);
75
76 float c_plane[4];
77 plane_from_point_normal_v3(c_plane, &co.x, &no.x);
78
79 const float4 plane = plane_from_point_normal(co, no);
80 EXPECT_NEAR(c_plane[0], plane.x, 1e-6f);
81 EXPECT_NEAR(c_plane[1], plane.y, 1e-6f);
82 EXPECT_NEAR(c_plane[2], plane.z, 1e-6f);
83 EXPECT_NEAR(c_plane[3], plane.w, 1e-6f);
84}
85
86TEST(math_geom_hh, PlanePointSide)
87{
88 /* Plane: z = 0, normal pointing +Z, offset 0. */
89 const float4 plane(0, 0, 1, 0);
90 EXPECT_NEAR(1.0f, plane_point_side(plane, float3(0, 0, 1)), 1e-6f);
91 EXPECT_NEAR(-1.0f, plane_point_side(plane, float3(0, 0, -1)), 1e-6f);
92 EXPECT_NEAR(0.0f, plane_point_side(plane, float3(5, 7, 0)), 1e-6f);
93
94 /* Cross-check with C API. */
95 const float3 pt(1, 2, 3);
96 const float c_plane[4] = {plane.x, plane.y, plane.z, plane.w};
97 EXPECT_NEAR(plane_point_side_v3(c_plane, &pt.x), plane_point_side(plane, pt), 1e-6f);
98}
99
101
102/* -------------------------------------------------------------------- */
105
106TEST(math_geom_hh, DistSquaredToLineSegment2D)
107{
108 /* Point directly past end of segment: distance to endpoint. */
109 const float2 p(3, 1), l1(0, 0), l2(2, 0);
112 1e-6f);
113
114 /* Point beside the middle of the segment. */
115 const float2 p2(1, 2), l3(0, 0), l4(2, 0);
116 EXPECT_NEAR(dist_squared_to_line_segment_v2(&p2.x, &l3.x, &l4.x),
118 1e-6f);
119
120 /* Degenerate segment (l1 == l2). */
121 const float2 p3(1, 1), degen(0, 0);
122 EXPECT_NEAR(2.0f, dist_squared_to_line_segment(p3, degen, degen), 1e-6f);
123}
124
125TEST(math_geom_hh, DistSquaredToLineSegment3D)
126{
127 const float3 p(0, 1, 0), l1(0, 0, 0), l2(1, 0, 0);
130 1e-6f);
131}
132
133TEST(math_geom_hh, ClosestToLineSegment3D)
134{
135 const float3 p(0.5f, 1.0f, 0.0f), l1(0, 0, 0), l2(1, 0, 0);
136
137 float c_r[3];
138 closest_to_line_segment_v3(c_r, &p.x, &l1.x, &l2.x);
139
140 const float3 r = closest_to_line_segment(p, l1, l2);
141 EXPECT_NEAR(c_r[0], r.x, 1e-6f);
142 EXPECT_NEAR(c_r[1], r.y, 1e-6f);
143 EXPECT_NEAR(c_r[2], r.z, 1e-6f);
144
145 /* Degenerate segment: closest point is l1. */
146 const float3 degen(1, 1, 1);
147 const float3 r_degen = closest_to_line_segment(p, degen, degen);
148 EXPECT_NEAR(degen.x, r_degen.x, 1e-6f);
149 EXPECT_NEAR(degen.y, r_degen.y, 1e-6f);
150 EXPECT_NEAR(degen.z, r_degen.z, 1e-6f);
151}
152
153TEST(math_geom_hh, ClosestToPlaneNormalized)
154{
155 /* Plane: z = 1, normal (0,0,1). */
156 const float4 plane(0, 0, 1, -1);
157 const float3 pt(3, 4, 5);
158
159 float c_r[3];
160 closest_to_plane_normalized_v3(c_r, reinterpret_cast<const float *>(&plane), &pt.x);
161
162 const float3 r = closest_to_plane_normalized(plane, pt);
163 EXPECT_NEAR(c_r[0], r.x, 1e-6f);
164 EXPECT_NEAR(c_r[1], r.y, 1e-6f);
165 EXPECT_NEAR(c_r[2], r.z, 1e-6f);
166}
167
168TEST(math_geom_hh, ClosestToPlane)
169{
170 /* Plane: z = 1, with a non-unit normal (0, 0, 2). */
171 const float4 plane(0, 0, 2, -2);
172 const float3 pt(3, 4, 5);
173
174 float c_r[3];
175 closest_to_plane_v3(c_r, reinterpret_cast<const float *>(&plane), &pt.x);
176
177 const float3 r = closest_to_plane(plane, pt);
178 EXPECT_NEAR(c_r[0], r.x, 1e-6f);
179 EXPECT_NEAR(c_r[1], r.y, 1e-6f);
180 EXPECT_NEAR(c_r[2], r.z, 1e-6f);
181 /* The projected z should be 1.0. */
182 EXPECT_NEAR(1.0f, r.z, 1e-6f);
183}
184
185TEST(math_geom_hh, DistSquaredToPlane)
186{
187 /* Unit-normal plane at z = 0; point at z = 2 -> distance^2 = 4. */
188 const float4 unit_plane(0, 0, 1, 0);
189 const float3 pt(0, 0, 2);
190 EXPECT_NEAR(dist_squared_to_plane_v3(&pt.x, reinterpret_cast<const float *>(&unit_plane)),
191 dist_squared_to_plane(pt, unit_plane),
192 1e-6f);
193 EXPECT_NEAR(4.0f, dist_squared_to_plane(pt, unit_plane), 1e-6f);
194
195 /* Non-unit normal (0, 0, 2); same geometric plane, same result. */
196 const float4 scaled_plane(0, 0, 2, 0);
197 EXPECT_NEAR(dist_squared_to_plane_v3(&pt.x, reinterpret_cast<const float *>(&scaled_plane)),
198 dist_squared_to_plane(pt, scaled_plane),
199 1e-6f);
200}
201
203
204/* -------------------------------------------------------------------- */
207
208TEST(math_geom_hh, LinePointFactor3D)
209{
210 const float3 p(0.5f, 1.0f, 0.0f), l1(0, 0, 0), l2(1, 0, 0);
211 EXPECT_NEAR(line_point_factor_v3(&p.x, &l1.x, &l2.x), line_point_factor(p, l1, l2), 1e-6f);
212
213 /* Degenerate: returns 0. */
214 EXPECT_NEAR(0.0f, line_point_factor(p, l1, l1), 1e-6f);
215}
216
217TEST(math_geom_hh, LinePointFactor2D)
218{
219 const float2 p(0.5f, 1.0f), l1(0, 0), l2(1, 0);
220 EXPECT_NEAR(line_point_factor_v2(&p.x, &l1.x, &l2.x), line_point_factor(p, l1, l2), 1e-6f);
221}
222
224
225/* -------------------------------------------------------------------- */
228
229TEST(math_geom_hh, AxisDominantToM3)
230{
231 const float3 normal = normalize(float3(0, 0, 1));
232 float c_mat[3][3];
233 axis_dominant_v3_to_m3(c_mat, &normal.x);
234
235 const float3x3 mat = axis_dominant_to_m3(normal);
236 for (int col = 0; col < 3; col++) {
237 for (int row = 0; row < 3; row++) {
238 EXPECT_NEAR(c_mat[col][row], mat[col][row], 1e-6f);
239 }
240 }
241}
242
244
245/* -------------------------------------------------------------------- */
248
249TEST(math_geom_hh, IsectLineLine3D)
250{
251 /* Two perpendicular lines crossing at origin. */
252 const float3 v1(-1, 0, 0), v2(1, 0, 0), v3(0, -1, 0), v4(0, 1, 0);
253 float3 r_i1, r_i2;
254 const int count = isect_line_line(v1, v2, v3, v4, r_i1, r_i2);
255 EXPECT_EQ(1, count);
256 EXPECT_NEAR(0.0f, r_i1.x, 1e-5f);
257 EXPECT_NEAR(0.0f, r_i1.y, 1e-5f);
258}
259
260TEST(math_geom_hh, IsectLinePlane)
261{
262 /* Line along Z, plane at z = 1 (normal = Z, point = (0,0,1)). */
263 const float3 l1(0, 0, 0), l2(0, 0, 2);
264 const float3 plane_co(0, 0, 1), plane_no(0, 0, 1);
265 const std::optional<float3> hit = isect_line_plane(l1, l2, plane_co, plane_no);
266 ASSERT_TRUE(hit.has_value());
267 EXPECT_NEAR(0.0f, hit->x, 1e-6f);
268 EXPECT_NEAR(0.0f, hit->y, 1e-6f);
269 EXPECT_NEAR(1.0f, hit->z, 1e-6f);
270
271 /* Parallel line: no intersection. */
272 const float3 l3(0, 0, 0), l4(1, 0, 0);
273 EXPECT_FALSE(isect_line_plane(l3, l4, plane_co, plane_no).has_value());
274}
275
276TEST(math_geom_hh, IsectPointTri2D)
277{
278 const float2 v1(-1, 0), v2(1, 0), v3(0, 2);
279
280 /* Inside CCW triangle. */
281 EXPECT_EQ(1, isect_point_tri(float2(0, 0.5f), v1, v2, v3));
282 /* Outside. */
283 EXPECT_EQ(0, isect_point_tri(float2(0, 3), v1, v2, v3));
284 /* CW winding. */
285 EXPECT_EQ(-1, isect_point_tri(float2(0, 0.5f), v3, v2, v1));
286}
287
288TEST(math_geom_hh, IsectPointQuad2D)
289{
290 const float2 v1(0, 0), v2(2, 0), v3(2, 2), v4(0, 2);
291
292 /* Inside CCW quad. */
293 EXPECT_EQ(1, isect_point_quad(float2(1, 1), v1, v2, v3, v4));
294 /* Outside. */
295 EXPECT_EQ(0, isect_point_quad(float2(3, 1), v1, v2, v3, v4));
296 /* CW winding. */
297 EXPECT_EQ(-1, isect_point_quad(float2(1, 1), v4, v3, v2, v1));
298
299 /* Cross-check with C API (float specialization). */
300 const float2 p_inside(1, 1);
301 EXPECT_EQ(isect_point_quad_v2(&p_inside.x, &v1.x, &v2.x, &v3.x, &v4.x),
302 isect_point_quad(float2(1, 1), v1, v2, v3, v4));
303}
304
305TEST(math_geom_hh, IsectPointPoly)
306{
307 /* Unit square as polygon (use Vector so Span<float2> deduction works). */
308 Vector<float2> verts = {{0, 0}, {1, 0}, {1, 1}, {0, 1}};
309 EXPECT_TRUE(isect_point_poly(float2(0.5f, 0.5f), verts));
310 EXPECT_FALSE(isect_point_poly(float2(2.0f, 0.5f), verts));
311
312 /* Cross-check with C API. */
313 const float2 pt_in(0.5f, 0.5f);
315 &pt_in.x, reinterpret_cast<const float (*)[2]>(verts.data()), uint(verts.size())),
316 isect_point_poly(pt_in, verts));
317}
318
320
321/* -------------------------------------------------------------------- */
324
325TEST(math_geom_hh, BarycentricWeights)
326{
327 const float2 v1(0, 0), v2(1, 0), v3(0, 1);
328
329 /* Centroid: weights should all be ~1/3. */
330 const float2 centroid(1.0f / 3.0f, 1.0f / 3.0f);
331
332 float c_w[3];
333 barycentric_weights_v2(&v1.x, &v2.x, &v3.x, &centroid.x, c_w);
334
335 const float3 w = barycentric_weights(v1, v2, v3, centroid);
336 EXPECT_NEAR(c_w[0], w.x, 1e-6f);
337 EXPECT_NEAR(c_w[1], w.y, 1e-6f);
338 EXPECT_NEAR(c_w[2], w.z, 1e-6f);
339 EXPECT_NEAR(1.0f / 3.0f, w.x, 1e-5f);
340}
341
343
344/* -------------------------------------------------------------------- */
347
348TEST(math_geom_hh, PolyToTriCount)
349{
350 /* 1 quad (4 corners): 1 * (4-2) = 2 triangles. */
352 /* 2 triangles (6 corners): 2 * (3-2) = 2 triangles. */
354 /* Cross-check with the C-style macro. */
356}
357
358TEST(math_geom_hh, AreaPoly)
359{
360 /* Unit square: area = 1. */
361 Vector<float2> verts = {{0, 0}, {1, 0}, {1, 1}, {0, 1}};
362 EXPECT_NEAR(1.0f, area_poly(verts), 1e-6f);
363
364 /* Cross-check with C API. */
365 EXPECT_NEAR(area_poly_v2(reinterpret_cast<const float (*)[2]>(verts.data()), uint(verts.size())),
366 area_poly(verts),
367 1e-6f);
368
369 /* Triangle with base 2, height 1: area = 1. */
370 Vector<float2> tri = {{0, 0}, {2, 0}, {1, 1}};
371 EXPECT_NEAR(1.0f, area_poly(tri), 1e-6f);
372}
373
374TEST(math_geom_hh, InterpWeightsPoly)
375{
376 /* Centroid of a unit square: all four weights should be 0.25. */
377 Vector<float2> verts = {{0, 0}, {1, 0}, {1, 1}, {0, 1}};
378 float w[4];
379 interp_weights_poly(MutableSpan(w, 4), verts, float2(0.5f, 0.5f));
380 for (int i = 0; i < 4; i++) {
381 EXPECT_NEAR(0.25f, w[i], 1e-5f);
382 }
383
384 /* Cross-check with C API. */
385 float c_w[4];
387 c_w, reinterpret_cast<float (*)[2]>(verts.data()), int(verts.size()), float2(0.5f, 0.5f));
388 for (int i = 0; i < 4; i++) {
389 EXPECT_NEAR(c_w[i], w[i], 1e-6f);
390 }
391}
392
394
395/* -------------------------------------------------------------------- */
398
399TEST(math_geom_hh, InterpBilinearQuad)
400{
401 /* Unit square in 3D (CCW order matching interp_bilinear_quad_v3 convention):
402 * v3(0,1,0)---v2(1,1,0)
403 * | |
404 * v0(0,0,0)---v1(1,0,0)
405 */
406 const float3 v0(0, 0, 0), v1(1, 0, 0), v2(1, 1, 0), v3(0, 1, 0);
407
408 /* Center (u=0.5, v=0.5) should give (0.5, 0.5, 0). */
409 const float3 center = interp_bilinear_quad(v0, v1, v2, v3, 0.5f, 0.5f);
410 EXPECT_NEAR(0.5f, center.x, 1e-6f);
411 EXPECT_NEAR(0.5f, center.y, 1e-6f);
412 EXPECT_NEAR(0.0f, center.z, 1e-6f);
413
414 /* Cross-check with C API at (u=0.25, v=0.75). */
415 float quad[4][3] = {
416 {v0.x, v0.y, v0.z}, {v1.x, v1.y, v1.z}, {v2.x, v2.y, v2.z}, {v3.x, v3.y, v3.z}};
417 float c_res[3];
418 interp_bilinear_quad_v3(quad, 0.25f, 0.75f, c_res);
419 const float3 res = interp_bilinear_quad(v0, v1, v2, v3, 0.25f, 0.75f);
420 EXPECT_NEAR(c_res[0], res.x, 1e-6f);
421 EXPECT_NEAR(c_res[1], res.y, 1e-6f);
422 EXPECT_NEAR(c_res[2], res.z, 1e-6f);
423
424 /* Corners. */
425 EXPECT_EQ(v0, interp_bilinear_quad(v0, v1, v2, v3, 0.0f, 0.0f));
426 EXPECT_EQ(v1, interp_bilinear_quad(v0, v1, v2, v3, 1.0f, 0.0f));
427 EXPECT_EQ(v2, interp_bilinear_quad(v0, v1, v2, v3, 1.0f, 1.0f));
428 EXPECT_EQ(v3, interp_bilinear_quad(v0, v1, v2, v3, 0.0f, 1.0f));
429}
430
432
433/* -------------------------------------------------------------------- */
436
437TEST(math_geom_hh, MapToSphere)
438{
439 /* +Z should give v = 0 (north pole) - check C vs. new API agree. */
440 const float3 up(0, 0, 1);
441 float c_u, c_v;
442 blender::map_to_sphere(&c_u, &c_v, up.x, up.y, up.z);
443
444 const float2 uv = map_to_sphere(up);
445 EXPECT_NEAR(c_u, uv.x, 1e-6f);
446 EXPECT_NEAR(c_v, uv.y, 1e-6f);
447}
448
450
451} // namespace blender::math
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
Definition btQuadWord.h:119
constexpr MutableSpan()=default
int64_t size() const
#define EXPECT_FALSE(result)
#define EXPECT_TRUE(result)
#define EXPECT_NEAR(result, expect, threshold)
int isect_point_tri(const VecBase< T, 2 > &pt, const VecBase< T, 2 > &v1, const VecBase< T, 2 > &v2, const VecBase< T, 2 > &v3)
int isect_point_quad(const VecBase< T, 2 > &p, const VecBase< T, 2 > &v1, const VecBase< T, 2 > &v2, const VecBase< T, 2 > &v3, const VecBase< T, 2 > &v4)
T cotangent_tri_weight(const VecBase< T, 3 > &v1, const VecBase< T, 3 > &v2, const VecBase< T, 3 > &v3)
TEST(math_geom_hh, NormalQuad)
float3x3 axis_dominant_to_m3(const float3 &normal)
T dist_squared_to_line_segment(const VecBase< T, Size > &p, const VecBase< T, Size > &l1, const VecBase< T, Size > &l2)
VecBase< T, Size > closest_to_line_segment(const VecBase< T, Size > &p, const VecBase< T, Size > &l1, const VecBase< T, Size > &l2)
VecBase< T, 3 > interp_bilinear_quad(const VecBase< T, 3 > &v0, const VecBase< T, 3 > &v1, const VecBase< T, 3 > &v2, const VecBase< T, 3 > &v3, const T u, const T v)
T dist_squared_to_plane(const VecBase< T, 3 > &p, const VecBase< T, 4 > &plane)
float2 map_to_sphere(const float3 &co)
T plane_point_side(const VecBase< T, 4 > &plane, const VecBase< T, 3 > &co)
std::optional< float3 > isect_line_plane(const float3 &l1, const float3 &l2, const float3 &plane_co, const float3 &plane_no)
constexpr int poly_to_tri_count(const int poly_count, const int corner_count)
T area_tri(const VecBase< T, 3 > &v1, const VecBase< T, 3 > &v2, const VecBase< T, 3 > &v3)
VecBase< T, 3 > closest_to_plane_normalized(const VecBase< T, 4 > &plane, const VecBase< T, 3 > &pt)
MatBase< T, NumCol, NumRow > normalize(const MatBase< T, NumCol, NumRow > &a)
VecBase< T, 3 > normal_quad(const VecBase< T, 3 > &v1, const VecBase< T, 3 > &v2, const VecBase< T, 3 > &v3, const VecBase< T, 3 > &v4)
float3 barycentric_weights(const float2 &v1, const float2 &v2, const float2 &v3, const float2 &co)
float area_poly(Span< float2 > verts)
int isect_line_line(const float3 &v1, const float3 &v2, const float3 &v3, const float3 &v4, float3 &r_i1, float3 &r_i2)
VecBase< T, 4 > plane_from_point_normal(const VecBase< T, 3 > &co, const VecBase< T, 3 > &no)
T line_point_factor(const VecBase< T, Size > &p, const VecBase< T, Size > &l1, const VecBase< T, Size > &l2)
VecBase< T, 3 > closest_to_plane(const VecBase< T, 4 > &plane, const VecBase< T, 3 > &pt)
void interp_weights_poly(MutableSpan< float > r_weights, Span< float2 > verts, const float2 &co)
bool isect_point_poly(const float2 &pt, Span< float2 > verts)
void closest_to_plane_v3(float r_close[3], const float plane[4], const float pt[3])
Definition math_geom.cc:451
float line_point_factor_v3(const float p[3], const float l1[3], const float l2[3])
unsigned int uint
Definition BKE_text.h:55
float closest_to_line_segment_v3(float r_close[3], const float p[3], const float l1[3], const float l2[3])
Definition math_geom.cc:403
bool map_to_sphere(float *r_u, float *r_v, float x, float y, float z)
void closest_to_plane_normalized_v3(float r_close[3], const float plane[4], const float pt[3])
Definition math_geom.cc:458
void plane_from_point_normal_v3(float r_plane[4], const float plane_co[3], const float plane_no[3])
Definition math_geom.cc:225
float dist_squared_to_line_segment_v2(const float p[2], const float l1[2], const float l2[2])
Definition math_geom.cc:307
VecBase< float, 4 > float4
float area_poly_v2(const float verts[][2], unsigned int nr)
Definition math_geom.cc:186
VecBase< float, 2 > float2
float line_point_factor_v2(const float p[2], const float l1[2], const float l2[2])
float normal_quad_v3(float n[3], const float v1[3], const float v2[3], const float v3[3], const float v4[3])
Definition math_geom.cc:62
bool isect_point_poly_v2(const float pt[2], const float verts[][2], unsigned int nr)
MINLINE float plane_point_side_v3(const float plane[4], const float co[3])
int isect_point_quad_v2(const float p[2], const float v1[2], const float v2[2], const float v3[2], const float v4[2])
float dist_squared_to_line_segment_v3(const float p[3], const float l1[3], const float l2[3])
Definition math_geom.cc:535
MINLINE int poly_to_tri_count(int poly_count, int corner_count)
MatBase< float, 3, 3 > float3x3
void interp_weights_poly_v2(float w[], float v[][2], int n, const float co[2])
EXPECT_EQ(BLI_expr_pylike_eval(expr, nullptr, 0, &result), EXPR_PYLIKE_INVALID)
float cotangent_tri_weight_v3(const float v1[3], const float v2[3], const float v3[3])
Definition math_geom.cc:202
float dist_squared_to_plane_v3(const float p[3], const float plane[4])
Definition math_geom.cc:486
ATTR_WARN_UNUSED_RESULT const BMVert * v2
void interp_bilinear_quad_v3(float data[4][3], float u, float v, float res[3])
float area_tri_v3(const float v1[3], const float v2[3], const float v3[3])
Definition math_geom.cc:104
VecBase< float, 3 > float3
void barycentric_weights_v2(const float v1[2], const float v2[2], const float v3[2], const float co[2], float w[3])
void axis_dominant_v3_to_m3(float r_mat[3][3], const float normal[3])
Normal to x,y matrix.