File tree Expand file tree Collapse file tree 5 files changed +14
-7
lines changed
include/RaidZeroLib/api/Geometry
src/RaidZeroLib/api/Geometry Expand file tree Collapse file tree 5 files changed +14
-7
lines changed Original file line number Diff line number Diff line change 11#pragma once
2- #include " RaidZeroLib/api/Geometry/Rotation .hpp"
2+ #include " au/au .hpp"
33#include < optional>
44
55namespace rz {
@@ -44,7 +44,7 @@ class Point {
4444
4545 Point rotateBy (const Rotation& rhs) const noexcept ;
4646
47- bool isApprox (const Point& rhs, au::QuantityD<au::Meters> tol = au::meters( 1e-12 ) ) const noexcept ;
47+ bool isApprox (const Point& rhs) const noexcept ;
4848
4949 private:
5050 au::QuantityD<au::Meters> x = au::ZERO;
Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ class Rotation {
1111
1212 Rotation (au::QuantityD<au::Meters> x, au::QuantityD<au::Meters> y) noexcept ;
1313
14+ Rotation (double x, double y) noexcept ;
15+
1416 au::QuantityD<au::Radians> Theta () const noexcept ;
1517
1618 double Sin () const noexcept ;
@@ -29,7 +31,7 @@ class Rotation {
2931
3032 Rotation operator /(double scalar) const noexcept ;
3133
32- bool isApprox (const Rotation& rhs, au::QuantityD<au::Radians> tol = au::radians( 1e-12 ) ) const noexcept ;
34+ bool isApprox (const Rotation& rhs) const noexcept ;
3335
3436 private:
3537 au::QuantityD<au::Radians> theta = au::ZERO;
Original file line number Diff line number Diff line change 11#include " RaidZeroLib/api/Geometry/Point.hpp"
22#include " RaidZeroLib/api/Utility/Math.hpp"
3+ #include " RaidZeroLib/api/Geometry/Rotation.hpp"
34
45namespace rz {
56
@@ -75,8 +76,8 @@ Point Point::rotateBy(const Rotation& rhs) const noexcept {
7576 return Point (x * c - y * s, x * s + y * c);
7677}
7778
78- bool Point::isApprox (const Point& rhs, au::QuantityD<au::Meters> tol ) const noexcept {
79- return this ->distTo (rhs) <= tol ;
79+ bool Point::isApprox (const Point& rhs) const noexcept {
80+ return this ->distTo (rhs) <= au::meters ( 1e-9 ) ;
8081}
8182
8283au::QuantityD<au::Meters> circumradius (const Point& A, const Point& B, const Point& C) noexcept {
Original file line number Diff line number Diff line change @@ -8,6 +8,9 @@ Rotation::Rotation(au::QuantityD<au::Radians> theta) noexcept : theta(constrainA
88Rotation::Rotation (au::QuantityD<au::Meters> x, au::QuantityD<au::Meters> y) noexcept
99 : theta(x == au::ZERO && y == au::ZERO ? au::ZERO : au::arctan2(y, x)){}
1010
11+ Rotation::Rotation (double x, double y) noexcept
12+ : theta(x == 0 && y == 0 ? au::ZERO : au::radians(std::atan2(y, x))){}
13+
1114au::QuantityD<au::Radians> Rotation::Theta () const noexcept {
1215 return theta;
1316}
@@ -44,9 +47,9 @@ Rotation Rotation::operator/(double scalar) const noexcept {
4447 return *this * (1.0 / scalar);
4548}
4649
47- bool Rotation::isApprox (const Rotation& rhs, au::QuantityD<au::Radians> tol ) const noexcept {
50+ bool Rotation::isApprox (const Rotation& rhs) const noexcept {
4851 const auto diff = constrainAngle180 (theta - rhs.theta );
49- return au::abs (diff) <= tol ;
52+ return au::abs (diff) <= au::radians ( 1e-9 ) ;
5053}
5154
5255} // namespace rz
Original file line number Diff line number Diff line change 11#include " RaidZeroLib/api/Geometry/Point.hpp"
2+ #include " RaidZeroLib/api/Geometry/Rotation.hpp"
23#include < cmath>
34#include < gtest/gtest.h>
45
You can’t perform that action at this time.
0 commit comments