Skip to content

Commit

Permalink
Add tolerance argument
Browse files Browse the repository at this point in the history
Signed-off-by: Arjo Chakravarty <[email protected]>
  • Loading branch information
arjo129 committed Sep 20, 2021
1 parent cf438da commit aed0c6b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions include/ignition/math/Plane.hh
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,16 @@ namespace ignition
/// given the line's gradient and a point in parametrized space.
/// \param[in] _point A point that lies on a line.
/// \param[in] _gradient The gradient of the line.
/// \param[in] _tolerance The tolerance for determining a line is
/// parallel to the plane. Optional, default=10^-16
/// \return The point of intersection. std::nullopt if the line is
/// parrallel to the plane.
public: std::optional<Vector3<T>> Intersection(
const Vector3<T> &_point,
const Vector3<T> &_gradient) const
const Vector3<T> &_gradient,
const double &_tolerance = 1e-6) const
{
if(abs(this->Normal().Dot(_gradient)) < 1e-6)
if(abs(this->Normal().Dot(_gradient)) < _tolerance)
{
return std::nullopt;
}
Expand Down

0 comments on commit aed0c6b

Please sign in to comment.