This article will briefly demonstrate an implementation of the point cloud feature within the simulation macros of Flowcode.
A point cloud is a set boundary within which points can be set at X Y and Z co-ordinates. Within this example, instead of points, lines between points are created.
A Taurus, is a circle that is rotated and moved about 2 axis’. A brief description of the operation is that a circle of fixed points, is rotated on the Z axis. The points dictate where the lines in the Taurus shown are drawn. This circle is then spun around an axis (the centre of the point cloud) as the circle is slowly spun to face the angle of velocity. Therefore, varying the size of the circle varies the bulkiness of the Taurus, and increasing the axis, increases its width.
Variables used are shown above.
PI = The constant pi
Points = the number of points to be made within the cloud
Rounds = the number of rotated points about the face of the circle to create the Taurus
XSz = the size of the point cloud (X-coord)
YSz = the size of the point cloud (Y-coord)
The Flowcode begins by initialising all these constant and variables and creating the point cloud from a pre-existing shape (shape1). The mode of operation for the points to be set within the cloud, are set to points.
A loop is then started to loop through all points in the cloud with loop variable ix.
What is then resulting is an array of floating point locations for points to create a Taurus indexed in groups of 3 for the 3 co-ordinates in a 1 dimensional array. This is achieved with striping of data throughout the xyz array.
Within the next 3 component calls, the X Y and Z co-ordinates are set in the point cloud. The call for Panel.PCloud.UnitScale will accept an array and index the striped data from the xyz array.
So, for example, the Y co-ordinate:
- The data is striped for a particular axis in 3 element intervals. This is the value of ArrayStep.
- The initial data point is element number 1 within the array. This is the value of Offset.
- The number of elements in the array is already defined as a constant, and passed to the elements argument.
- A further offsetting of values stored within the array are available to define, but in this case, we do not need to position the resulting pointcloud.
Next the point cloud configuration is set to display lines between resulting points.
The point cloud is then plotted to a specified size in the .SetGrid macro, and the colours array is applied to the resulting set of points which has been indexed in the same way.
The point cloud feature is used heavily within the gLCD components. In the coming 3 weeks, I will cover the point cloud in more depth and create a graphing component to plot data about 2 axis’.
Click here for the Flowcode files for this example: Taurus – PointCloud
13,785 total views, 2 views today