NedSpace

Struct NedSpace 

Source
pub struct NedSpace { /* private fields */ }
Expand description

A local tangent-plane spatial context using the North-East-Down (NED) reference frame.

NedSpace represents a point in a locally linearized coordinate system centered at a reference geodetic location (typically defined by a GPS fix). It is commonly used in aerospace, robotics, and real-time navigation systems to express motion and sensor positions relative to a local Earth-aligned frame.

This frame uses the following axis definitions:

  • North (+N): tangential to the Earth’s surface, pointing toward the North Pole
  • East (+E): tangential to the Earth’s surface, perpendicular to North, pointing eastward
  • Down (+D): aligned with gravity, pointing toward the Earth’s center (positive downward)

This results in a right-handed coordinate system with the origin at a defined reference point, and the frame fixed to the Earth — making it suitable for integrating IMUs, magnetometers, and other aircraft-attached sensors.

§Fields

  • id: Unique numeric identifier for this NED spatial context (e.g., sensor ID)
  • north: Position in meters along the northward axis
  • east: Position in meters along the eastward axis
  • down: Position in meters along the downward (gravity-aligned) axis

§Coordinate Index Mapping

When used with the Coordinate trait, the following index mapping applies:

  • 0 => north
  • 1 => east
  • 2 => down

§Common Applications

  • Aircraft position estimation relative to a flight segment origin
  • Magnetometer placement in local frame for MagNav systems
  • Inertial Navigation System (INS) drift correction
  • Real-time sensor fusion in autonomous drones or ground vehicles

§Example

use deep_causality::*;

let n1 = NedSpace::new(1, 0.0, 0.0, 0.0);      // Reference origin
let n2 = NedSpace::new(2, 100.0, 50.0, 10.0);  // 100m North, 50m East, 10m below origin

println!("{}", n2);

assert_eq!(n2.dimension(), 3);
assert_eq!(n1.distance(&n2), (100.0_f64.powi(2) + 50.0_f64.powi(2) + 10.0_f64.powi(2)).sqrt());

§Notes

  • The “down” axis is positive in the direction of gravity. This is a key difference from ENU (East-North-Up) or typical 3D Cartesian conventions.
  • This struct assumes flat-Earth approximation — for global modeling, use GeoSpace or EcefSpace.

Implementations§

Source§

impl NedSpace

Source

pub fn north(&self) -> f64

Source

pub fn east(&self) -> f64

Source

pub fn down(&self) -> f64

Source§

impl NedSpace

Source

pub fn new(id: u64, north: f64, east: f64, down: f64) -> Self

Trait Implementations§

Source§

impl Adjustable<f64> for NedSpace

Source§

fn update<const W: usize, const H: usize, const D: usize, const C: usize>( &mut self, array_grid: &ArrayGrid<f64, W, H, D, C>, ) -> Result<(), UpdateError>

The default implementation does nothing to keep update optional. Override this method to implement a node update when needed. For a sample implementation, see src/types/context_types/node_types_adjustable
Source§

fn adjust<const W: usize, const H: usize, const D: usize, const C: usize>( &mut self, array_grid: &ArrayGrid<f64, W, H, D, C>, ) -> Result<(), AdjustmentError>

The default implementation does nothing to keep adjustment optional. Override this method to implement a node adjustment when needed. Depending on the type of node adjustment, select a 1, 2,3, or 4 dimensional array grid that contains the transformation data to apply to the node. For a sample implementation, see src/types/context_types/node_types_adjustable
Source§

impl Clone for NedSpace

Source§

fn clone(&self) -> NedSpace

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Coordinate<f64> for NedSpace

Source§

fn dimension(&self) -> usize

Returns the number of dimensions in the coordinate system (always 3).

Source§

fn coordinate(&self, index: usize) -> Result<&f64, IndexError>

Returns a reference to the coordinate value at the specified index.

§Index Mapping
  • 0 => north
  • 1 => east
  • 2 => down
§Errors

Returns IndexError if the index is out of bounds.

Source§

impl Debug for NedSpace

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for NedSpace

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Identifiable for NedSpace

Source§

fn id(&self) -> u64

Source§

impl Metric<f64> for NedSpace

Source§

fn distance(&self, other: &Self) -> f64

Computes a scalar distance or influence between self and other.
Source§

impl PartialEq for NedSpace

Source§

fn eq(&self, other: &NedSpace) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Spatial<f64> for NedSpace

Source§

impl StructuralPartialEq for NedSpace

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Satisfies<NoConstraint> for T