kaigouthro

Branch Curve

Library "branch"

Generates a branch made of segments with a starting angle
and a turning angle for each segment. The branch is generated from a starting point
and a number of nodes to generate. The length of each segment and angle of each segment
can be adjusted. The branch can be generated in 2D or 3D, render as you wish.

method branch(origin, nodes, segment_length, segment_growth, angle_start, angle_turn)
  # Branch Generation.
- `origin`: CommonTypesMath.Vector3 - The starting point of the branch. If the z value is not zero, it will be used as the starting angle.
- `nodes`: int - The number of nodes to generate.
- `segment_length`: float - The length of each segment.
- `segment_growth`: float - The growth of each segment. 0 = no growth, 100 = double the length of the previous segment.
- `angle_start`: float - The starting angle of the branch in degrees.
- `angle_turn`: float - The turning angle of each segment in degrees.
  Namespace types: CommonTypesMath.Vector3
  Parameters:
    origin (Vector3 type from RicardoSantos/CommonTypesMath/1): The starting point of the branch. If the z value is not zero, it will be used as the starting angle.
    nodes (int): The number of nodes to generate.
    segment_length (float): The length of each segment.
    segment_growth (float): The growth of each segment. 0 = no growth, 100 = double the length of the previous segment.
    angle_start (float): The starting angle of the branch in degrees.
    angle_turn (float): The turning angle of each segment in degrees.
@return segments The list of segments that make up the branch.
Pine library

In true TradingView spirit, the author has published this Pine code as an open-source library so that other Pine programmers from our community can reuse it. Cheers to the author! You may use this library privately or in other open-source publications, but reuse of this code in a publication is governed by House Rules.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this library?

Copy the following line and paste it in your script.