← API Reference Namespace

asge::math

Namespaces

Classes & Structs

Enumerations

#enum class Easing

The easing curves a Tween can follow: how progress in [0, 1] is reshaped over time.

Linear
InQuad
OutQuad
InOutQuad
OutCubic

Typedefs

#using Float2 = Vec2< float >
#using Double2 = Vec2< double >
#using Int2 = Vec2< int >
#using Int642 = Vec2< std::int64_t >
#using Float3 = Vec3< float >
#using Double3 = Vec3< double >
#using Int3 = Vec3< int >
#using Int643 = Vec3< std::int64_t >

Functions

#std::vector< Int2 > MidpointCirclePoints(Int2 inCenter, int inRadius)

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.

Parameters
inCenter

The center of the circle

inRadius

The radius of the circle

Returns

The circle's outline points

#Rect BoundingRect(Circle const &inCircle) noexcept
#bool AabbOverlap(Rect const &inA, Rect const &inB) noexcept

Axis-aligned overlap test between two rectangles.

#bool CircleOverlap(Circle const &inA, Circle const &inB) noexcept

Overlap test between two circles (distance between centers vs.

summed radii).

#std::optional< Float2 > PenetrationVector(Rect const &inA, Rect const &inB) noexcept

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.

#std::optional< Float2 > PenetrationVector(Circle const &inA, Circle const &inB) noexcept

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.

#std::optional< Float2 > PenetrationVector(Rect const &inRect, Circle const &inCircle) noexcept

Minimum translation vector to separate an overlapping Rect and Circle.

Signed so applying it to inRect's position moves the rect away from the circle. std::nullopt if they don't overlap. See PenetrationVector(Circle, Rect) for the same pair with the push direction flipped.

#std::optional< Float2 > PenetrationVector(Circle const &inCircle, Rect const &inRect) noexcept

PenetrationVector(Rect, Circle) with the push direction flipped — moves the circle away from the rect instead.

#bool Contains(Rect const &inRect, Float2 const &inP) noexcept

True if inP falls strictly inside inRect a point exactly on an edge does not count.

#bool Contains(Rect const &inRect1, Rect const &inRect2) noexcept

True if inRect2 lies fully inside inRect1 unlike the point overload, shared edges count as inside.

#float Distance(Rect const &inRect, Float2 const &inP) noexcept

Computes the distance between a Rect and a point.

#Rect Merge(Rect const &inR1, Rect const &inR2) noexcept

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) noexcept

Samples 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) noexcept

Evaluates 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) noexcept

Derivative 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) noexcept

Maps inT (clamped to [0, 1]) through inEasing, so 0 stays 0 and 1 stays 1.

#Float2 Rotate(Float2 inVector, float inAngle) noexcept

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) noexcept
#template<std::size_t N, _internal::Numeric T, typename Derived> auto Length(VecN< N, T, Derived > const &inVector) noexcept
#template<std::size_t N, _internal::Numeric T, typename Derived> auto Distance(VecN< N, T, Derived > const &inVec1, VecN< N, T, Derived > const &inVec2) noexcept
#template<std::size_t N, _internal::Numeric T, typename Derived> Derived NormalizeVec(VecN< N, T, Derived > const &inVector) noexcept

Returns inVector scaled to unit length.

Dividing by a zero length (a zero vector) yields a vector of NaNs/infinities.