Added some parameters to Twist

This commit is contained in:
Chris Hodapp 2020-03-07 22:24:37 -05:00
parent 7564cf69d0
commit 7a770bb533
2 changed files with 25 additions and 13 deletions

View File

@ -2,17 +2,26 @@
## Highest priority:
- Implement some of the tougher examples from the above too, e.g. the
triple nested spiral. See `examples.py`.
- See `automata_scratch/examples.py` and implement some of the tougher
examples.
- `spiral_nested_2` & `spiral_nested_3` (how to compose
efficiently?)
- `twisty_torus`
- `ram_horn_branch` - how do I pass depth in order to do this right?
## Important but less critical:
- Elegance & succinctness:
- Why must I repeat myself so much in these definitions?
- The notation for transforms is really cumbersome. Some syntactic
sugar might go far.
- What patterns can I factor out? I do some things regularly, like:
the clockwise boundaries, the zigzag connections, the iterating over
a `Vec<Vertex>` to transform each element and make another vector.
- I have seen many of my bugs come from: all this arithmetic on
indices. I generate vertex maps more or less manually.
- Helper method to transform `Vec<Vertex>` and such. I do this
often.
- Docs on modules
- Grep for all TODOs in code, really.
- Look at everything in README.md in automata_scratch.
@ -23,3 +32,4 @@
- Look in https://www.nalgebra.org/quick_reference/# for "pour
obtain". Can I fix this somehow? Looks like a French-ism that made
its way in.
- Multithread! This looks very task-parallel anywhere that I branch.

View File

@ -301,8 +301,7 @@ struct Twist {
impl Twist {
pub fn init() -> (Twist, Rule<Twist>) {
let subdiv = 2;
pub fn init(f: f32, subdiv: usize) -> (Twist, Rule<Twist>) {
let xf = geometry::Rotation3::from_axis_angle(&Vector3::x_axis(), -0.7).to_homogeneous();
let seed = vec![
vertex(-0.5, 0.0, -0.5),
@ -313,8 +312,8 @@ impl Twist {
let seed_sub = util::subdivide_cycle(&seed, subdiv);
let t = Twist {
dx0: 2.0,
dy: 0.1,
ang: 0.1,
dy: 0.1/f,
ang: 0.1/f,
count: 4,
seed: seed,
seed_sub: seed_sub,
@ -442,5 +441,8 @@ pub fn main() {
// TODO: If I increase the above from 100 to ~150, Blender reports
// that the very tips are non-manifold. I am wondering if this is
// some sort of numerical precision issue.
run_test_iter(Twist::init(), 100, "twist2");
run_test_iter(Twist::init(1.0, 2), 100, "twist2");
// This is a stress test:
//run_test_iter(Twist::init(10.0, 16), 800, "twist2");
}