refactor namespaces

This commit is contained in:
2023-10-18 23:57:50 -07:00
parent 5f3dc6e9f6
commit 8d02d078e7
14 changed files with 84 additions and 52 deletions

View File

@@ -1,3 +1,4 @@
//
// Project: scccl
// File: src/math/geom2d.cpp
@@ -25,8 +26,8 @@
#include <iostream>
#include <vector>
#include <scccl/math/math.h>
#include <scccl/math/geom/coord2d.h>
#include <scmp/Math.h>
#include <scmp/geom/Coord2D.h>
// coord2d.cpp contains 2D geometric functions and data structures, such as
@@ -34,7 +35,7 @@
// TODO: deprecate Point2D in favour of Vector
namespace scmath {
namespace scmp {
namespace geom {
@@ -152,10 +153,10 @@ Polar2D::operator==(const Polar2D& rhs) const
{
static double eps = 0.0;
if (eps == 0.0) {
scmath::DefaultEpsilon(eps);
scmp::DefaultEpsilon(eps);
}
return scmath::WithinTolerance(r, rhs.r, eps) &&
scmath::WithinTolerance(theta, rhs.theta, eps);
return scmp::WithinTolerance(r, rhs.r, eps) &&
scmp::WithinTolerance(theta, rhs.theta, eps);
}

View File

@@ -1,13 +1,35 @@
///
/// \file Math.cc
/// \author K. Isom <kyle@imap.cc>
/// \date 2020-02-26
/// \brief Mathematical convience functions.
///
/// Copyright 2020 K. Isom <kyle@imap.cc>
///
/// Permission to use, copy, modify, and/or distribute this software for
/// any purpose with or without fee is hereby granted, provided that
/// the above copyright notice and this permission notice appear in all /// copies.
///
/// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
/// WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
/// WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
/// AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
/// DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA
/// OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
/// TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
/// PERFORMANCE OF THIS SOFTWARE.
///
#include <algorithm>
#include <functional>
#include <numeric>
#include <random>
#include <vector>
#include <scccl/math/math.h>
#include <scmp/Math.h>
namespace scmath {
namespace scmp {
std::vector<int>
@@ -104,10 +126,8 @@ RotateRadians(double theta0, double theta1)
}
const double Epsilon_double = 0.0001;
const float Epsilon_float = 0.0001;
static constexpr double Epsilon_double = 0.0001;
static constexpr float Epsilon_float = 0.0001;
void

View File

@@ -1,17 +1,17 @@
#include <cmath>
#include <scccl/phys/basic/motion2d.h>
#include <scmp/Motion2D.h>
namespace scphys {
namespace scmp {
namespace basic {
scmath::geom::Vector2d
scmp::geom::Vector2d
Acceleration(double speed, double heading)
{
auto dx = std::cos(heading) * speed;
auto dy = std::sin(heading) * speed;
return scmath::geom::Vector2d({dx, dy});
return scmp::geom::Vector2d({dx, dy});
}

View File

@@ -1,8 +1,8 @@
#include <scccl/math/geom/vector.h>
#include <scccl/math/geom/orientation.h>
#include <scmp/geom/Vector.h>
#include <scmp/geom/Orientation.h>
namespace scmath {
namespace scmp {
namespace geom {

View File

@@ -1,9 +1,9 @@
#include <iostream>
#include <scccl/math/geom/quaternion.h>
#include <scmp/geom/Quaternion.h>
namespace scmath {
namespace scmp {
namespace geom {

View File

@@ -2,9 +2,7 @@
#include <string>
#include <vector>
#include <scccl/math/math.h>
using namespace std;
using namespace scmath;
#include <scmp/Math.h>
static void