Sorta fix curve_horn_start
This commit is contained in:
parent
3eb8d12e03
commit
f4f6a7db5d
@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
## Highest priority:
|
## Highest priority:
|
||||||
|
|
||||||
- Continue converting `curve_horn_*`.
|
- Fix issue with `curve_horn_*` that prevents geometry being joined in
|
||||||
|
middle.
|
||||||
- Consider trampolining `to_mesh`. My call stack seems needlessly
|
- Consider trampolining `to_mesh`. My call stack seems needlessly
|
||||||
deep in spots. Can I make tail-recursive?
|
deep in spots. Can I make tail-recursive?
|
||||||
-
|
-
|
||||||
|
|||||||
57
src/main.rs
57
src/main.rs
@ -275,51 +275,23 @@ fn cube() -> OpenMesh {
|
|||||||
}.transform(geometry::Translation3::new(-0.5, -0.5, -0.5).to_homogeneous())
|
}.transform(geometry::Translation3::new(-0.5, -0.5, -0.5).to_homogeneous())
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
fn curve_horn_start() -> RuleStep {
|
fn curve_horn_start() -> RuleStep {
|
||||||
// Seed is a square in XY, sidelength 1, centered at (0,0,0):
|
let id = nalgebra::geometry::Transform3::identity().to_homogeneous();
|
||||||
let seed = {
|
let flip180 = nalgebra::geometry::Rotation3::from_axis_angle(
|
||||||
let m = OpenMesh {
|
&nalgebra::Vector3::y_axis(),
|
||||||
verts: vec![
|
std::f32::consts::PI).to_homogeneous();
|
||||||
vertex(0.0, 0.0, 0.0),
|
RuleStep {
|
||||||
vertex(1.0, 0.0, 0.0),
|
geom: empty_mesh(),
|
||||||
vertex(1.0, 1.0, 0.0),
|
final_geom: empty_mesh(),
|
||||||
vertex(0.0, 1.0, 0.0),
|
children: vec![
|
||||||
],
|
(Rule::Recurse(curve_horn_thing_rule), id),
|
||||||
faces: vec![
|
(Rule::Recurse(curve_horn_thing_rule), flip180),
|
||||||
0, 1, 2,
|
],
|
||||||
0, 2, 3,
|
}
|
||||||
],
|
// TODO: This has duplicate geometry in the middle because four
|
||||||
idxs_entrance: vec![0],
|
// vertices of each start point never technically connect.
|
||||||
idxs_exit: vec![0],
|
|
||||||
idxs_body: (0, 0),
|
|
||||||
};
|
|
||||||
let xform = nalgebra::geometry::Translation3::new(-0.5, -0.5, 0.0).to_homogeneous();
|
|
||||||
m.transform(xform)
|
|
||||||
};
|
|
||||||
vec![
|
|
||||||
// Since neither of the other two rules *start* with geometry:
|
|
||||||
RuleStep { geom: seed.clone(),
|
|
||||||
rule: Box::new(Rule::EmptyRule),
|
|
||||||
xform: nalgebra::geometry::Transform3::identity().to_homogeneous(),
|
|
||||||
},
|
|
||||||
// Recurse in both directions:
|
|
||||||
RuleStep { geom: seed.clone(),
|
|
||||||
rule: Box::new(Rule::Recurse(curve_horn_thing_rule)),
|
|
||||||
xform: nalgebra::geometry::Transform3::identity().to_homogeneous(),
|
|
||||||
},
|
|
||||||
RuleStep { geom: seed.clone(),
|
|
||||||
rule: Box::new(Rule::Recurse(curve_horn_thing_rule)),
|
|
||||||
xform: nalgebra::geometry::Rotation3::from_axis_angle(
|
|
||||||
&nalgebra::Vector3::y_axis(),
|
|
||||||
std::f32::consts::FRAC_PI_2).to_homogeneous(),
|
|
||||||
},
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//use std::convert::TryFrom;
|
|
||||||
*/
|
|
||||||
|
|
||||||
fn curve_horn_thing_rule() -> RuleStep {
|
fn curve_horn_thing_rule() -> RuleStep {
|
||||||
|
|
||||||
let y = &Vector3::y_axis();
|
let y = &Vector3::y_axis();
|
||||||
@ -442,4 +414,5 @@ fn main() {
|
|||||||
|
|
||||||
run_test(Rule::Recurse(cube_thing_rule), 3, "cube_thing");
|
run_test(Rule::Recurse(cube_thing_rule), 3, "cube_thing");
|
||||||
run_test(Rule::Recurse(curve_horn_thing_rule), 100, "curve_horn_thing");
|
run_test(Rule::Recurse(curve_horn_thing_rule), 100, "curve_horn_thing");
|
||||||
|
run_test(Rule::Recurse(curve_horn_start), 100, "curve_horn2");
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user