I am enhancing the Flexpainter to use local and global polyline definitions.
Excluding global bulging for the moment:
It is globally pritty the same as for splines.
Code: Select all
// With a empty collector array created in the parent function
var this.collector = [];
// The orthogonal casting function collects data
// With a global polyline datastring number
var nodStringN = 0;
...
setting nodStringN = 0 ......N
...
// With a castVector from a castPoint and a castAngle
var castVector = new RVector(castPoint.x - Math.sin(castAngle) * scaleOffset,
castPoint.y + Math.cos(castAngle) * scaleOffset);
...
case "Nods": // Push to global polys
// # Issue # Again, forgot why not push versus add past end ??? Array thing ...
if (this.collector.length == nodStringN) {
// Start a new node-string collector with this as first vertex
this.collector[this.collector.length] = [castVector];
}
else { // Add vertex to existing node-string collector
this.collector[nodStringN][this.collector[nodStringN].length] = castVector;
}
break;
....
Code: Select all
...
// Cast global polys if any, open/closed on open/closed Forms
// this.collector is an array with 0...N arrays of RVector's
var jpn = this.collector.length;
for (var jp=0; jp<jpn; jp++) { // Cycle through all global polys
addPolyline(this.collector[jp], this.isTanCloObj, false);
}
Code: Select all
// we have our collector again:
// A function wide array this time:
var collector = [];
// We push an array with a vector, bulge and let relative be default:
collector.push([castVector , bulge]); >> casting addPolyline(collector) No go
// Lets push a new array
collector.push(new Array(castVector , bulge)); >> casting addPolyline(collector) No go
// Lets try adding it as beyond last
collector[collector.length] = [castVector , bulge]; >> casting addPolyline(collector) No go
collector[collector.length] = new Array(castVector , bulge); >> casting addPolyline(collector) No go
// Lets add round brackets
collector[collector.length] = ([castVector , bulge]); >> casting addPolyline(collector) No go
// The castVector is composed out two parts
collector[collector.length] = ([castVector.x , castVector.y , bulge]); >> Correct casting
EUREKA
I was able to trace this back to:
simple_create.js:
Line 236 catches RVector by looking at the start of the arguments.
if so it sets v0 to the first element.
Skipping the next 3 if else and ends up at line 278,
appending a vertex (v,b)
What is: ([firts element],0.0)
What is: (Rvector,bulge,0.0)
What are too many arguments.
Besides that the actual bulge is omitted working with RVector's.
My workaround is re-splitting the castVector.
Regards,
CVH