Curved Lines and Arrows
CreatiCode last edited by creaticodeta2-mail
You already know lines are made of thin tubes in the CreatiCode playground. You can make curved lines using many small segments of tubes as well.
To add a curve, you need to take 3 steps:
- Create a new list
- Generate a list of points
- Use this list to draw a curve
Generate a List of Points for an Arc
We only need 3 points to define an arc (a portion of a ring). Therefore, you can use the following block to generate a list of points along the arc.
These 3 points define an arc in 3D space, and more points are inserted along this arc to make it smoother. Note that the “Middle Point” does not have to be exactly at the center of the arc. However, if you only specify 2 points (start and end), there can be many arcs going through them. For example, this image shows 4 arcs going through the green and blue points, each with a different middle point in yellow:
List to Store the Points
You need to select which list to use to store the points to be generated. If there is no list in the project, you need to create one first.
This number specifies the desired number of points to be added along the arc. The higher the value, the more points will be inserted, which will make the curve smoother. Note that due to some optimizations, the actual number of points generated may be less than this input value.
Add Curve Using the List of Points
After the list of points is generated, we can draw a curve along these points using the “add curve” block:
First 5 Inputs
The first 5 inputs are the same as those for adding straight lines, because they are used to control how the tube itself looks.
List of Points
The name of the list that contains the points to be used for the curve
Start and End Index of List
You do not have to use all the points in the list, instead, you can specify a starting index and an end index in the list. For example, if starting index is 1 and the end index is left empty (or the length of the list), then all points in the list will be used. However, if the starting index is 2 and the end index is 4, then only these 3 points will be used to draw the curve with.
This is the same as the solid line input, which cuts the curve into many line segments with gaps.
In this program, we add many curves, and rotate them to a different angle around the circle.