|
|
Hello again,
I wrote my macro for splines to be created from set of points given in array. It
works almost perfectly, but my idea is to have a curve following exactly my
points. I know splines work this way, but when I want a curve that is straight
initialy and turns to the right after some length I get a little left bend and
next expected right bend. Is it possible to create needed smooth (it means no
linear and quadratic splines can be used) curve?
Below is my implementation:
#macro createSpline(arr, stype, displacement, middlePoint)
#local arrSize = dimension_size(arr,1);
#local length = 0;
#local i = 0;
#while(i < arrSize - 1)
#local length = length + vlength(arr[i+1] - arr[i]);
#local i = i + 1;
#end
#local overallLength = length;
#local length = 0;
#local i = 0;
spline {
#switch (stype)
#case (linear_spline_id) linear_spline #break
#case (quadratic_spline_id) quadratic_spline #break
#case (cubic_spline_id) cubic_spline #break
#case (natural_spline_id) natural_spline #break
#end
0.00, arr[1] + displacement,
#while(i < arrSize - 1)
#local length = length + vlength(arr[i+1] - arr[i]);
#if(arr[i+1].y < 0)
#declare middlePoint = length/overallLength;
#end
coef*length/overallLength, arr[i+1] + displacement,
#local i = i + 1;
#end
1.00, arr[arrSize - 1] + displacement
}
#end
I thought that using variable "coef" a little bit lower than 1 will solve the
problem but I was wrong? Any idea?
twister
Post a reply to this message
|
|