-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
125 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,23 @@ | ||
use std::sync::Arc; | ||
|
||
use crate::geometry::primitives::simple_polygon::SimplePolygon; | ||
use crate::N_QUALITIES; | ||
|
||
/// Maximum number of qualities that can be used | ||
pub const N_QUALITIES: usize = 10; | ||
|
||
/// Represents a zone of certain quality in the `Bin` | ||
#[derive(Clone, Debug)] | ||
pub struct QualityZone { | ||
/// Higher quality is better | ||
quality: usize, | ||
shapes: Vec<Arc<SimplePolygon>>, | ||
pub quality: usize, | ||
/// The outer shapes of all zones of this quality | ||
pub zones: Vec<Arc<SimplePolygon>>, | ||
} | ||
|
||
impl QualityZone { | ||
pub fn new(quality: usize, shapes: Vec<SimplePolygon>) -> Self { | ||
assert!(quality < N_QUALITIES, "Quality must be less than N_QUALITIES"); | ||
let shapes = shapes.into_iter().map(|z| Arc::new(z)).collect(); | ||
Self { quality, shapes } | ||
} | ||
pub fn quality(&self) -> usize { | ||
self.quality | ||
} | ||
|
||
pub fn shapes(&self) -> &Vec<Arc<SimplePolygon>> { | ||
&self.shapes | ||
let zones = shapes.into_iter().map(|z| Arc::new(z)).collect(); | ||
Self { quality, zones } | ||
} | ||
} |
Oops, something went wrong.