geom/plane: add make_plane convenience function
This commit is contained in:
parent
56a73275c1
commit
dd369c7c9c
@ -11,11 +11,10 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*
|
*
|
||||||
* Copyright 2015 Danny Robson <danny@nerdcruft.net>
|
* Copyright 2015-2018 Danny Robson <danny@nerdcruft.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __UTIL_PLANE_HPP
|
#pragma once
|
||||||
#define __UTIL_PLANE_HPP
|
|
||||||
|
|
||||||
#include "../point.hpp"
|
#include "../point.hpp"
|
||||||
#include "../vector.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
|
/// returns the normal for a plane
|
||||||
template <size_t S, typename T>
|
template <size_t S, typename T>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user