-
-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
If you clone and run this repo and it reports the result is not a manifold:
wink@fwlaptop 25-03-23T22:52:15.392Z:~
$ git clone https://github.com/winksaville/cube-with-tube-not-a-manifold
Cloning into 'cube-with-tube-not-a-manifold'...
remote: Enumerating objects: 12, done.
remote: Counting objects: 100% (12/12), done.
remote: Compressing objects: 100% (10/10), done.
remote: Total 12 (delta 0), reused 12 (delta 0), pack-reused 0 (from 0)
Receiving objects: 100% (12/12), 120.65 KiB | 870.00 KiB/s, done.
wink@fwlaptop 25-03-23T22:52:29.367Z:~
$ cd cube-with-tube-not-a-manifold/
wink@fwlaptop 25-03-23T22:52:38.826Z:~/cube-with-tube-not-a-manifold (main)
$ cargo run
Compiling autocfg v1.4.0
Compiling libm v0.2.11
Compiling proc-macro2 v1.0.94
..
Compiling geo-buf v0.1.0
Compiling rapier3d-f64 v0.23.1
Compiling csgrs v0.16.0
Compiling cube-with-tube-not-a-manifold v0.1.0 (/home/wink/cube-with-tube-not-a-manifold)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 22.09s
Running `target/debug/cube-with-tube-not-a-manifold`
The cube_with_tube is not a manifold
wink@fwlaptop 25-03-23T22:53:04.776Z:~/cube-with-tube-not-a-manifold (main)
There is the source code:
wink@fwlaptop 25-03-23T22:53:04.776Z:~/cube-with-tube-not-a-manifold (main)
$ cat -n src/main.rs
1 use csgrs::csg::CSG;
2
3 fn main() {
4 let len_side: f64 = 10.0;
5 let tube_diameter: f64= 4.0;
6 let segments: i32 = 4;
7
8 // Create the cube
9 let cube: CSG<f64> = CSG::cube(len_side, len_side, len_side, None);
10
11 // Create the tube and remove the material it's from the cube
12 let tube_radius = tube_diameter / 2.0;
13 let tube = CSG::cylinder(tube_radius, len_side, segments as usize, None);
14 let tube = tube.translate(len_side / 2.0, len_side / 2.0, 0.0);
15
16 let cube_with_tube = cube.difference(&tube);
17
18 if !cube_with_tube.is_manifold() {
19 println!("The cube_with_tube is not a manifold");
20 }
21
22 // Write the result as an ASCII STL:
23 let name = format!(
24 "cube_with_tube.len_side-{:0.3}_tube_diameter-{:0.3}_segments-{}",
25 len_side, tube_diameter, segments
26 );
27
28 let stl = cube_with_tube.to_stl_ascii(&name);
29 std::fs::write(name.to_owned() + ".stl", stl).unwrap();
30 }
wink@fwlaptop 25-03-23T22:54:31.606Z:~/cube-with-tube-not-a-manifold (main)
Metadata
Metadata
Assignees
Labels
No labels