Bézier ActionScript

The question was asked: 6 years 11 months ago   views: 29

The essence of the problem is how to cut the rectangle corner. specifically: there are 3 points between which you need to "draw" Bezier curve of second order.

But, actually, visualize is not necessary. You only need to get the coordinates of several points, or at least one, the one that lies in the middle of a bézier curve.

Work for AS3 (Flex). Problems in order to draw this curve, not at all. But I don't know how to get the point.

If you can, would be very grateful for the working code but will not give up on links, something to read.

Notice that to study this material to the extent that to write a function myself from beginning to end, I will not, because I need it only in 1 place.

Not asking anyone to write this function for me (unless, of course, no desire), because I understand that it is not your concern; but if someone solved similar problem and wrote/found some code on this subject, then please put...

Thanks in advance!

Incomprehensible task. Abstract there are three points which need to hold a smooth curve? Or is there a rectangle and need to find some three - point meet what conditions? - Sergiks Sergiks 21-06-2012 в 14:46:01
you need to find the coordinates of at least one point lying in the middle of a bézier curve... - Vladyslav Matviienko Vladyslav Matviienko 21-06-2012 в 14:49:37
What is this? 4 points: two control, two control? - Sergiks Sergiks 21-06-2012 в 14:58:56
read carefully! "there are 3 points between which you need to "draw" Bezier curve of the second order." - Vladyslav Matviienko Vladyslav Matviienko 21-06-2012 в 15:11:27
On Wikipedia quite lucidly described. - sercxjo sercxjo 21-06-2012 в 16:54:24

Answers   1


For working with curves I use this library: https://code.google.com/p/bezier/

The code I took from example No. 6, it is inside the examples project, it is unlikely that he will work immediately, but should give an understanding as to the points on the curve:

var start:Point = new Point(100,300); // starting point
var control:Point = new Point(300, 300); // control point, something to aim for curvature
var end:Point(700, 500); // end

var bezier:Bezier = new Bezier(start, control, end); // build the model curve without representation

var position:Point = bezier.getPoint(0.5); // get the coordinates of a point on the middle curve
// if you need a quarter of that 0.25, the beginning 0, the last point 1
Answered: ShockWave ShockWave 21-06-2012 в 15:02:59
in, exactly what I was looking for!(if you earn, of course)) ) Thank you! - Vladyslav Matviienko Vladyslav Matviienko 21-06-2012 в 15:10:40
To Your Health! :) - ShockWave ShockWave 21-06-2012 в 15:19:52