Graphics Reference
In-Depth Information
1.6.2 Method 2
Method 2 generates an arc in a slightly different way. It uses the information of
the intercept along the horizontal or vertical line to extract the vertices of the
Bezier characteristic triangles. Coordinates of the end point of the intercept
may be computed using the following simple approach.
Consider ( x 1 ,y 1 ) and ( x 2 ,y 2 ) to be the initial and final points of an arc
as shown in Figure 1.11. Let us now imagine a set of mutually perpendicular
reference axes placed at the point ( x 1 ,y 1 ). Also, let h be the value of the
intercept and ( X ,Y ) be the coordinate of the end point of the intercept.
Y
P
P
4
P
(x ,y )
22
3
2
II
I
(x, y )
h
X
X
P (x ,y )
111
IV
III
Y /
Fig. 1.11. Detection of Bezier characteristic triangles for Method 2.
Since an arc may lie either in the left (clockwise) or in the right (counter-
clockwise) side of the line joining ( x 1 ,y 1 ) and ( x 2 ,y 2 ), X
and Y
may have
the values
X
Y = y 1 + hor,
= x 1
X = x 1 + h Y = y 1
corresponding to the two possible senses of the arc in quadrant I where x 2 >
x 1 and y 2 >y 1 .
Similarly, for the other quadrants, where x 2 <x 1 and y 2 >y 1 (quadrant
II), x 2 <x 1 and y 2 <y 1 (quadrant III), and x 2 >x 1 and y 2 <y 1 (quadrant
IV), we have
X
Y = y 1 or,
= x 1
h
X
Y = y 1 + h,
= x 1
 
Search WWH ::




Custom Search