|
Math::Bezier::Convert - Convert cubic and quadratic bezier each other. |
Math::Bezier::Convert - Convert cubic and quadratic bezier each other.
use Math::Bezier::Convert;
@new_cubic = divide_cubic($cx1, $cy1, $cx2, $cy2, $cx3, $cy3, $cx4, $cy4, $t); @new_quad = divide_quadratic($cx1, $cy1, $cx2, $cy2, $cx3, $cy3, $t); @quad = cubic_to_quadratic(@cubic); @cubic = quadratic_to_cubic(@quad); @lines = cubic_to_lines(@cubic); @lines = quadratic_to_lines(@cubic);
Math::Bezier::Convert provides functions to convert quadratic bezier to cubic, to approximate cubic bezier to quadratic, and to approximate cubic and quadratic bezier to polyline.
Each function takes an array of the coordinates of control points of the bezier curve. Cubic bezier consists of one ANCHOR control point, two DIRECTOR control points, one ANCHOR, two DIRECTORS, ... and the last ANCHOR. Quadratic bezier consists of one ANCHOR, one DIRECTOR, ... and the last ANCHOR. The curve pass over the ANCHOR point, but dose not the DIRECTOR point. Each point consists of X and Y coordinates. Both are flatly listed in the array of the curve, like ($x1, $y1, $x2, $y2, ...).
None by default. All functions described above are exported when ':all' tag is specified. All global variables are not exported in any case.
Copyright 2000 Yasuhiro Sasama (ySas), <ysas@nmt.ne.jp>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl(1).
|
Math::Bezier::Convert - Convert cubic and quadratic bezier each other. |