FSplineMath
Sampling for SplineComponent points. Everything is in the points' own space (the actor's local space) and addressed by input key: key k lies on the segment from point floor(k) to the next, so 0 is the first point and SegmentCount the last (or the first again, on a closed loop). A curved segment is uniform Catmull-Rom through its neighbours, which passes through every point; a point marked linear makes the segment leaving it straight.
- Module
- Components
- Header
#include "Components/SplineMath.h"- Namespace
Mowo
Public functions
| Returns | Name | Description |
|---|---|---|
int32_t | SegmentCount | |
Vec3 | PositionAtKey | |
Vec3 | DirectionAtKey | Unit direction of travel at the key; +Z for a spline with no length. |
float | RollAtKey | |
Vec2 | ScaleAtKey | |
float | Length | Arc length by summing chords, subdivisions per segment. |
float | KeyAtDistance | The key distance metres along the curve, clamped to its ends. |
float | ClosestKey | The key of the curve point nearest position: a coarse scan, then a refinement inside the best step. |
Function details
SegmentCount
static int32_t SegmentCount(const std::vector<FSplinePoint>& points, bool closed)PositionAtKey
static Vec3 PositionAtKey(const std::vector<FSplinePoint>& points, bool closed, float key)DirectionAtKey
static Vec3 DirectionAtKey(const std::vector<FSplinePoint>& points, bool closed, float key)Unit direction of travel at the key; +Z for a spline with no length.
RollAtKey
static float RollAtKey(const std::vector<FSplinePoint>& points, bool closed, float key)ScaleAtKey
static Vec2 ScaleAtKey(const std::vector<FSplinePoint>& points, bool closed, float key)Length
static float Length(const std::vector<FSplinePoint>& points, bool closed, int32_t subdivisions = 16)Arc length by summing chords, subdivisions per segment.
KeyAtDistance
static float KeyAtDistance(const std::vector<FSplinePoint>& points, bool closed, float distance, int32_t subdivisions = 16)The key distance metres along the curve, clamped to its ends. The constant-speed walk a mover or a mesh-along-spline wants.
ClosestKey
static float ClosestKey(const std::vector<FSplinePoint>& points, bool closed, const Vec3& position, int32_t subdivisions = 16)The key of the curve point nearest position: a coarse scan, then a refinement inside the best step.