# Bezier Plotting problem

## Main Question or Discussion Point

Hello math gurus,

I'm using Bezier curves in my Perl application to chart currency trading data.
Having no formal math training, I've framed my questions in a modeling context.
I want to step along the major axis (on integer boundaries), and calculate real
values on the minor axis. I'm plotting in relative space, like PostScript's
"rcurveto" function. The example code fragments are in (pseudo) Perl with
scalar($) and termination(;) characters removed. Control Points: x1 = 70 y1 = 0 x2 = 100 y2 = 20 3 = 100 y3 = 50 Initialize Curve: cX = (3 * x1) cY = (3 * y1) bX = ((3 * (x2 - x1)) - cX) bY = ((3 * (y2 - y1)) - cY) aX = (x3 - cX - bX) aY = (y3 - cY - bY) Plot Point: t1 = t t2 = (t1 * t1) t3 = (t1 * t2) pX = ((aX *$t3) + (bX * $t2) + ($cX * t1))
pY = ((aY * $t3) + (bY *$t2) + ($cY * t1)) Octant Change: T: 0.65429213786 X: 88.830577627 Y: 22.884879224 Octant 0 Point: T: 0.28268189551 X: 50.000000000 Y: 4.568654814 Octant 1 Point: T: 0.88425060334 X: 98.778678931 Y: 40.000000000 In Octant 0, I want to use X integers (0 to 88) to find t (e.g. 0.28268189551 from 50) to generate Y reals (e.g. 4.568654814 from 0.28268189551). In Octant 1, I want to use Y integers (23 to 50) to find t (e.g. 0.88425060334 from 40) to generate X reals (e.g. 98.778678931 from 0.88425060334). My three part question is: 1) Can the (aX, bX, cX, aY, bY, cY) initialization values be used in the solution, or will separate initialization values be required for X stepping and Y stepping. 2) Are the X and Y stepping solutions (that find t) similar to the structure of finding X and Y with t? Find t with x: t1 = pX ... process ... Find y with t: ((aY *$t3) + (bY * $t2) + ($cY * t1))

3) How will the solution calculate the following values from X = 50 in Octant 0
and Y = 40 in Octant 1:

T: 0.28268189551 X: 50.000000000 Y: 4.568654814

The only way I'll be able to understand a solution is if I can plug it into some
Perl code. Explanations in pseudo code or C fragments should also work.

Thanks (in advance, for anyone willing to help me with this).

Last edited: