refactor namespaces
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
#include <cmath>
|
||||
#include <vector>
|
||||
|
||||
namespace scmath {
|
||||
namespace scmp {
|
||||
|
||||
|
||||
// MAX_RADIAN is a precomputed 2 * M_PI, and MIN_RADIAN is -2 * M_PI.
|
||||
@@ -6,13 +6,13 @@
|
||||
#define SCCCL_MOTION2D_H
|
||||
|
||||
|
||||
#include <scccl/math/geom/vector.h>
|
||||
#include <scmp/geom/Vector.h>
|
||||
|
||||
namespace scphys {
|
||||
namespace scmp {
|
||||
namespace basic {
|
||||
|
||||
|
||||
scmath::geom::Vector2d Acceleration(double speed, double heading);
|
||||
scmp::geom::Vector2d Acceleration(double speed, double heading);
|
||||
|
||||
|
||||
} // namespace basic
|
||||
@@ -29,7 +29,7 @@
|
||||
#include <vector>
|
||||
|
||||
|
||||
namespace scmath {
|
||||
namespace scmp {
|
||||
namespace geom {
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#define SCMATH_GEOM_ORIENTATION_H
|
||||
|
||||
|
||||
namespace scmath {
|
||||
namespace scmp {
|
||||
namespace geom {
|
||||
|
||||
|
||||
@@ -10,11 +10,11 @@
|
||||
#include <iostream>
|
||||
#include <ostream>
|
||||
|
||||
#include <scccl/math/math.h>
|
||||
#include <scccl/math/geom/vector.h>
|
||||
#include <scmp/Math.h>
|
||||
#include <scmp/geom/Vector.h>
|
||||
|
||||
/// math contains the shimmering clarity math library.
|
||||
namespace scmath {
|
||||
namespace scmp {
|
||||
/// geom contains geometric classes and functions.
|
||||
namespace geom {
|
||||
|
||||
@@ -47,7 +47,7 @@ public:
|
||||
/// The default Quaternion constructor returns an identity quaternion.
|
||||
Quaternion() : v(Vector<T, 3>{0.0, 0.0, 0.0}), w(1.0)
|
||||
{
|
||||
scmath::DefaultEpsilon(this->eps);
|
||||
scmp::DefaultEpsilon(this->eps);
|
||||
v.setEpsilon(this->eps);
|
||||
};
|
||||
|
||||
@@ -61,7 +61,7 @@ public:
|
||||
Quaternion(Vector<T, 3> _axis, T _angle) : v(_axis), w(_angle)
|
||||
{
|
||||
this->constrainAngle();
|
||||
scmath::DefaultEpsilon(this->eps);
|
||||
scmp::DefaultEpsilon(this->eps);
|
||||
v.setEpsilon(this->eps);
|
||||
};
|
||||
|
||||
@@ -75,7 +75,7 @@ public:
|
||||
w(vector[0])
|
||||
{
|
||||
this->constrainAngle();
|
||||
scmath::DefaultEpsilon(this->eps);
|
||||
scmp::DefaultEpsilon(this->eps);
|
||||
v.setEpsilon(this->eps);
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ public:
|
||||
this->w = it[0];
|
||||
|
||||
this->constrainAngle();
|
||||
scmath::DefaultEpsilon(this->eps);
|
||||
scmp::DefaultEpsilon(this->eps);
|
||||
v.setEpsilon(this->eps);
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ public:
|
||||
bool
|
||||
isIdentity() const {
|
||||
return this->v.isZero() &&
|
||||
scmath::WithinTolerance(this->w, (T)1.0, this->eps);
|
||||
scmp::WithinTolerance(this->w, (T)1.0, this->eps);
|
||||
}
|
||||
|
||||
|
||||
@@ -209,7 +209,7 @@ public:
|
||||
bool
|
||||
isUnitQuaternion() const
|
||||
{
|
||||
return scmath::WithinTolerance(this->norm(), (T) 1.0, this->eps);
|
||||
return scmp::WithinTolerance(this->norm(), (T) 1.0, this->eps);
|
||||
}
|
||||
|
||||
|
||||
@@ -338,7 +338,7 @@ public:
|
||||
operator==(const Quaternion<T> &other) const
|
||||
{
|
||||
return (this->v == other.v) &&
|
||||
(scmath::WithinTolerance(this->w, other.w, this->eps));
|
||||
(scmp::WithinTolerance(this->w, other.w, this->eps));
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include <ostream>
|
||||
#include <iostream>
|
||||
|
||||
#include <scccl/math/math.h>
|
||||
#include <scmp/Math.h>
|
||||
|
||||
|
||||
// This implementation is essentially a C++ translation of a Python library
|
||||
@@ -39,7 +39,7 @@
|
||||
// of the test vectors come from quiz questions in the class.
|
||||
|
||||
|
||||
namespace scmath {
|
||||
namespace scmp {
|
||||
namespace geom {
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ public:
|
||||
this->arr[i] = unitLength;
|
||||
}
|
||||
|
||||
scmath::DefaultEpsilon(this->epsilon);
|
||||
scmp::DefaultEpsilon(this->epsilon);
|
||||
}
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ public:
|
||||
{
|
||||
assert(ilst.size() == N);
|
||||
|
||||
scmath::DefaultEpsilon(this->epsilon);
|
||||
scmp::DefaultEpsilon(this->epsilon);
|
||||
std::copy(ilst.begin(), ilst.end(), this->arr.begin());
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ public:
|
||||
isZero() const
|
||||
{
|
||||
for (size_t i = 0; i < N; i++) {
|
||||
if (!scmath::WithinTolerance(this->arr[i], (T)0.0, this->epsilon)) {
|
||||
if (!scmp::WithinTolerance(this->arr[i], (T)0.0, this->epsilon)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -132,7 +132,7 @@ public:
|
||||
bool
|
||||
isUnitVector() const
|
||||
{
|
||||
return scmath::WithinTolerance(this->magnitude(), (T)1.0, this->epsilon);
|
||||
return scmp::WithinTolerance(this->magnitude(), (T)1.0, this->epsilon);
|
||||
}
|
||||
|
||||
|
||||
@@ -163,7 +163,7 @@ public:
|
||||
}
|
||||
|
||||
T angle = this->angle(other);
|
||||
if (scmath::WithinTolerance(angle, (T)0.0, this->epsilon)) {
|
||||
if (scmp::WithinTolerance(angle, (T)0.0, this->epsilon)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
return scmath::WithinTolerance(*this * other, (T)0.0, this->epsilon);
|
||||
return scmp::WithinTolerance(*this * other, (T)0.0, this->epsilon);
|
||||
}
|
||||
|
||||
|
||||
@@ -318,7 +318,7 @@ public:
|
||||
operator==(const Vector<T, N> &other) const
|
||||
{
|
||||
for (size_t i = 0; i<N; i++) {
|
||||
if (!scmath::WithinTolerance(this->arr[i], other.arr[i], this->epsilon)) {
|
||||
if (!scmp::WithinTolerance(this->arr[i], other.arr[i], this->epsilon)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user