mirror of
https://github.com/hannobraun/Fornjot
synced 2025-09-03 16:06:53 +00:00
Add Triangle::point_from_barycentric_coords
This commit is contained in:
parent
b787d9923c
commit
c0d4db9ae4
@ -43,6 +43,16 @@ impl<const D: usize> Triangle<D> {
|
|||||||
area > Scalar::default_epsilon()
|
area > Scalar::default_epsilon()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Convert barycentric coordinates to a point
|
||||||
|
pub fn point_from_barycentric_coords(
|
||||||
|
&self,
|
||||||
|
[wa, wb, wc]: [Scalar; 3],
|
||||||
|
) -> Point<D> {
|
||||||
|
let [a, b, c] = self.points;
|
||||||
|
let coords = a.coords * wa + b.coords * wb + c.coords * wc;
|
||||||
|
Point { coords }
|
||||||
|
}
|
||||||
|
|
||||||
/// Normalize the triangle
|
/// Normalize the triangle
|
||||||
///
|
///
|
||||||
/// Returns a new `Triangle` instance with the same points, but the points
|
/// Returns a new `Triangle` instance with the same points, but the points
|
||||||
|
Loading…
x
Reference in New Issue
Block a user