feat(branch): phyllotactic spiral and upward angle
Default rotation to the golden angle (137.5°) so successive branches spiral naturally around the stem. Add an `angle` input (-90..90°) that tilts branches between horizontal and along-stem before rotating around the stem axis. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -83,6 +83,14 @@
|
||||
"min": 0,
|
||||
"max": 360,
|
||||
"step": 0.01,
|
||||
"value": 137.5
|
||||
},
|
||||
"angle": {
|
||||
"type": "float",
|
||||
"description": "Upward tilt of branches. 0 = horizontal, positive = upward, negative = drooping.",
|
||||
"min": -90,
|
||||
"max": 90,
|
||||
"step": 1,
|
||||
"value": 0
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,7 +78,9 @@ pub fn execute(input: &[i32]) -> Vec<i32> {
|
||||
continue;
|
||||
}
|
||||
|
||||
let branch_direction = rotate_vector_by_angle(orthogonal, direction, rotation_angle);
|
||||
let up_angle = evaluate_float(args[10]) * PI / 180.0;
|
||||
let tilted = (orthogonal * up_angle.cos() + direction * up_angle.sin()).normalize();
|
||||
let branch_direction = rotate_vector_by_angle(tilted, direction, rotation_angle);
|
||||
|
||||
log!(
|
||||
"BRANCH depth: {}, branch_origin: {:?}, direction_at: {:?}, branch_direction: {:?}",
|
||||
|
||||
Reference in New Issue
Block a user