47#ifndef _N_TRAJECTORY_HEADER
48#define _N_TRAJECTORY_HEADER
62#define TRAJECTORY_INTERP 1
64#define TRAJECTORY_EXTRAP 2
66#define TRAJECTORY_BEFORE 3
69#define TRAJECTORY_2D 2
71#define TRAJECTORY_3D 3
double VECTOR3D[3]
struct of a point
structure of the physics of an object
VECTOR3D m0_orient
Hermite tangent at start for orientation (start.angular_speed * duration)
PHYSICS current
current computed state at current_time
VECTOR3D m0
Hermite tangent at start for position (start.speed * duration)
VECTOR3D m1_orient
Hermite tangent at end for orientation (end.angular_speed * duration)
int nb_points_allocated
allocated capacity of the points array
int nb_points
number of waypoints in the points array
double current_time
last computed time
PHYSICS end
state at trajectory end (terminal known state)
double time_val
timestamp of this waypoint
double duration
duration = end_time - start_time
TRAJECTORY_POINT * points
array of waypoints for multi-point paths (NULL if single segment)
int current_segment
index of the currently loaded segment (points[i] -> points[i+1]), -1 if none
PHYSICS state
physics state (position, speed, etc.) at this waypoint
int mode
current computation mode: TRAJECTORY_INTERP, TRAJECTORY_EXTRAP, or TRAJECTORY_BEFORE
VECTOR3D m1
Hermite tangent at end for position (end.speed * duration)
PHYSICS start
state at trajectory start (initial known state)
int nb_components
number of components to process: TRAJECTORY_2D (2) or TRAJECTORY_3D (3)
double start_time
timestamp of start state
double end_time
timestamp of end state
int trajectory_get_position(TRAJECTORY *traj, double time_val, VECTOR3D out)
compute only position at given time, stores result in out
TRAJECTORY * trajectory_new(int nb_components)
allocate a new trajectory for 2D or 3D use
int trajectory_set_start(TRAJECTORY *traj, const PHYSICS *state, double time_val)
set the initial state and time of the trajectory
int trajectory_add_point(TRAJECTORY *traj, const PHYSICS *state, double time_val)
add a waypoint to the multi-point path (times must be strictly increasing)
void trajectory_delete(TRAJECTORY **traj)
free a trajectory
int trajectory_get_orientation(TRAJECTORY *traj, double time_val, VECTOR3D out)
compute only orientation at given time, stores result in out
int trajectory_get_acceleration(TRAJECTORY *traj, double time_val, VECTOR3D out)
compute only acceleration at given time, stores result in out
int trajectory_compute(TRAJECTORY *traj, double time_val)
compute full state (position, speed, acceleration, orientation) at given time
int trajectory_set_end(TRAJECTORY *traj, const PHYSICS *state, double time_val)
set the terminal state and time of the trajectory, recomputes Hermite tangents
int trajectory_get_speed(TRAJECTORY *traj, double time_val, VECTOR3D out)
compute only speed at given time, stores result in out
int trajectory_clear_points(TRAJECTORY *traj)
clear all waypoints from the multi-point path
int trajectory_update(TRAJECTORY *traj, const PHYSICS *new_end, double time_val)
shift: old end becomes new start, set a new end state (for continuous dead reckoning updates)
double trajectory_distance(TRAJECTORY *traj, double time_a, double time_b, int steps)
distance along the trajectory between two times
structure holding all data for trajectory interpolation / extrapolation
a single waypoint in a multi-point trajectory path
Simple 3D movement simulation.