mirror of
https://github.com/hannobraun/Fornjot
synced 2025-05-11 13:28:28 +00:00
Merge pull request #2452 from hannobraun/triangle
Add `Triangle::point_from_barycentric_coords`
This commit is contained in:
commit
6e747acd3a
@ -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…
Reference in New Issue
Block a user