diff --git a/src/plane.rs b/src/plane.rs index c155fb5..191f0a1 100644 --- a/src/plane.rs +++ b/src/plane.rs @@ -89,6 +89,12 @@ impl Plane { Some(Plane::new(n, d)) } } + + /// Construct a plane from a point and a normal vector. + /// The plane will contain the point `p` and be perpendicular to `n`. + pub fn from_point_normal(p: Point3, n: Vector3) -> Plane { + Plane { n: n, d: p.dot(&n) } + } } impl Intersect>> for (Plane, Ray3) {