mirror of
https://github.com/hannobraun/Fornjot
synced 2025-02-14 19:25:52 +00:00
Make Triangle::from_points
more flexible
This commit is contained in:
parent
875b52660e
commit
49ace432b7
@ -16,7 +16,9 @@ impl<const D: usize> Triangle<D> {
|
|||||||
/// # Panics
|
/// # Panics
|
||||||
///
|
///
|
||||||
/// Panics, if the points don't form a triangle.
|
/// Panics, if the points don't form a triangle.
|
||||||
pub fn from_points(points: [Point<D>; 3]) -> Self {
|
pub fn from_points(points: [impl Into<Point<D>>; 3]) -> Self {
|
||||||
|
let points = points.map(Into::into);
|
||||||
|
|
||||||
let area = {
|
let area = {
|
||||||
let [a, b, c] = points.map(Point::to_xyz);
|
let [a, b, c] = points.map(Point::to_xyz);
|
||||||
(b - a).cross(&(c - a)).magnitude()
|
(b - a).cross(&(c - a)).magnitude()
|
||||||
|
Loading…
Reference in New Issue
Block a user