57 const float r_cos_theta = radius * std::cos(theta);
60 r_cos_theta * std::cos(
phi),
61 r_cos_theta * std::sin(
phi),
62 radius * std::sin(theta)
math::fvec3 wander_2d(const agent &agent, float noise, float distance, float radius, float &angle)
Steers an agent in a continuously shifting random direction on the yaw plane.
math::fvec3 wander_3d(const agent &agent, float noise, float distance, float radius, float &theta, float &phi)
Steers an agent in a continuously shifting random direction.
math::fvec3 seek(const agent &agent, const math::fvec3 &target)
Attempts to steer an agent so that it moves toward a target.
Artificial intelligence (AI)
constexpr T phi
Golden ratio constant.
T angle(const vector< T, N > &from, const vector< T, N > &to)
Calculates the angle between two direction vectors.
quaternion< T > angle_axis(T angle, const vec3< T > &axis)
Creates a rotation from an angle and axis.
T random(T start, T end)
Generates a pseudo-random floating point number on [start, end) using std::rand().
T distance(const vector< T, N > &p0, const vector< T, N > &p1)
Calculates the distance between two points.
std::array< quaternion< T >, 2 > swing_twist(const quaternion< T > &q, const vec3< T > &twist_axis, T tolerance=T{1e-6})
Decomposes a quaternion into swing and twist rotation components.
T offset(T longitude)
Calculates the UTC offset at a given longitude.
Autonomous agent governed by steering behaviors.
math::fquat orientation
Orientation quaternion.
math::fvec3 up
Orthonormal basis up direction vector.
math::fvec3 position
Cartesian position vector.
math::fvec3 forward
Orthonormal basis forward direction vector.