Reputation: 19881
I am drawing 2 lines:
Here is the image from the two lines:
The upper left is, of course (0,0). The line on the left appears to be drawn correctly. What is happening on the sencond line?
Here is my formula for converting the degrees and length to end points:
var radians:Number = angle * Math.PI / 180;
_x2 = Math.cos(radians) * length;
_y2 = Math.sin(radians) * length;
Upvotes: 1
Views: 64
Reputation: 24280
Both lines are wrong, the formulas for both endpoints should be:
_x2 = x + Math.cos(radians) * length;
_y2 = y + Math.sin(radians) * length;
Upvotes: 4