pub struct HPGSampler<'a> {
pub item: &'a Item,
pub cell_samplers: Vec<UniformAARectSampler>,
pub cost_bound: LBFPlacingCost,
pub pretransform: Transformation,
pub coverage_area: fsize,
pub bin_bbox_area: fsize,
pub n_samples: usize,
}
Expand description
Creates Transformation
samples for a given item.
Samples from the Hazard Proximity Grid uniformly, but only cells which could accommodate the item.
Cells were a collision is guaranteed are discarded.
Fields§
§item: &'a Item
§cell_samplers: Vec<UniformAARectSampler>
§cost_bound: LBFPlacingCost
§pretransform: Transformation
§coverage_area: fsize
§bin_bbox_area: fsize
§n_samples: usize
Implementations§
Source§impl<'a> HPGSampler<'a>
impl<'a> HPGSampler<'a>
pub fn new(item: &'a Item, layout: &Layout) -> Option<HPGSampler<'a>>
Sourcepub fn sample(&mut self, rng: &mut impl Rng) -> Transformation
pub fn sample(&mut self, rng: &mut impl Rng) -> Transformation
Samples a Transformation
Sourcepub fn tighten(&mut self, best: LBFPlacingCost)
pub fn tighten(&mut self, best: LBFPlacingCost)
Removes all cells that cannot possibly generate a Transformation
which would be better than the current best solution.
LBF specific
Auto Trait Implementations§
impl<'a> Freeze for HPGSampler<'a>
impl<'a> RefUnwindSafe for HPGSampler<'a>
impl<'a> Send for HPGSampler<'a>
impl<'a> Sync for HPGSampler<'a>
impl<'a> Unpin for HPGSampler<'a>
impl<'a> UnwindSafe for HPGSampler<'a>
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
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