Ok, sorry for the snark, but it looks like you made a mistake when copying down offset1
, and you also didn’t mention that you changed the arguments you passed to findVector()
. (30 became 20, and 40 became 25.) If the code you posted here really produced the values posted here, then that certainly would have been the fault of fiindVector()
.
For clarity, here are the rounded values, with offset1
fixed:
this: 916.3, 325.3
other 1: 933.7, 176.3
other 2: 796.0, 235.7
opposite: 864.8, 206.0
offset1: 2.3, -19.9
offset2: -16.0, -11.9
control: -9.9, -23.0
Also, your code, with the arguments updated:
var offset1:Point = Helper.findVector(new Point(x, y), otherAngles[0], 20);
var offset2:Point = Helper.findVector(new Point(x, y), otherAngles[1], 20);
var control:Point = Helper.findVector(new Point(x, y), opposite, 25);
line.graphics.clear();
line.graphics.lineStyle(2, 0xFF000000);
line.graphics.moveTo(offset1.x, offset1.y);
line.graphics.curveTo(control.x, control.y, offset2.x, offset2.y);
line.graphics.moveTo(offset1.x, offset1.y);
Nothing else jumps out as obviously wrong in these numbers, assuming of course that the curve is meant to be so close to the origin. My guess is that you’re drawing the curve inside a Sprite
or Shape
, whose origin is at (916.3, 325.3)
, which is fine as long as you can keep track of it.
I am wondering about the second “line.graphics.moveTo(offset1.x, offset1.y);
” in your code. I doubt moveTo()
would mess up your drawings like this, but if you don’t need that call, I’d get rid of it just in case.
Other than that, the thing to do is try a simpler case and see if you get the same behavior:
var curve:Shape = new Shape();
curve.graphics.lineStyle(2, 0x000000);
curve.graphics.moveTo(2.3, -19.9);
curve.graphics.curveTo(-9.9, -23, -16, -11.9);
curve.x = 20;
curve.y = 20;
addChild(curve);