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
impl OctVec
Sourcepub fn new(x: u64, y: u64, z: u64, depth: u8) -> Self
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
Sourcepub fn from_float_coords(x: f64, y: f64, z: f64, depth: u8) -> Self
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 1y
y coord of the float vector, from 0 to 1z
z coord of the float vector, from 0 to 1depth
The lod depth of the coord
Sourcepub fn get_float_coords(self) -> (f64, f64, f64)
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
Trait Implementations§
Source§impl LodVec for OctVec
impl LodVec for OctVec
Source§impl Ord for OctVec
impl Ord for OctVec
Source§impl PartialOrd for OctVec
impl PartialOrd for OctVec
impl Copy for OctVec
impl Eq for OctVec
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more