space-colonization
Advanced tools
Comparing version 0.1.1 to 0.2.0
@@ -20,3 +20,3 @@ const vec3 = require('pex-math/Vec3') | ||
let viewAngle = opts.viewAngle || 50 | ||
let growType = opts.growType || 'split' | ||
let straightSplit = opts.straightSplit || false | ||
let branchAngle = opts.branchAngle || 30 | ||
@@ -37,3 +37,2 @@ let viewDistance = opts.viewDistance || 0.3 | ||
viewAngle = opts.viewAngle || viewAngle | ||
growType = opts.growType || growthStep | ||
branchAngle = opts.branchAngle || branchAngle | ||
@@ -43,2 +42,3 @@ viewDistance = opts.viewDistance || viewDistance | ||
growthBias = opts.growthBias || growthBias | ||
straightSplit = opts.straightSplit || straightSplit | ||
@@ -148,4 +148,3 @@ growthDirection = vec3.normalize(growthDirection) | ||
vec3.scale(vec3.normalize(dir), growthStep) | ||
if (didSplit && growType === 'split') { | ||
// if it split and grow type is 'split' we need to rotate | ||
if (didSplit && !straightSplit) { | ||
let sinBranchAngle = Math.sin(branchAngle * (Math.PI / 180)) | ||
@@ -152,0 +151,0 @@ let cosBranchAngle = Math.cos(branchAngle * (Math.PI / 180)) |
{ | ||
"name": "space-colonization", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"description": "space colonization algorithm", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -23,2 +23,3 @@ # space-colonization | ||
* `branchAngle`: when a split happens, how far the two new branches bend away from each other. defaults to `30` (measured in degrees) | ||
* `straightSplit`: if `true`, only new branch bends to the `branchAngle`. if `false`, both old and new branches bend (i. e. you get a V-like shape) | ||
@@ -25,0 +26,0 @@ These numbers (except the angles) assume the buds and hormones have a distance between them in the same range (e.g. from 0 to 5). If you provide positions that have a range of 10-50 for example nothing will grow because the `viewDistance` is too small for the initial bud to see anything! |
42507
40
279