pub struct WaterVolume {
pub lo: IVec3,
pub hi: IVec3,
}Expand description
An axis-aligned box of water in grid-local voxel coordinates,
inclusive on both corners. See the module doc for the coordinate
conventions (surface = lo.z, z-down).
Fields§
§lo: IVec3Minimum corner (inclusive). lo.z is the surface layer.
hi: IVec3Maximum corner (inclusive). hi.z is the bottom layer.
Implementations§
Source§impl WaterVolume
impl WaterVolume
Sourcepub fn new(a: IVec3, b: IVec3) -> Self
pub fn new(a: IVec3, b: IVec3) -> Self
A volume spanning the two corners in any order (canonicalised
so lo <= hi per component — PartialEq compares fields, so
prefer this over a raw struct literal).
Sourcepub fn depth_local(&self, p: DVec3) -> Option<f64>
pub fn depth_local(&self, p: DVec3) -> Option<f64>
Depth of a continuous grid-local point below this volume’s
surface, in voxel units: Some(distance below the min-z face) when the point is inside the water, None outside.
Zero exactly at the surface plane; positive going down
(z-down).
Corner order is normalised HERE, not assumed: the fields are
pub (and easy to swap under z-down), so a hand-built
WaterVolume { lo: big, hi: small } queries identically to
its Self::new-canonicalised form — and identically before
and after a snapshot round-trip.
Trait Implementations§
Source§impl Clone for WaterVolume
impl Clone for WaterVolume
Source§fn clone(&self) -> WaterVolume
fn clone(&self) -> WaterVolume
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for WaterVolume
Source§impl Debug for WaterVolume
impl Debug for WaterVolume
Source§impl<'de> Deserialize<'de> for WaterVolume
impl<'de> Deserialize<'de> for WaterVolume
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for WaterVolume
Source§impl PartialEq for WaterVolume
impl PartialEq for WaterVolume
Source§impl Serialize for WaterVolume
impl Serialize for WaterVolume
impl StructuralPartialEq for WaterVolume
Auto Trait Implementations§
impl Freeze for WaterVolume
impl RefUnwindSafe for WaterVolume
impl Send for WaterVolume
impl Sync for WaterVolume
impl Unpin for WaterVolume
impl UnsafeUnpin for WaterVolume
impl UnwindSafe for WaterVolume
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more