diff options
-rw-r--r-- | add_curve_sapling/utils.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/add_curve_sapling/utils.py b/add_curve_sapling/utils.py index acc95b4e..f17ecb8b 100644 --- a/add_curve_sapling/utils.py +++ b/add_curve_sapling/utils.py @@ -196,7 +196,7 @@ def interpStem(stem,tVals,lPar,parRad): # Loop through all the parametric values to be determined for t in tVals: if (t >= checkVal) and (t < 1.0): - scaledT = (t-checkVal)/(tVals[-1]-checkVal) + scaledT = (t - checkVal) / max(tVals[-1] - checkVal, 1e-6) length = (numPoints-1)*t#scaledT index = int(length) if scaledT == 1.0: @@ -586,13 +586,13 @@ def fabricate_stems(addsplinetobone, addstem, baseSize, branches, childP, cu, cu tempPos.rotate(rotMat) tempPos.rotate(p.quat) newPoint.handle_right = p.co + tempPos - if (storeN>= levels-1): + if (storeN >= levels): # If this is the last level before leaves then we need to generate the child points differently branchL = (length[n] + uniform(-lengthV[n], lengthV[n])) * (p.lengthPar - 0.6 * p.offset) if leaves < 0: childStems = False else: - childStems = leaves * shapeRatio(leafDist, p.offset / p.lengthPar) + childStems = leaves * shapeRatio(leafDist, p.offset / max(p.lengthPar, 1e-6)) elif n == 1: # If this is the first level of branching then upward attraction has no effect and a special formula is used to find branch length and the number of child stems vertAtt = 0.0 |