Struct OctVec

Source
pub struct OctVec {
    pub x: u64,
    pub y: u64,
    pub z: u64,
    pub depth: u8,
}
Expand description

A Lod Vector for use in an octree It subdivides into 8 children of equal size

Fields§

§x: u64

x position in the octree

§y: u64

y position in the octree

§z: u64

z position in the octree

§depth: u8

lod depth in the octree this is limited, hence we use u8

Implementations§

Source§

impl OctVec

Source

pub fn new(x: u64, y: u64, z: u64, depth: u8) -> Self

creates a new vector from the raw x and y coords

§Args
  • x The x position in the tree. Allowed range scales with the depth (doubles as the depth increases by one)
  • y The y position in the tree. Allowed range scales with the depth (doubles as the depth increases by one)
  • z The z position in the tree. Allowed range scales with the depth (doubles as the depth increases by one)
  • depth the lod depth the coord is at. This is soft limited at roughly 60, and the tree might behave weird if it gets higher
Source

pub fn from_float_coords(x: f64, y: f64, z: f64, depth: u8) -> Self

creates a new vector from floating point coords mapped so that (0, 0, 0) is the front bottom left corner and (1, 1, 1) is the back top right

§Args
  • x x coord of the float vector, from 0 to 1
  • y y coord of the float vector, from 0 to 1
  • z z coord of the float vector, from 0 to 1
  • depth The lod depth of the coord
Source

pub fn get_float_coords(self) -> (f64, f64, f64)

converts the coord into float coords Returns a tuple of (x: f64, y: f64, z: f64) to represent the coordinates, at the front bottom left corner

Source

pub fn get_size(self) -> f64

gets the size the chunk of this lod vector takes up, with the root taking up

Trait Implementations§

Source§

impl Clone for OctVec

Source§

fn clone(&self) -> OctVec

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 Debug for OctVec

Source§

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

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

impl Default for OctVec

Source§

fn default() -> OctVec

Returns the “default value” for a type. Read more
Source§

impl LodVec for OctVec

Source§

fn num_children() -> usize

get the number of child nodes a node can have in the tree
Source§

fn root() -> Self

returns the lod vector as if it’s at the root of the tree
Source§

fn get_child(self, index: usize) -> Self

gets one of the child node position of this node, defined by it’s index
Source§

fn can_subdivide(self, node: Self, detail: u64) -> bool

wether the node can subdivide, compared to another node and the required detail. Read more
Source§

impl Ord for OctVec

Source§

fn cmp(&self, other: &OctVec) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for OctVec

Source§

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

Source§

fn partial_cmp(&self, other: &OctVec) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Copy for OctVec

Source§

impl Eq for OctVec

Source§

impl StructuralPartialEq for OctVec

Auto Trait Implementations§

§

impl Freeze for OctVec

§

impl RefUnwindSafe for OctVec

§

impl Send for OctVec

§

impl Sync for OctVec

§

impl Unpin for OctVec

§

impl UnwindSafe for OctVec

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, 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.