Document and refactor geom code, round 2.

- Doxygenate headers.
- Rename to bring methods and functions in line with everything else.
This commit is contained in:
2023-10-20 21:17:18 -07:00
parent 6a421d6adf
commit 0c7fa41cc8
10 changed files with 68 additions and 55 deletions

View File

@@ -174,7 +174,7 @@ public:
/// \note This must be explicitly called before calling any
/// method which uses the filter's internal Δt.
///
/// \param The time delta to use when no time delta is
/// \param newDeltaT The time delta to use when no time delta is
/// provided.
void
DeltaT(T newDeltaT)

View File

@@ -39,8 +39,7 @@ class Point2D;
class Polar2D;
/// \brief Point2D is a logical grouping of a set of 2D cartesian
/// coordinates.
/// \brief Point2D is a cartesian (X,Y) pairing.
class Point2D : public Vector<int, 2> {
public:
/// \brief A Point2D defaults to (0,0).
@@ -97,37 +96,63 @@ public:
friend std::ostream &operator<<(std::ostream &outs, const Point2D &pt);
};
// A Polar2D is a 2D polar coordinate, specified in terms of the radius from
// some origin and the Angle from the positive X Axis of a cartesian coordinate
// system.
/// \brief Polar2D is a pairing of a radius r and angle θ from some
/// reference point; in this library, it is assumed to be the
/// Cartesian origin (0, 0).
class Polar2D : public Vector<double, 2> {
public:
// A Polar2D can be initialised as a zeroised polar coordinate, by specifying
// the radius and Angle directly, or via conversion from a Point2D.
Polar2D();
Polar2D(double _r, double _theta);
Polar2D(const Point2D &);
/// A Polar2D can be initialised as a zeroised polar coordinate, by specifying
/// the radius and Angle directly, or via conversion from a Point2D.
/// \brief Construct a zero polar coordinate.
Polar2D();
/// \brief Construct a polar coordinate from a radius and
/// angle.
///
/// \param _r A radius
/// \param _theta An angle
Polar2D(double _r, double _theta);
/// \brief Construct a polar coordinate from a point.
///
/// This construct uses the origin (0,0) as the reference point.
///
/// \param point A 2D Cartesian point.
Polar2D(const Point2D& point);
/// \brief Return the radius component of this coordinate.
double R() const;
/// \brief Set the radius component of this coordinate.
void R(const double _r);
/// \brief Return the angle component of this coordinate.
double Theta() const;
/// \brief Set the angle component of this coordinate.
void Theta(const double _theta);
/// \brief Return the coordinate in string form.
std::string ToString();
void ToPoint(Point2D &);
// Rotate rotates the polar coordinate by the number of radians, storing the result
// in the Polar2D argument.
void Rotate(Polar2D &, double);
/// \brief Construct a Point2D representing this Polar2D.
void ToPoint(Point2D &point);
// RotateAround rotates this point about by theta radians, storing the rotated point
// in result.
void RotateAround(const Point2D &other, Point2D &result, double tjeta);
/// \brief Rotate polar coordinate by some angle.
///
/// \param rotated The rotated Polar2D will be stored in this
/// coordinate.
/// \param delta The angle to rotate by.
void Rotate(Polar2D &rotated, double delta);
/// \brief Rotate this polar coordinate around a 2D point.
///
/// \param other The reference point.
/// \param result The point where the result will stored.
/// \param delta The angle to rotate by.
void RotateAround(const Point2D &other, Point2D &result, double delta);
bool operator==(const Polar2D &) const;
bool operator!=(const Polar2D &rhs) const
{ return !(*this == rhs); }
friend std::ostream &operator<<(std::ostream &, const Polar2D &);
};

View File

@@ -266,8 +266,8 @@ public:
/// Return the Euler angles for this MakeQuaternion as a vector of
/// <yaw, pitch, roll>.
///
/// \warn Users of this function should watch out for gimbal
/// lock.
/// \warning Users of this function should watch out for gimbal
/// lock.
///
/// \return A vector<T, 3> containing <yaw, pitch, roll>
Vector<T, 3>
@@ -492,7 +492,7 @@ MakeQuaternion(Vector<T, 3> axis, T angle)
/// \return A Quaternion representation of the Orientation represented
/// by the Euler angles.
/// \relatesalso Quaternion
Quaternionf QuaternionFromEuler(Vector3F euler);
Quaternionf FloatQuaternionFromEuler(Vector3F euler);
/// \brief COnstruct a Quaternion from Euler angles.
@@ -504,7 +504,7 @@ Quaternionf QuaternionFromEuler(Vector3F euler);
/// \return A Quaternion representation of the Orientation represented
/// by the Euler angles.
/// \relatesalso Quaternion
Quaterniond QuaternionFromEuler(Vector3D euler);
Quaterniond DoubleQuaternionFromEuler(Vector3D euler);
/// \brief Linear interpolation for two Quaternions.

View File

@@ -1,5 +1,5 @@
///
/// \file Flag.h
/// \file include/scsl/Flags.h
/// \author K. Isom <kyle@imap.cc>
/// \date 2023-10-12
/// \brief Flag declares a command-line flag parser.

View File

@@ -89,7 +89,7 @@ std::vector<std::string> SplitKeyValuePair(std::string line, char delimiter);
/// \param maxCount The maximum number of parts to split. If 0, there is no
/// limit to the number of parts.
/// \return A vector containing all the parts of the string.
std::vector<std::string> SplitN(std::string, std::string delimiter, size_t maxCount=0);
std::vector<std::string> SplitN(std::string s, std::string delimiter, size_t maxCount=0);
/// WrapText is a very simple wrapping function that breaks the line into
/// lines of At most lineLength characters. It does this by breaking the