On 11/01/2015 at 17:13, xxxxxxxx wrote:
DrawBezier() is only available in R14+ (not available in R13 from the docs, anywho). It may be that reusing the p[] array is the problem. Maybe an array of 12 points (2*6) would avoid the anomaly.
Note: Due to improve speed performance, the elements of p will be modified and might be invalid and all values must be set again if DrawBezier() will be called again with the same array.
This might indicate that for a concatenated set of Bezier splines, you need to store all of them uniquely until all drawn since there are modifications to the existing elements of the array p. While this may be stating for subsequent usages, it may also apply to local usages of that array. So, for two segments, you probably want to have a contiguous array over both spline segments and draw it out once with those two segments rather than doing it in two separate calls.
Id est:
#define LEN 2 // Two Bezier curves
Float p[LEN*3*2]; // Allocates an array of 6 points
for(int i = 0; i < 3*2; i += 2)
{
p[i] = i * 10 + 100;
p[i+1] = i * 10 + 10;
}
DrawSetPen(Vector(0.8, 0.2, 0.3));
DrawBezier(100, 10, p, 1, false , false);
for(int i = 3*2; i < LEN*3*2; i += 2)
{
p[i] = i * 10 + 40;
p[i+1] = i * 10 + 10;
}
DrawSetPen(Vector(0.8, 0.2, 0.3));
DrawBezier(40, 10, p, 1, true , false);
or
#define LEN 2 // Two Bezier curves
Float p[LEN*3*2]; // Allocates an array of 6 points
for(int i = 0; i < 3*2; i += 2)
{
p[i] = i * 10 + 100;
p[i+1] = i * 10 + 10;
}
for(int i = 3*2; i < LEN*3*2; i += 2)
{
p[i] = i * 10 + 40;
p[i+1] = i * 10 + 10;
}
DrawSetPen(Vector(0.8, 0.2, 0.3));
DrawBezier(40, 10, p, 2, true , false);
But the two segments start at the same coordinate and you would need to add an offset tp the Bezier points to achieve the same results.
As always with C4D SDK, trial-and-error, test and see are the only way to find answers.
ETA: As with all C4D splines, closed or open is over the scope of the entire spline and its inclusive segments. You cannot have multiply-segmented splines that are both opened and closed at segments. It is a spline-level condition, not one that can vary at the segment level.