7 return glm::dot(p.data, v);
12 return glm::dot(vec3(p.data), v) + p.data.w;
17 return glm::dot(vec3{p.data}, v);
22 vec3 normalizedNormal = glm::normalize(
normal);
23 return plane(normalizedNormal.x, normalizedNormal.y, normalizedNormal.z, -glm::dot(
point, normalizedNormal));
28 vec3
normal = glm::normalize(glm::cross(v2 - v1, v3 - v1));
29 return from_point_normal(v1,
normal);
34 return plane(m * p.data);
39 float length = glm::length(vec3(p.data));
40 return plane(p.data / length);
45 return plane(p.data * s);
50 return plane(data * s);
55 return plane(data / s);
82 return data == p.data;
87 return data != p.data;
102plane::plane(
float _a,
float _b,
float _c,
float _d) : data(_a, _b, _c, _d)
Storage for infinite plane.
auto operator=(const vec4 &rhs) -> plane &
Assignment operator from vec4.
auto operator==(const plane &p) const -> bool
Equality operator.
auto operator*=(float s) -> plane &
Multiplies and assigns the plane by a scalar value.
static auto normalize(const plane &p) -> plane
Normalizes the plane.
static auto from_point_normal(const vec3 &point, const vec3 &normal) -> plane
Creates a plane from a point and a normal.
auto operator+() const -> plane
Unary plus operator.
auto operator!=(const plane &p) const -> bool
Inequality operator.
friend auto operator*(float s, const plane &p) -> plane
Scalar multiplication for a plane.
auto operator/(float s) const -> plane
Divides the plane by a scalar value.
static auto from_points(const vec3 &v1, const vec3 &v2, const vec3 &v3) -> plane
Creates a plane from three points.
static auto dot_normal(const plane &p, const vec3 &v) -> float
Computes the dot product of the plane normal and a vec3.
auto operator/=(float s) -> plane &
Divides and assigns the plane by a scalar value.
plane()
Default constructor.
auto operator-() const -> plane
Unary minus operator.
static auto dot(const plane &p, const vec4 &v) -> float
Computes the dot product of the plane and a vec4.
static auto dot_coord(const plane &p, const vec3 &v) -> float
Computes the dot product of the plane and a vec3 (considering the plane's distance).
static auto mul(const plane &p, const mat4 &m) -> plane
Transforms a plane by a 4x4 matrix.
vec4 data
The components of the plane.
static auto scale(const plane &p, float s) -> plane
Scales the plane by a scalar value.