23#ifndef VCL_SPACE_CORE_PLANE_H
24#define VCL_SPACE_CORE_PLANE_H
28#include <vclib/concepts/space/plane.h>
29#include <vclib/exceptions/misc.h>
49template<
typename Scalar,
bool NORM = true>
56 using ScalarType = Scalar;
73 Scalar
n = mDir.norm();
91 mOffset = p0.dot(mDir);
111 if constexpr (std::is_same<Scalar, S>::value) {
115 return Plane<S, NORM>(mDir.template cast<S>(), mOffset);
129 Scalar
offset()
const {
return mOffset; }
138 Scalar
k =
p.dot(mDir) - mOffset;
154 bool operator==(
const Plane&
p)
const
156 return mOffset ==
p.mOffset && mDir ==
p.mDir;
159 bool operator!=(
const Plane& p)
const {
return !(*
this == p); }
164using Planef = Plane<float>;
165using Planed = Plane<double>;
The Plane class represent a 2D plane in 3D space.
Definition plane.h:51
Point3< Scalar > projectPoint(const Point3< Scalar > &p) const
Given a point, returns the point projected to this plane.
Definition plane.h:136
Plane(const Point3< Scalar > &p0, const Point3< Scalar > &normal)
Constructor of a plane given a point lying to the plane and the normal of the plane.
Definition plane.h:85
Plane(const Point3< Scalar > &p0, const Point3< Scalar > &p1, const Point3< Scalar > &p2)
Constructor of a plane given three points.
Definition plane.h:100
Point3< Scalar > mirrorPoint(const Point3< Scalar > &p) const
Given a point, returns the point mirrored w.r.t. this plane.
Definition plane.h:147
Plane(const Point3< Scalar > &direction, Scalar offset)
Constructor of a plane given a direction and an offset.
Definition plane.h:69
Plane()
Empty constructor. The plane is uninitialized.
Definition plane.h:62
const Point3< Scalar > & direction() const
Returns the direction component of the plane.
Definition plane.h:123
Scalar offset() const
Returns the offset component of the plane.
Definition plane.h:129
A class representing a line segment in n-dimensional space. The class is parameterized by a PointConc...
Definition segment.h:43