3Plane::Plane(
double a,
double b,
double c,
double d) : a(a), b(b), c(c), d(d) {}
16 double numerator = std::abs(
a * x +
b * y +
c * z +
d);
17 double denominator = std::sqrt(
a *
a +
b *
b +
c *
c);
18 return numerator / denominator;
The Plane class represents a 3D plane defined by its equation ax + by + cz + d = 0.
double get_b() const
Getter - Get the b component of the plane.
double get_a() const
Getter - Get the a component of the plane.
Plane & operator+=(const Plane &other)
Overloads the += operator to add another plane to this plane.
double get_c() const
Getter - Get the c component of the plane.
double get_distance_to_point(float x, float y, float z) const
Calculates the distance from a point to the plane.
Plane & operator/=(double scalar)
Overloads the /= operator to divide a plane by a scalar.
Plane()
Constructs a new Plane object with default coefficients (0).
double get_d() const
Getter - Get the d component of the plane.