pub struct CsgGeometry { /* private fields */ }Expand description
A target of CSG solids, each tagged with a material. See the module docs for the ownership rules.
Implementations§
Source§impl CsgGeometry
impl CsgGeometry
Sourcepub fn new(
materials: Vec<Material>,
solids: Vec<(Csg, u32)>,
) -> Result<Self, GeometryError>
pub fn new( materials: Vec<Material>, solids: Vec<(Csg, u32)>, ) -> Result<Self, GeometryError>
Build from the material list and (solid, material index) pairs, in
priority order (the first listed owns overlaps). Lengths in metres.
Cylinder axes and half-space normals are normalised.
Sourcepub fn solid(&self, region: usize) -> &Csg
pub fn solid(&self, region: usize) -> &Csg
The solid of region (validated: unit cylinder axes and half-space
normals).
Sourcepub fn tolerance_m(&self) -> f64
pub fn tolerance_m(&self) -> f64
The geometric tolerance of the ownership rules, m.
Trait Implementations§
Source§impl Clone for CsgGeometry
impl Clone for CsgGeometry
Source§fn clone(&self) -> CsgGeometry
fn clone(&self) -> CsgGeometry
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CsgGeometry
impl Debug for CsgGeometry
Source§impl Geometry for CsgGeometry
impl Geometry for CsgGeometry
Source§fn in_vacuum(&self, pos: [f64; 3]) -> bool
fn in_vacuum(&self, pos: [f64; 3]) -> bool
A point on the surface of a solid is not in vacuum, whichever of the
eight diagonal offsets (the one of Geometry::locate and its mirror
images) would put it outside.
Source§fn n_materials(&self) -> usize
fn n_materials(&self) -> usize
Number of distinct materials.
Source§fn material_index(&self, region: usize) -> usize
fn material_index(&self, region: usize) -> usize
Index of the material filling
region.Source§fn locate(&self, pos: [f64; 3]) -> Option<usize>
fn locate(&self, pos: [f64; 3]) -> Option<usize>
The region containing
pos, or None outside the target (or for a
non-finite position). Ownership of shared faces: see the module docs.Source§fn entry_point(&self) -> [f64; 3]
fn entry_point(&self) -> [f64; 3]
Source§fn exit(
&self,
region: usize,
pos: [f64; 3],
dir: [f64; 3],
limit: f64,
) -> Option<Exit>
fn exit( &self, region: usize, pos: [f64; 3], dir: [f64; 3], limit: f64, ) -> Option<Exit>
The first event along the straight flight from
pos (inside region,
or on one of its faces) in the unit direction dir, if it happens at
a path length of at most limit; otherwise None. The event is a
change of material, a periodic wrap, or leaving the target. Read moreSource§fn flight(
&self,
region: usize,
pos: [f64; 3],
dir: [f64; 3],
limit: f64,
) -> Flight
fn flight( &self, region: usize, pos: [f64; 3], dir: [f64; 3], limit: f64, ) -> Flight
Geometry::exit, also reporting the region the flight ends in when
there is no event, so a transport engine can keep its particle’s
region consistent with its position after crossing same-material
faces. The default suits a geometry whose regions are each a whole
material run along every flight (a Stack, where leaving a layer is
always an event): without an event the region is unchanged.Source§impl PartialEq for CsgGeometry
impl PartialEq for CsgGeometry
impl StructuralPartialEq for CsgGeometry
Auto Trait Implementations§
impl Freeze for CsgGeometry
impl RefUnwindSafe for CsgGeometry
impl Send for CsgGeometry
impl Sync for CsgGeometry
impl Unpin for CsgGeometry
impl UnsafeUnpin for CsgGeometry
impl UnwindSafe for CsgGeometry
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
Converts
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> ⓘ
Converts
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