33#include <NDEVR/Vertex.h>
34#include <NDEVR/LineSegment.h>
35#include <NDEVR/Matrix.h>
51 template<u
int01 t_dims,
class t_type>
69 normal = (
cross(edge1, edge2)).template normalized<t_type>();
81 template<u
int01 t_new_dims,
class t_new_type>
93 else if (dot_product < 0)
126 if (
abs(Vd) < epsilon)
130 t_type distance_along_line = -V0 / Vd;
131 return distance_along_line;
146 right = right.template normalized<t_type>();
153 , offset[
X], offset[
Y], offset[
Z], 1);
156 template<
class t_buffer_type>
159 const uint04 vertex_size = points.size();
160 lib_assert(vertex_size >= 3,
"Plane requires at least 3 points");
169 for(
uint04 i = 0; i < vertex_size; i++)
172 v =
cross((p3 - p2), (p1 - p2));
173 if(v[t_dims - 1] != 0)
178 centroid += points[i];
184 v =
cross((p3 - p2), (p1 - p2));
185 if(v[t_dims - 1] != 0)
191 v =
cross((p3 - p2), (p1 - p2));
195 n = n.template normalized<t_type>();
196 if (
dot(direction_reference, n) < 0)
209 return (
equals(
normal, plane.normal, epsilon) &&
abs(
d - plane.d) < epsilon)
215 return normal == plane.normal &&
d == plane.d;
219 return normal != plane.normal ||
d != plane.d;
236 template<u
int01 t_dims,
class t_type>
258 template<u
int01 t_dims,
class t_type>
259 static constexpr bool IsInvalid(
const Plane<t_dims, t_type>& value)
264 template<
class t_type, u
int01 t_row_dims, u
int01 t_col_dims>
#define lib_assert(expression, message)
Definition LibAssert.h:61
A line segment represented by two vertices, a start and end.
Definition Line.hpp:49
constexpr t_vertex ray() const
Definition Line.hpp:120
Definition Matrix.hpp:176
Logic for a given plane or N-dimensions. Planes are coordinate systems of one less dimension than the...
Definition Geometry.h:41
t_type d
Definition Plane.hpp:223
Matrix< t_type > projectionMatrix(const Vector< 3, t_type > &up) const
Definition Plane.hpp:141
constexpr void negate()
Definition Plane.hpp:76
constexpr Plane(const Ray< t_dims, t_type > &_normal, t_type _d)
Definition Plane.hpp:72
bool isAbovePlane(const Vector< t_dims, t_type > &pos) const
Definition Plane.hpp:98
bool operator==(const Plane &plane) const
Definition Plane.hpp:213
t_type calculateIntersectionPos(const LineSegment< t_dims, t_type > &line, t_type epsilon) const
Definition Plane.hpp:121
bool liesOnPlane(const Vector< t_dims, t_type > &pos) const
Definition Plane.hpp:106
Plane< t_new_dims, t_new_type > as() const
Definition Plane.hpp:82
t_type distanceTo(const Vector< t_dims, t_type > &pos) const
Definition Plane.hpp:110
constexpr Plane(const Ray< t_dims, t_type > &_normal, const Vertex< t_dims, t_type > &_p)
Definition Plane.hpp:59
Vertex< t_dims, t_type > nearestPosition(const Vector< 3, fltp08 > &pos) const
Definition Plane.hpp:115
PlanePosition planePosition(const Vector< t_dims, t_type > &pos) const
Definition Plane.hpp:88
Vertex< t_dims, t_type > calculateIntersection(const LineSegment< t_dims, t_type > &line, t_type epsilon) const
Definition Plane.hpp:134
bool operator!=(const Plane &plane) const
Definition Plane.hpp:217
constexpr Plane(const Vertex< t_dims, t_type > &a, const Vertex< t_dims, t_type > &b, const Vertex< t_dims, t_type > &c)
Definition Plane.hpp:63
bool isBelowPlane(const Vector< t_dims, t_type > &pos) const
Definition Plane.hpp:102
Ray< t_dims, t_type > normal
Definition Plane.hpp:222
bool contains(const Vector< 3, t_type > &point, t_type epsilon) const
Definition Plane.hpp:202
bool isSamePlane(const Plane &plane, t_type epsilon) const
Definition Plane.hpp:207
Plane()
Definition Plane.hpp:55
static Plane CreateBestFitPlane(const t_buffer_type &points, const Vector< t_dims, t_type > &direction_reference=Vector< t_dims, t_type >(0, 0, 1))
Definition Plane.hpp:157
Definition Vertex.hpp:317
A fixed-size array with better performance compared to dynamic containers.
Definition Vector.hpp:60
A vertex or point. A specific type of Vector used primarily for spacial location information.
Definition Vertex.hpp:48
constexpr bool IsInvalid(const t_type &value)
Query if 'value' is valid or invalid. Invalid values should return invalid if used for calculations o...
Definition BaseFunctions.hpp:170
constexpr std::enable_if< IsVecType< t_vector_type, Angle< fltp08 > >::value, t_vector_type >::type operator*(const t_vector_type &angle, const t_type &mult)
Multiplication operator for a Vector of Angles.
Definition AngleFunctions.h:326
t_type dot(const Vector< t_dims, t_type > &v1, const Vector< t_dims, t_type > &v2)
Definition VectorFunctions.hpp:1030
PlanePosition
The location of an object either below, above, or on a given N-dimensional plane.
Definition Plane.hpp:42
constexpr Vector< 1, t_type > cross(const Vector< 1, t_type > &, const Vector< 1, t_type > &)
Definition VectorFunctions.hpp:898
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:96
constexpr t_to cast(const Angle< t_from > &value)
Definition Angle.h:375
constexpr bool equals(const LineSegment< t_dims, t_type, t_vertex > &left, const LineSegment< t_dims, t_type, t_vertex > &right, const t_type &epsilon=cast< t_type >(0))
Definition Line.hpp:757
constexpr Angle< t_angle_type > abs(const Angle< t_angle_type > &value)
Changes an input with a negative sign, to a positive sign.
Definition AngleFunctions.h:645
@ A
Definition BaseValues.hpp:168
@ Y
Definition BaseValues.hpp:169
@ X
Definition BaseValues.hpp:167
@ Z
Definition BaseValues.hpp:171
Defines for a given type (such as sint04, fltp08, UUID, etc) a maximum, minimum, and reserved 'invali...
Definition BaseValues.hpp:233
static const t_type Invalid
Definition BaseValues.hpp:234