Tried out Itertools::tuple_combinations
This commit is contained in:
parent
58cda59b78
commit
43d5259af2
|
@ -7,6 +7,7 @@ name = "csg"
|
|||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"glam",
|
||||
"itertools",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -16,8 +17,23 @@ dependencies = [
|
|||
"csg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "either"
|
||||
version = "1.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07"
|
||||
|
||||
[[package]]
|
||||
name = "glam"
|
||||
version = "0.24.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "42218cb640844e3872cc3c153dc975229e080a6c4733b34709ef445610550226"
|
||||
|
||||
[[package]]
|
||||
name = "itertools"
|
||||
version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57"
|
||||
dependencies = [
|
||||
"either",
|
||||
]
|
||||
|
|
|
@ -7,3 +7,4 @@ edition = "2021"
|
|||
|
||||
[dependencies]
|
||||
glam = "0.24.1"
|
||||
itertools = "0.11.0"
|
||||
|
|
|
@ -81,7 +81,10 @@ impl Brush {
|
|||
}
|
||||
|
||||
fn calculate_raw_vertices(&mut self) {
|
||||
// Test all permutations of brush planes for intersections
|
||||
// Test all combinations of brush planes for intersections
|
||||
// I experimented with Itertools::(tuple_)combinations instead of this nested loop
|
||||
// but it was about 2x slower
|
||||
// TODO: Experiment more
|
||||
let mut intersections = vec![];
|
||||
let len = self.planes.len();
|
||||
for i in 0..(len - 2) {
|
||||
|
|
Loading…
Reference in New Issue