geom/plane: add make_plane convenience function

This commit is contained in:
Danny Robson 2018-04-20 15:05:29 +10:00
parent 56a73275c1
commit dd369c7c9c

View File

@ -11,11 +11,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Copyright 2015 Danny Robson <danny@nerdcruft.net>
* Copyright 2015-2018 Danny Robson <danny@nerdcruft.net>
*/
#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 <size_t S, typename T>