@@ -264,13 +264,25 @@ public void GrowStage1() {
264264
265265 // ! phase 1-4: base phase, always needed
266266 var totalBranchLayer = 2 * auxPhaseS1 - 1 ;
267- var verAngleIncrement = Utils . ToRadian ( mAngleMain ) / ( totalBranchLayer + 1 ) ;
268- curDir . Rotate ( verAngleIncrement , mPln . XAxis ) ;
267+
268+ // Calculate the total angle in radians
269+ var totalAngleRad = Utils . ToRadian ( mAngleMain ) ;
270+
271+ // Use a base angle ratio that ensures bottom branches also fold significantly
272+ // When angleMain is at max (90), bottom branches should start at ~30-40% of the way
273+ var baseAngleRatio = 0.35 ; // Bottom layer starts at 35% of total angle
274+ var baseAngle = totalAngleRad * baseAngleRatio ;
275+
276+ // Initial rotation for the first (bottom) layer
277+ curDir . Rotate ( baseAngle , mPln . XAxis ) ;
269278
270279 // Calculate branch length
271280 double branchLenIncrement = ( mMaxSideBranchLen - mMinSideBranchLen ) / mStage1 ;
272281 var bottomBranchLen = mMinSideBranchLen + ( auxPhaseS1 * branchLenIncrement ) ;
273282
283+ // Track current layer for gradual angle calculation
284+ int layerCount = 0 ;
285+
274286 // Calculate branch position on the trunk
275287 for ( int segIdx = 0 ; segIdx < auxPhaseS1 ; segIdx ++ ) {
276288 foreach ( double posRatio in branchPositions ) {
@@ -299,9 +311,25 @@ public void GrowStage1() {
299311
300312 AddNodeToTree ( mBaseNode , node ) ;
301313 }
302- // for the next layer, rotate vertically as the layers goes up
303- var verRotAxis = Vector3d . CrossProduct ( curDir , mPln . ZAxis ) ;
304- curDir . Rotate ( verAngleIncrement , verRotAxis ) ;
314+
315+ // Calculate gradual angle increment for the next layer
316+ // Use quadratic easing: layers higher up get progressively larger increments
317+ // This distributes the remaining angle (1 - baseAngleRatio) across layers
318+ layerCount ++ ;
319+ if ( layerCount < totalBranchLayer ) {
320+ // Remaining angle to distribute
321+ var remainingAngle = totalAngleRad * ( 1.0 - baseAngleRatio ) ;
322+
323+ // Use quadratic progression: increment grows as we go up
324+ // Sum of (1 + 2 + ... + n) = n*(n+1)/2, so normalize by this
325+ double sumOfWeights = totalBranchLayer * ( totalBranchLayer + 1 ) / 2.0 ;
326+ double currentWeight = layerCount + 1 ; // Weight increases with layer
327+ double verAngleIncrement = remainingAngle * currentWeight / sumOfWeights ;
328+
329+ // Rotate vertically for the next layer
330+ var verRotAxis = Vector3d . CrossProduct ( curDir , mPln . ZAxis ) ;
331+ curDir . Rotate ( verAngleIncrement , verRotAxis ) ;
332+ }
305333
306334 // also rotate the starting position so that two layers don't overlap
307335 if ( mBranchRot ) {
0 commit comments