12#ifndef _CS237_PLANE_HPP_
13#define _CS237_PLANE_HPP_
16#error "cs237/plane.hpp should not be included directly"
26 using vec3 = glm::vec<3, T, glm::defaultp>;
27 using vec4 = glm::vec<4, T, glm::defaultp>;
45 double d = -glm::dot(
norm, p);
53 T
dist ()
const {
return this->_nd.w; }
60 return glm::dot(this->_nd,
vec4(p, 1.0));
74 return "Plane(" + glm::to_string(this->
norm()) +
", "
std::ostream & operator<<(std::ostream &s, __detail::AABB< T > const &bb)
print the axis-aligned bounding box to the output stream
std::string to_string(Channels ch)
convert a Channels value to a printable string
representation of a oriented 3D plane
Definition plane.hpp:25
glm::vec< 3, T, glm::defaultp > vec3
Definition plane.hpp:26
std::string toString() const
the string representation of a plane
Definition plane.hpp:72
glm::vec< 4, T, glm::defaultp > vec4
Definition plane.hpp:27
Plane()
unit normal and signed distance from origin
Definition plane.hpp:31
vec4 _nd
Definition plane.hpp:29
Plane(vec3 n, T d)
specify a plane as a unit-length normal vector and signed distance from origin
Definition plane.hpp:37
T dist() const
signed distance from origin to plane
Definition plane.hpp:53
T distanceToPt(vec3 const &p) const
signed distance from a point to plane
Definition plane.hpp:58
vec3 norm() const
get the plane normal vector
Definition plane.hpp:50
vec3 project(vec3 const &p) const
Definition plane.hpp:66
Plane(vec3 n, vec3 p)
specify a plane as a normal vector and point on the plane
Definition plane.hpp:42