EuclideanSpace

Struct EuclideanSpace 

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

A 3-dimensional spatial context represented in standard Euclidean coordinates (x, y, z).

This struct is used as the default implementation of a purely spatial context in the DeepCausality framework. It supports coordinate access and distance measurement based on Euclidean geometry.

§Fields

  • id: A unique identifier for this spatial entity
  • x: X-coordinate in meters
  • y: Y-coordinate in meters
  • z: Z-coordinate in meters

§Coordinate Index Mapping

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

  • 0 => x
  • 1 => y
  • 2 => z

§Examples

use deep_causality::*;

let space_a = EuclideanSpace::new(1, 1.0, 2.0, 3.0);
let space_b = EuclideanSpace::new(2, 4.0, 6.0, 3.0);

assert_eq!(space_a.dimension(), 3);
assert_eq!(space_a.coordinate(1).unwrap(), &2.0);
assert_eq!(space_a.distance(&space_b), 5.0);

Implementations§

Source§

impl EuclideanSpace

Source

pub fn x(&self) -> f64

Source

pub fn y(&self) -> f64

Source

pub fn z(&self) -> f64

Source§

impl EuclideanSpace

Source

pub fn new(id: u64, x: f64, y: f64, z: f64) -> Self

Trait Implementations§

Source§

impl Adjustable<f64> for EuclideanSpace

Source§

fn update<const WIDTH: usize, const HEIGHT: usize, const DEPTH: usize, const TIME: usize>( &mut self, array_grid: &ArrayGrid<f64, WIDTH, HEIGHT, DEPTH, TIME>, ) -> 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 WIDTH: usize, const HEIGHT: usize, const DEPTH: usize, const TIME: usize>( &mut self, array_grid: &ArrayGrid<f64, WIDTH, HEIGHT, DEPTH, TIME>, ) -> 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 EuclideanSpace

Source§

fn clone(&self) -> EuclideanSpace

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 EuclideanSpace

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 => x
  • 1 => y
  • 2 => z
§Errors

Returns IndexError if the index is out of bounds.

Source§

impl Debug for EuclideanSpace

Source§

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

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

impl Display for EuclideanSpace

Source§

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

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

impl Identifiable for EuclideanSpace

Source§

fn id(&self) -> u64

Source§

impl Metric<f64> for EuclideanSpace

Source§

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

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

impl PartialEq for EuclideanSpace

Source§

fn eq(&self, other: &EuclideanSpace) -> 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 EuclideanSpace

Source§

impl StructuralPartialEq for EuclideanSpace

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