Skip to content

Commit

Permalink
fix: fix no code style divergence
Browse files Browse the repository at this point in the history
  • Loading branch information
marfanr committed Sep 11, 2024
1 parent db7b3cb commit 505a744
Show file tree
Hide file tree
Showing 29 changed files with 661 additions and 1,079 deletions.
24 changes: 12 additions & 12 deletions include/keisan/angle/angle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,32 +26,32 @@
namespace keisan
{

template<typename T, typename U>
template <typename T, typename U>
using IfElseFloat = typename std::conditional<std::is_floating_point<T>::value, T, U>::type;

// Forward declaration
template<typename T>
template <typename T>
class Angle;

template<typename T>
template <typename T>
Angle<T> make_degree(const T & value);
template<typename T>
template <typename T>
Angle<T> make_radian(const T & value);

template<typename T>
template <typename T>
Angle<IfElseFloat<T, double>> arcsin(const T & value);
template<typename T>
template <typename T>
Angle<IfElseFloat<T, double>> arccos(const T & value);
template<typename T>
template <typename T>
Angle<IfElseFloat<T, double>> arctan(const T & value);
template<typename T>
template <typename T>
Angle<IfElseFloat<T, double>> signed_arctan(const T & y, const T & x);

template<typename T>
template <typename T>
class Angle
{
public:
template<typename U>
template <typename U>
friend class Angle;

friend Angle<T> make_degree<T>(const T & value);
Expand All @@ -63,7 +63,7 @@ class Angle
explicit Angle(const T & data, const bool & is_degree = false);

public:
template<typename U>
template <typename U>
operator Angle<U>() const;

bool operator==(const Angle<T> & angle) const;
Expand Down Expand Up @@ -114,7 +114,7 @@ Angle<double> operator""_pi_rad(long double value);

} // namespace keisan

template<typename T, typename U>
template <typename T, typename U>
keisan::Angle<T> operator*(const U & value, const keisan::Angle<T> & angle);

#include "keisan/angle/angle.impl.hpp"
Expand Down
8 changes: 4 additions & 4 deletions include/keisan/angle/euler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@ namespace keisan
{

// Forward declaration
template<typename T>
template <typename T>
struct Quaternion;

template<typename T>
template <typename T>
struct Euler
{
Euler();
Euler(const Angle<T> & roll, const Angle<T> & pitch, const Angle<T> & yaw);

template<typename U>
template <typename U>
operator Euler<U>() const;

bool operator==(const Euler<T> & other) const;
Expand All @@ -53,7 +53,7 @@ struct Euler

} // namespace keisan

template<typename T>
template <typename T>
std::ostream & operator<<(std::ostream & out, const keisan::Euler<T> & euler);

#include "keisan/angle/euler.impl.hpp"
Expand Down
16 changes: 8 additions & 8 deletions include/keisan/angle/euler.impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "keisan/angle/quaternion.hpp"
#include "keisan/constant.hpp"

template<typename T>
template <typename T>
std::ostream & operator<<(std::ostream & out, const keisan::Euler<T> & euler)
{
return out << euler.roll.degree() << " " << euler.pitch.degree() << " " << euler.yaw.degree();
Expand All @@ -33,37 +33,37 @@ std::ostream & operator<<(std::ostream & out, const keisan::Euler<T> & euler)
namespace keisan
{

template<typename T>
template <typename T>
Euler<T>::Euler()
{
}

template<typename T>
template <typename T>
Euler<T>::Euler(const Angle<T> & roll, const Angle<T> & pitch, const Angle<T> & yaw)
: roll(roll), pitch(pitch), yaw(yaw)
{
}

template<typename T>
template<typename U>
template <typename T>
template <typename U>
Euler<T>::operator Euler<U>() const
{
return Euler<U>(roll, pitch, yaw);
}

template<typename T>
template <typename T>
bool Euler<T>::operator==(const Euler<T> & other) const
{
return roll == other.roll && yaw == other.yaw && pitch == other.pitch;
}

template<typename T>
template <typename T>
bool Euler<T>::operator!=(const Euler<T> & other) const
{
return roll != other.roll || yaw != other.yaw || pitch != other.pitch;
}

template<typename T>
template <typename T>
Quaternion<T> Euler<T>::quaternion() const
{
Quaternion<T> quaternion;
Expand Down
8 changes: 4 additions & 4 deletions include/keisan/angle/quaternion.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ namespace keisan
{

// Forward declaration
template<typename T>
template <typename T>
struct Euler;

template<typename T>
template <typename T>
struct Quaternion
{
Quaternion();
Quaternion(const T & x, const T & y, const T & z, const T & w);

template<typename U>
template <typename U>
operator Quaternion<U>() const;

bool operator==(const Quaternion<T> & other) const;
Expand All @@ -52,7 +52,7 @@ struct Quaternion

} // namespace keisan

template<typename T>
template <typename T>
std::ostream & operator<<(std::ostream & out, const keisan::Quaternion<T> & quaternion);

#include "keisan/angle/quaternion.impl.hpp"
Expand Down
16 changes: 8 additions & 8 deletions include/keisan/angle/quaternion.impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

using keisan::literals::operator""_pi;

template<typename T>
template <typename T>
std::ostream & operator<<(std::ostream & out, const keisan::Quaternion<T> & quaternion)
{
return out << quaternion.x << " " << quaternion.y << " " << quaternion.z << " " << quaternion.w;
Expand All @@ -35,37 +35,37 @@ std::ostream & operator<<(std::ostream & out, const keisan::Quaternion<T> & quat
namespace keisan
{

template<typename T>
template <typename T>
Quaternion<T>::Quaternion()
{
}

template<typename T>
template <typename T>
Quaternion<T>::Quaternion(const T & x, const T & y, const T & z, const T & w)
: x(x), y(y), z(z), w(w)
{
}

template<typename T>
template<typename U>
template <typename T>
template <typename U>
Quaternion<T>::operator Quaternion<U>() const
{
return Quaternion<U>(x, y, z, w);
}

template<typename T>
template <typename T>
bool Quaternion<T>::operator==(const Quaternion<T> & other) const
{
return x == other.x && y == other.y && z == other.z && w == other.w;
}

template<typename T>
template <typename T>
bool Quaternion<T>::operator!=(const Quaternion<T> & other) const
{
return x != other.x || y != other.y || z != other.z || w != other.w;
}

template<typename T>
template <typename T>
Euler<T> Quaternion<T>::euler() const
{
Euler<T> euler;
Expand Down
2 changes: 1 addition & 1 deletion include/keisan/constant.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
namespace keisan
{

template<typename T>
template <typename T>
const T pi = std::atan((T)1) * 4;

namespace literals
Expand Down
5 changes: 2 additions & 3 deletions include/keisan/keisan.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@
#ifndef KEISAN__KEISAN_HPP_
#define KEISAN__KEISAN_HPP_

#include "keisan/geometry/point_2.hpp"
#include "keisan/geometry/point_3.hpp"

#include "keisan/angle.hpp"
#include "keisan/constant.hpp"
#include "keisan/geometry/point_2.hpp"
#include "keisan/geometry/point_3.hpp"
#include "keisan/matrix.hpp"
#include "keisan/number.hpp"

Expand Down
12 changes: 6 additions & 6 deletions include/keisan/matrix/matrix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@
namespace keisan
{

template<size_t M, size_t N>
template <size_t M, size_t N>
class Matrix
{
public:
Matrix();

template<typename ... Types>
explicit Matrix(const double & value, Types ... the_rest);
template <typename... Types>
explicit Matrix(const double & value, Types... the_rest);

Matrix(const Matrix<M, N> & matrix);

Expand All @@ -59,7 +59,7 @@ class Matrix
Matrix<M, N> & operator*=(const double & value);
Matrix<M, N> & operator/=(const double & value);

template<size_t O>
template <size_t O>
Matrix<M, O> operator*(const Matrix<N, O> & matrix);

Vector<M> operator*(const Vector<N> & vector);
Expand Down Expand Up @@ -93,10 +93,10 @@ Matrix<4, 4> rotation_matrix(const Euler<double> & angle);

} // namespace keisan

template<size_t M, size_t N>
template <size_t M, size_t N>
std::ostream & operator<<(std::ostream & out, const keisan::Matrix<M, N> & matrix);

template<size_t M, size_t N>
template <size_t M, size_t N>
keisan::Matrix<M, N> operator*(const double & value, const keisan::Matrix<M, N> & matrix);

#include "keisan/matrix/matrix.impl.hpp"
Expand Down
Loading

0 comments on commit 505a744

Please sign in to comment.