From dd369c7c9c5c5395a8cc36cd7cff1acd1e13b112 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Fri, 20 Apr 2018 15:05:29 +1000 Subject: [PATCH] geom/plane: add make_plane convenience function --- geom/plane.hpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/geom/plane.hpp b/geom/plane.hpp index 62757f5b..7a6fb37a 100644 --- a/geom/plane.hpp +++ b/geom/plane.hpp @@ -11,11 +11,10 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * Copyright 2015 Danny Robson + * Copyright 2015-2018 Danny Robson */ -#ifndef __UTIL_PLANE_HPP -#define __UTIL_PLANE_HPP +#pragma once #include "../point.hpp" #include "../vector.hpp" @@ -36,6 +35,16 @@ namespace util::geom { }; + typedef plane<2,float> plane2f; + typedef plane<3,float> plane3f; + + inline plane3f + make_plane (util::point3f a, util::point3f b, util::point3f c) + { + return plane3f (a, normalised (cross (b - a, c - a))); + } + + /////////////////////////////////////////////////////////////////////////// /// returns the normal for a plane template