The formula system is based on a loop which calls the formula over and over again to create a single element.
The loop is based on the value T which runs from 0 to 1.
To help understand the loop concept, let's do a small example.
T = 0
Loop_Start:
T = T + 0.1
End_Loop When T = 1
Results Would Be:
First Time: T = 0
Second Time: T = 0.1
Third Time: T = 0.2
Fourth Time: T = 0.3
Fifth Time: T = 0.4
Sixth Time: T = 0.5
Seventh Time: T = 0.6
Eighth Time: T = 0.7
Ninth Time: T = 0.8
Tenth Time: T = 0.9
Eleventh Time: T = 1
|
Once T is equal to 1, the looping stops.
The formula system is based on this type of a T loop.
The value of T is increased, then the entire formula is calculated.
This happens over and over again until the value of T is equal to 1.
The amount that T increases is determined by the value of Divisions.
In the example above, the number of Divisions would have been 10.
The way the increase is calculated is 1 / Divisions.
From the example, 1 / 10 = 0.1 so the amount to increase T each time through the loop is 0.1.
In the formula parser, the amount to increase is generally a lot smaller.
By default, divisions is set to 128.
The formula parser will add 1 to that, in order to have an odd number.
The reason for an odd number of divisions is so that an exact center can be found.
So if we use the formula: increase = 1 / divisions, we have a default increase of 0.007752.
The reason that we only go from 0 to 1 with T is so that T will act as a percentage.
For example, if I want to find half of 10 I would do: half = 10 * 0.5, which is equal to 5.
But the great part about this, is that no matter what number I want half of, this always works.
So half = 20 * 0.5 is half of 20, or 10.
Since T acts as a percentage, if I used 10 divisions, 100 or even 1000 divisions... at the half-way point, T will always equal 0.5.
So the calculation: half = 10 * 0.5 will always be the same regardless of how many divisions there are.
This is why a formula can be plotted with different division settings and the end element will still look relatively the same.
The main differnece is the number of plot-points (the purple spheres) there are.
Which brings us to what the plot-points actually are.
The plot-points are the exact positions created by the formula system.
These points are the exact, mathematical representation of the formula.
After these points are created, beziers are created to "fit" the plot-points.
So all the formula system really does, is generate those purple spheres.
Beizers are then fit into place with these plot-points as the guide-lines.
There are a couple things that can cause a beizer to not follow the plot-points as closely as you may like.
The first being that there are simply too few plot-points.
If there are large gaps between the plot-points, you should increase the number of divisions and re-plot the formula.
The second could be the precision.
The precision determines how far away from the plot-points the bezier is allowed to go.
Lower precision values will make the bezier fit into the plot-points more precisely.
So why not just use precision = 0 to make the bezier fit perfectly every time?
Simply because, beziers are not perfect.
The only way beziers would be able to perfectly fit the plot-points would be to create a beizer for every plot-point.
This would be extremely bad for NoLimits because you'd have an element with hundreds of very tiny segments in it.
Usually a precision of 0.01 is a good enough fit, but if you find that is just not doing it you can decrease the precision to 0.001.
It is not recommended to go below 0.0001 and it is absolutely not recommended to set precision to 0 (many bad things can happen).
So how do we get our calculation into those plot-points?
The simple answer is to assign the results of our calculations to the X, Y and Z variables.
To see this in action, let's do a simple example:
From that example, we can see that Y and Z will always be 0.
So let's ignore them for now and look at X.
Notice the calculation there, T * 10.
Since T acts as a percentage it is like saying, "T = 0 or 0 percent of 10 is 0" or further in the loop, "T = 0.5 or 50 percent of 10 is 5", and at the end, "T = 1 or 100 percent of 10 is 10".
So if divisions was equal to 10.
The result of this formula would be a series of 11 points where X is: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 and 10.
|