The vulcan::geometry module provides spatial computation utilities for guidance, visibility, and sensor field-of-view calculations. It is designed to work seamlessly with both numeric (double) and symbolic (janus::SymbolicScalar) types for automatic differentiation in trajectory optimization.
Overview
The module provides:
- Line-of-Sight: Slant range, azimuth/elevation angles, and angular rates.
- Ray Intersections: Sphere, plane, and cone (FOV) intersection tests.
- Projections: Project to plane and ground track point.
Basic Usage
Include
Line-of-Sight Computations
Vec3<double> observer(0, 0, 0);
Vec3<double> target(10000, 5000, -2000);
Vec2<double> angles =
los_angles(observer, target);
double azimuth = angles(0);
double elevation = angles(1);
Definition Geometry.hpp:14
Vec2< Scalar > los_angles(const Vec3< Scalar > &r_observer, const Vec3< Scalar > &r_target)
Compute line-of-sight azimuth and elevation angles.
Definition Geometry.hpp:51
Scalar slant_range(const Vec3< Scalar > &r_observer, const Vec3< Scalar > &r_target)
Compute slant range (distance) between two points.
Definition Geometry.hpp:29
Scalar range(const Vec3< Scalar > &r1, const Vec3< Scalar > &r2)
Definition FrameKinematics.hpp:178
LOS Angular Rates (Target Tracking)
For tracking scenarios where both observer and target are moving:
Vec3<double> r_obs(0, 0, 0);
Vec3<double> v_obs(0, 0, 0);
Vec3<double> r_tgt(10000, 0, 0);
Vec3<double> v_tgt(0, 200, 0);
Vec2<double> rates =
los_rate(r_obs, v_obs, r_tgt, v_tgt);
double az_rate = rates(0);
double el_rate = rates(1);
Vec2< Scalar > los_rate(const Vec3< Scalar > &r_obs, const Vec3< Scalar > &v_obs, const Vec3< Scalar > &r_tgt, const Vec3< Scalar > &v_tgt)
Compute line-of-sight angular rates.
Definition Geometry.hpp:95
Ray Intersections
Ray-Sphere Intersection
Useful for Earth intercept calculations or collision detection:
Vec3<double> origin(0, 0, -7000000);
Vec3<double> direction(0, 0, 1);
Vec3<double> center(0, 0, 0);
double radius = 6371000;
if (t > 0) {
Vec3<double> impact = origin + t * direction;
}
Scalar ray_sphere_intersection(const Vec3< Scalar > &origin, const Vec3< Scalar > &direction, const Vec3< Scalar > ¢er, const Scalar &radius)
Ray-sphere intersection.
Definition Geometry.hpp:156
Ray-Plane Intersection
For ground targeting or terrain intersection:
Vec3<double> origin(0, 0, -5000);
Vec3<double> direction(0.707, 0, 0.707);
direction.normalize();
Vec3<double> ground_normal(0, 0, -1);
Vec3<double> ground_point(0, 0, 0);
Scalar ray_plane_intersection(const Vec3< Scalar > &origin, const Vec3< Scalar > &direction, const Vec3< Scalar > &plane_normal, const Vec3< Scalar > &plane_point)
Ray-plane intersection.
Definition Geometry.hpp:205
Sensor FOV Check (Point in Cone)
Check if a target is within a sensor's field of view:
Vec3<double> sensor_pos(0, 0, 0);
Vec3<double> sensor_axis(1, 0, 0);
double half_angle = 15.0 * M_PI / 180.0;
Vec3<double> target(100, 10, 0);
double inside =
point_in_cone(target, sensor_pos, sensor_axis, half_angle);
if (inside > 0.5) {
}
Scalar point_in_cone(const Vec3< Scalar > &point, const Vec3< Scalar > &apex, const Vec3< Scalar > &axis, const Scalar &half_angle)
Check if a point lies within a cone (e.g., sensor FOV).
Definition Geometry.hpp:240
Projections
Project to Plane
Vec3<double> point(100, 200, 500);
Vec3<double> plane_normal(0, 0, 1);
Vec3<double> plane_point(0, 0, 0);
Vec3< Scalar > project_to_plane(const Vec3< Scalar > &point, const Vec3< Scalar > &plane_normal, const Vec3< Scalar > &plane_point)
Project a point onto a plane.
Definition Geometry.hpp:279
Ground Track Point
Project an orbital position to the Earth's surface:
LLA< Scalar > ground_track_point(const Vec3< Scalar > &r_ecef, const EarthModel &model=EarthModel::WGS84())
Project ECEF position to ellipsoid surface (ground track point).
Definition Geometry.hpp:302
Vec3< Scalar > ground_track_ecef(const Vec3< Scalar > &r_ecef, const EarthModel &model=EarthModel::WGS84())
Compute ground track point and return as ECEF.
Definition Geometry.hpp:321
Vec3< Scalar > lla_to_ecef(const LLA< Scalar > &lla, const EarthModel &m=EarthModel::WGS84())
Definition Geodetic.hpp:152
Definition Geodetic.hpp:27
Symbolic Optimization
All functions are Janus-compatible for trajectory optimization:
using MX = janus::SymbolicScalar;
MX ox = sym("ox"), oy = sym("oy"), oz = sym("oz");
MX tx = sym("tx"), ty = sym("ty"), tz = sym("tz");
Vec3<MX> observer, target;
observer << ox, oy, oz;
target << tx, ty, tz;
janus::Function f(
"range", {ox, oy, oz, tx, ty, tz}, {
range});
auto result =
f({0, 0, 0, 3, 4, 0});
auto jacobian =
f.jacobian({0, 0, 0, 3, 4, 0});
constexpr double f
Flattening (WGS84).
Definition Constants.hpp:25
Example: FOV Optimization
MX sensor_az = sym("az");
Vec3<MX> axis;
axis << janus::cos(sensor_az), janus::sin(sensor_az), MX(0);
MX visible =
point_in_cone(target_position, sensor_pos, axis, fov_half);
Coordinate Frame Notes
- LOS Angles: Azimuth is measured from +X axis, positive clockwise. Elevation is measured from XY plane, positive upward.
- NED Convention: Negative Z is "up", so targets above the observer have negative Z components.
- Ground Track: Uses the same ellipsoid model as ecef_to_lla (WGS84 by default).
See Also