17 #ifndef GZ_MATH_PLANE_HH_
18 #define GZ_MATH_PLANE_HH_
23 #include <gz/math/config.hh>
31 inline namespace GZ_MATH_VERSION_NAMESPACE {
68 : normal(_normal), d(_offset)
79 this->Set(_normal, _size, _offset);
94 this->normal = _normal;
105 this->normal = _normal;
118 return this->normal.Dot(_point) - this->d;
132 const double &_tolerance = 1e-6)
const
134 if (std::abs(this->Normal().Dot(_gradient)) < _tolerance)
138 auto constant = this->Offset() - this->Normal().Dot(_point);
139 auto param = constant / this->Normal().Dot(_gradient);
140 auto intersection = _point + _gradient*param;
149 auto angle = acos(dotProduct / this->Normal().Length());
156 auto xBasis = rotatedXAxis.
Dot(intersection);
157 auto yBasis = rotatedYAxis.
Dot(intersection);
159 if (std::abs(xBasis) < this->Size().X() / 2 &&
160 std::abs(yBasis) < this->Size().Y() / 2)
175 T dist = this->Distance(_point);
178 return NEGATIVE_SIDE;
181 return POSITIVE_SIDE;
194 double dist = this->Distance(_box.
Center());
195 double maxAbsDist = this->normal.AbsDot(_box.
Size()/2.0);
197 if (dist < -maxAbsDist)
198 return NEGATIVE_SIDE;
200 if (dist > maxAbsDist)
201 return POSITIVE_SIDE;
213 T denom = this->normal.Dot(_dir);
215 if (std::abs(denom) < 1e-3)
222 T nom = _origin.
Dot(this->normal) - this->d;