8#ifndef META_OCEAN_MATH_PLANE_3_H
9#define META_OCEAN_MATH_PLANE_3_H
21template <
typename T>
class LineT3;
24template <
typename T>
class PlaneT3;
253 explicit inline operator bool()
const;
299 if (direction10 != direction20 && direction10 != -direction20)
301 normal_ = direction10.
cross(direction20).normalizedOrZero();
385 ocean_assert(!
normal_.isParallel(upVector));
508 VectorT3<T> normalizedLineDirection = lineDirection;
509 if (!normalizedLineDirection.
normalize())
515 const T dotProduct = lineDirection * lineDirection;
532 line =
LineT3<T>(linePoint, normalizedLineDirection);
581 return !(*
this == right);
This class implements a 4x4 homogeneous transformation matrix using floating point values with the pr...
Definition HomogenousMatrix4.h:110
HomogenousMatrixT4< T > inverted() const noexcept
Returns the inverted of this matrix.
Definition HomogenousMatrix4.h:1569
SquareMatrixT3< T > rotationMatrix() const
Returns the rotation matrix of the transformation.
Definition HomogenousMatrix4.h:1487
bool isValid() const
Returns whether this matrix is a valid homogeneous transformation.
Definition HomogenousMatrix4.h:1800
This class implements an infinite line in 3D space.
Definition Line3.h:69
bool isValid() const
Returns whether this line has valid parameters.
Definition Line3.h:312
const VectorT3< T > & direction() const
Returns the direction of the line.
Definition Line3.h:293
const VectorT3< T > & point() const
Returns a point on the line.
Definition Line3.h:280
static constexpr T weakEps()
Returns a weak epsilon.
static T atan2(const T y, const T x)
Returns the arctangent of a given value in radian.
Definition Numeric.h:1636
static T sin(const T value)
Returns the sine of a given value.
Definition Numeric.h:1572
static constexpr bool isWeakEqualEps(const T value)
Returns whether a value is smaller than or equal to a weak epsilon.
Definition Numeric.h:2171
static constexpr T eps()
Returns a small epsilon.
static bool isEqual(const T first, const T second)
Returns whether two values are equal up to a small epsilon.
Definition Numeric.h:2395
static constexpr bool isEqualEps(const T value)
Returns whether a value is smaller than or equal to a small epsilon.
Definition Numeric.h:2096
static T cos(const T value)
Returns the cosine of a given value.
Definition Numeric.h:1588
static constexpr bool isNotEqualEps(const T value)
Returns whether a value is not smaller than or equal to a small epsilon.
Definition Numeric.h:2246
static T asin(const T value)
Returns the arcsine of a given value.
Definition Numeric.h:2896
This class implements a plane in 3D space.
Definition Plane3.h:73
bool intersection(const LineT3< T > &ray, VectorT3< T > &point) const
Calculates the intersection between this plane and a given ray.
Definition Plane3.h:472
bool operator!=(const PlaneT3< T > &right) const
Returns whether two plane objects do not represent the same plane.
Definition Plane3.h:579
PlaneT3(const VectorT3< T > &point, const VectorT3< T > &normal)
Creates a plane by an intersection point and a normal.
Definition Plane3.h:286
PlaneT3()=default
Creates an invalid plane.
PlaneT3(const HomogenousMatrixT4< T > &transformation)
Creates a plane by a transformation where the z-axis defined the plane's normal and the origin or the...
Definition Plane3.h:325
const VectorT3< Scalar > & normal() const
bool transformation(const VectorT3< Scalar > &pointOnPlane, const VectorT3< Scalar > &upVector, HomogenousMatrixT4< Scalar > &matrix) const
void setNormal(const VectorT3< T > &normal)
Sets the normal of this plane.
Definition Plane3.h:413
T signedDistance(const VectorT3< T > &point) const
Returns the distance between a given point and this plane.
Definition Plane3.h:441
VectorT3< Scalar > normal_
Definition Plane3.h:279
bool isInPlane(const VectorT3< T > &point, const T epsilon=NumericT< T >::eps()) const
Returns whether a point is in the plane.
Definition Plane3.h:433
bool operator==(const PlaneT3< T > &right) const
Returns whether two plane objects represent the same plane.
Definition Plane3.h:571
bool intersection(const PlaneT3< T > &plane, LineT3< T > &line) const
Calculates the intersection between this plane and a second plane.
Definition Plane3.h:499
PlaneT3(const VectorT3< T > &normal, const T distance)
Creates a plane by the plane's normal and the distance between origin and plane.
Definition Plane3.h:307
PlaneT3(const VectorT3< T > &point0, const VectorT3< T > &point1, const VectorT3< T > &point2)
Creates a plane by three points lying in the plane.
Definition Plane3.h:294
VectorT3< Scalar > pointOnPlane() const
Scalar Type
Definition Plane3.h:79
PlaneT3< T > transform(const HomogenousMatrixT4< T > &iTransformation) const
Transforms this plane so that it corresponds to a new coordinate system.
Definition Plane3.h:361
Scalar distance_
Definition Plane3.h:282
VectorT3< T > reflect(const VectorT3< T > &direction)
Reflects a given vector in the plane.
Definition Plane3.h:462
void setDistance(const T distance)
Sets the distance between plane and origin.
Definition Plane3.h:420
bool isValid() const
Returns whether this plane is valid.
Definition Plane3.h:538
VectorT3< T > projectOnPlane(const VectorT3< T > &point) const
Projects a given point onto the plane.
Definition Plane3.h:449
void decomposeNormal(T &yaw, T &pitch) const
Calculates the yaw and pitch angle of the plane's normal.
Definition Plane3.h:352
PlaneT3(const T yaw, const T pitch, const T distance)
Creates a plane by the plane's normal and the distance between origin and plane.
Definition Plane3.h:315
PlaneT3< T > operator-() const
Returns an inverted plane of this plane having an inverted normal direction (and adjusted distance).
Definition Plane3.h:559
const Scalar & distance() const
bool isEqual(const PlaneT3< T > &plane, const T eps=NumericT< T >::eps()) const
Returns whether two plane objects represent the same plane up to a specified epsilon.
Definition Plane3.h:544
This class implements a vector with three elements.
Definition Vector3.h:97
bool normalize()
Normalizes this vector.
Definition Vector3.h:651
VectorT3< T > cross(const VectorT3< T > &vector) const
Returns the cross product of two vectors.
Definition Vector3.h:601
PlaneT3< Scalar > Plane3
Definition of the Plane3 object, depending on the OCEAN_MATH_USE_SINGLE_PRECISION either with single ...
Definition Plane3.h:31
PlaneT3< double > PlaneD3
Definition of a 3D plane with double values.
Definition Plane3.h:38
std::vector< PlaneT3< T > > PlanesT3
Definition of a typename alias for vectors with PlaneT3 objects.
Definition Plane3.h:53
PlaneT3< float > PlaneF3
Definition of a 3D plane with float values.
Definition Plane3.h:45
std::vector< Plane3 > Planes3
Definition of a vector holding Plane3 objects.
Definition Plane3.h:60
The namespace covering the entire Ocean framework.
Definition Accessor.h:15