Skip to main content

CsgGeometry

Struct CsgGeometry 

Source
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

Source

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.

Source

pub fn solid(&self, region: usize) -> &Csg

The solid of region (validated: unit cylinder axes and half-space normals).

Source

pub fn tolerance_m(&self) -> f64

The geometric tolerance of the ownership rules, m.

Source

pub fn bounds(&self) -> ([f64; 3], [f64; 3])

Axis-aligned bounds of all solids, (min, max), m.

Trait Implementations§

Source§

impl Clone for CsgGeometry

Source§

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)

Performs copy-assignment from source. Read more
Source§

impl Debug for CsgGeometry

Source§

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

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

impl Geometry for CsgGeometry

Source§

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

Number of distinct materials.
Source§

fn material(&self, index: usize) -> &Material

Material index (0..n_materials()).
Source§

fn n_regions(&self) -> usize

Number of regions.
Source§

fn material_index(&self, region: usize) -> usize

Index of the material filling region.
Source§

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]

Where a beam enters by default: the origin for a Stack, the centre of the front face for a VoxelGrid.
Source§

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 more
Source§

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§

fn as_stack(&self) -> Option<&Stack>

This geometry as a layered Stack, if it is one. Tallies defined per layer (dose, depth-dose, interface transmission) need it.
Source§

impl PartialEq for CsgGeometry

Source§

fn eq(&self, other: &CsgGeometry) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for CsgGeometry

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V