31 const auto iter = std::ranges::lower_bound(_coords,
coord,
comp);
40 LOG(Level::FATAL,
"Finalize not called before GetPosition");
41 throw PathException(
"Finalize not called before GetPosition");
64 LOG(Level::FATAL,
"Finalize not called before GetVelocity");
65 throw PathException(
"Finalize not called before GetVelocity");
80 auto xrp = std::ranges::upper_bound(_coords, t, {}, &
Coord::t);
81 auto idx = std::distance(_coords.begin(),
xrp);
86 if (
static_cast<std::size_t
>(
idx) >= _coords.size())
89 if (
idx < 1 ||
static_cast<std::size_t
>(
idx) >= _coords.size())
102 return (
p2.pos -
p1.pos) / dt;
107 auto xrp = std::ranges::upper_bound(_coords, t, {}, &
Coord::t);
108 std::ptrdiff_t
xri = 0;
109 if (
xrp == _coords.begin())
111 else if (
xrp == _coords.end())
112 xri =
static_cast<std::ptrdiff_t
>(_coords.size() - 1);
114 xri = std::distance(_coords.begin(),
xrp);
116 if (
xri < 1 ||
static_cast<std::size_t
>(
xri) >= _coords.size())
Exception class for handling path-related errors.
Vec3 getPosition(RealType t) const
Retrieves the position at a given time along the path.
InterpType
Types of interpolation supported by the Path class.
@ INTERP_STATIC
Hold the first coordinate for all query times.
@ INTERP_LINEAR
Linearly interpolate between neighboring coordinates.
@ INTERP_CUBIC
Cubically interpolate between neighboring coordinates.
void setInterp(InterpType settype) noexcept
Changes the interpolation type.
Vec3 getVelocity(RealType t) const
Retrieves the velocity at a given time along the path.
void addCoord(const Coord &coord) noexcept
Adds a coordinate to the path.
void finalize()
Finalizes the path, preparing it for interpolation.
A class representing a vector in rectangular coordinates.
double RealType
Type for real numbers.
constexpr RealType EPSILON
Machine epsilon for real numbers.
Coordinate and rotation structure operations.
Classes and operations for 3D geometry.
Header file for the logging system.
Provides the definition and functionality of the Path class for handling coordinate-based paths with ...
Utility functions for path interpolation and exception handling.
void getPositionLinear(RealType t, T &coord, const std::vector< T > &coords)
Performs linear interpolation between coordinate points.
void getPositionStatic(T &coord, const std::vector< T > &coords)
Interpolates a static position from a list of coordinates.
void getPositionCubic(RealType t, T &coord, const std::vector< T > &coords, const std::vector< T > &dd)
Performs cubic spline interpolation between coordinate points.
Represents a position in 3D space with an associated time.