asge::math
Namespaces
Classes & Structs
ArcLengthSample
Struct
CatmullRomSpline
Class
Circle
Struct
Rect
Struct
Tween
Class
Vec2
Class
Vec3
Class
VecN
Class
Enumerations
enum class EasingThe easing curves a Tween can follow: how progress in [0, 1] is reshaped over time.
LinearInQuadOutQuadInOutQuadOutCubicTypedefs
Functions
Computes a circle's outline points using the midpoint circle algorithm.
Walks one octant with an integer error term (no trig/floats) and mirrors each point across both axes and the diagonal to cover the full circle.
inCenter | The center of the circle |
inRadius | The radius of the circle |
The circle's outline points
bool AabbOverlap(Rect const &inA, Rect const &inB) noexceptAxis-aligned overlap test between two rectangles.
bool CircleOverlap(Circle const &inA, Circle const &inB) noexceptOverlap test between two circles (distance between centers vs.
summed radii).
Minimum translation vector to separate two overlapping AABBs.
Returns the smallest push-out along whichever axis (X or Y) has the lesser penetration depth, signed so applying it to inA's position moves it away from inB. std::nullopt if the boxes don't overlap.
Minimum translation vector to separate two overlapping circles.
Pushes along the line between the two centers, signed so applying it to inA's position moves it away from inB. std::nullopt if they don't overlap; if the centers exactly coincide, pushes along +X arbitrarily.
PenetrationVector(Rect, Circle) with the push direction flipped — moves the circle away from the rect instead.
bool Contains(Rect const &inRect, Float2 const &inP) noexceptTrue if inP falls strictly inside inRect a point exactly on an edge does not count.
bool Contains(Rect const &inRect1, Rect const &inRect2) noexceptTrue if inRect2 lies fully inside inRect1 unlike the point overload, shared edges count as inside.
float Distance(Rect const &inRect, Float2 const &inP) noexceptComputes the distance between a Rect and a point.
Merges two rects into a single bigger rect.
float BuildArcLengthTable(Float2 const &inP0, Float2 const &inP1, Float2 const &inP2, Float2 const &inP3, std::size_t inResolution, std::vector< ArcLengthSample > &outTable) noexceptSamples a Hermite segment at inResolution evenly spaced steps and appends the resulting (t, cumulative distance) pairs to outTable.
Returns the segment's total arc length.
Float2 Hermite(Float2 const &inP0, Float2 const &inP1, Float2 const &inP2, Float2 const &inP3, float inT) noexceptEvaluates a Catmull-Rom segment, expressed via its Hermite basis, at parameter inT in [0, 1], where inP1/inP2 are the segment's endpoints and inP0/inP3 are the neighbouring waypoints used to derive the endpoint tangents.
Float2 HermiteDerivative(Float2 const &inP0, Float2 const &inP1, Float2 const &inP2, Float2 const &inP3, float inT) noexceptDerivative of Hermite() with respect to inT, i.e.
the (non normalized) tangent vector of the segment at parameter inT.
float Ease(Easing inEasing, float inT) noexceptMaps inT (clamped to [0, 1]) through inEasing, so 0 stays 0 and 1 stays 1.
Rotates inVector by inAngle radians about the origin.
Positive angles turn clockwise on screen, matching this engine's screen-space (Y-down) convention.
template<std::size_t N, _internal::Numeric T, typename Derived> T LengthSquared(VecN< N, T, Derived > const &inVector) noexcepttemplate<std::size_t N, _internal::Numeric T, typename Derived> auto Length(VecN< N, T, Derived > const &inVector) noexcepttemplate<std::size_t N, _internal::Numeric T, typename Derived> auto Distance(VecN< N, T, Derived > const &inVec1, VecN< N, T, Derived > const &inVec2) noexcepttemplate<std::size_t N, _internal::Numeric T, typename Derived> Derived NormalizeVec(VecN< N, T, Derived > const &inVector) noexceptReturns inVector scaled to unit length.
Dividing by a zero length (a zero vector) yields a vector of NaNs/infinities.