METHOD AND SYSTEM FOR APPROXIMATING CURVE, AND GRAPHIC DISPLAY CONTROL METHOD AND APPARATUS

Information

  • Patent Application
  • 20100295858
  • Publication Number
    20100295858
  • Date Filed
    April 23, 2010
    14 years ago
  • Date Published
    November 25, 2010
    13 years ago
Abstract
A method and system for approximating a curve, and a graphic display control method and apparatus are disclosed. The method for approximating a curve comprises the steps of acquiring number information of subdividing points for subdividing a curve needed to be approximated based on coordinate information of control points of the curve, acquiring coordinate information of the subdividing points based on the number information of the subdividing points and the coordinate information of the control points, and connecting the subdividing points with straight lines based on the coordinate information of the subdividing points. The invention could achieve efficient curve approximation and in turn achieve efficient graphic-display control.
Description
TECHNICAL FIELD

The invention relates to graphic processing, and particularly relates to a method and apparatus for approximating a curve and a graphic display control method and apparatus.


BACKGROUND

In computer graphics applications, rendering characters is an important branch. Two-dimensional characters are generally formed by quadratic Bezier curves, cubic Bezier curves, and elliptical curves etc., in a two-dimensional plane.


It is inefficient, for a Graphics Display Controller (GDC) chip, to render curves pixel by pixel by tracking along the curves. With appropriate precision, it is reasonable to approximate a curve with straight lines. It is a tradeoff between precision and speed. For many applications of GDC chips, speed overwhelms precision, such as car navigation, mobile phone, and amusement displayer.


Approximating a curve with straight lines needs to firstly subdivide the curve with subdividing points, then calculate coordinates of the subdividing points, and finally connect adjacent subdividing points via straight lines. It is a long existing problem to approximate a curve. There exist many solutions to approximate Bezier curves, such as direct method, recursive subdivision, forward differencing, and hybrid method. However, these methods are not fast enough.


As Bezier curves are commonly represented by polynomials of parameter t (for example, x(t)=a·t2+b·t+c, y(t)=d·t2+e·t+f for quadratic Bezier curve, where the coefficients a, b, c, d, e, and f can be calculated by control points of the quadratic Bezier curve), the coordinate values of each subdividing point can be calculated directly, given the parameter t at each subdividing point. Although this method is simple and direct, it needs too many multiplications for each subdividing point.


Recursive subdivision is a recursive procedure, to find step by step subdividing points by calculating the middle points on each edge of a control polygon. Connecting adjacent subdividing points will form straight lines. Setting an appropriate threshold of flatness, the straight lines will approximate a curve with reasonable precision. However, the recursive procedure and calculating flatness will take a large amount of time.


Forward differencing is suitable for Bezier curves. The coordinate values of a next subdividing point can be got by adding the coordinate values of a previous subdividing point with difference values. With a fixed step, the coordinate values of each subdividing point can be calculated by just several addition operations. Therefore, the speed is very high. However, the number of the subdividing points (i.e. the step) needs to be determined before calculating the coordinates.


The hybrid method combines recursive subdivision and forward differencing together. It first uses recursive subdivision and flatness to obtains the parameter of each subdividing point, and then uses forward differencing to calculate the coordinate values of each subdividing point. This method is complex for implementation.


Therefore, a method and/or apparatus for approximating a curve, used in curve rendering and more efficient than the abovementioned methods, are needed.


SUMMARY OF THE INVENTION

In view of one or more of the above problems, this invention proposes a method and apparatus for approximating a curve and a graphic-display control method and apparatus.


The method for approximating a curve according to an aspect of the invention, comprising the steps of: acquiring number information of subdividing points for subdividing a curve needed to be approximated based on coordinate information of control points of the curve; acquiring coordinate information of the subdividing points based on the number information of the subdividing points and the coordinate information of the control points; and connecting the subdividing points with straight lines based on the coordinate information of the subdividing points.


The apparatus for approximating a curve according to another aspect of the invention, comprising: a number acquiring unit configured to acquire number information of subdividing points for subdividing a curve needed to be approximated based on coordinate information of control points of the curve; a coordinate acquiring unit configured to acquire coordinate information of the subdividing points based on the number information of the subdividing points and the coordinate information of the control points; and a curve approximating unit configured to connect the subdividing points with straight lines based on the coordinate information of the subdividing points.


The graphic-display control method according to still another aspect of the invention, comprising the steps of: acquiring number information of subdividing points for subdividing a curve needed to be approximated based on coordinate information of control points of the curve; acquiring coordinate information of the subdividing points based on the number information of the subdividing points and the coordinate information of the control points; and connecting the subdividing points with straight lines based on the coordinate information of the subdividing points and drawing the straight lines connecting the subdividing points according to rendering parameters.


The graphic-display control apparatus according to still another aspect of the invention, comprising: a number acquiring unit configured to acquire number information of subdividing points for subdividing a curve needed to be approximated based on coordinate information of control points of the curve; a coordinate acquiring unit configured to acquire coordinate information of the subdividing points based on the number information of the subdividing points and the coordinate information of the control points; and a curve rendering unit configured to connect the subdividing points with straight lines based on the coordinate information of the subdividing points and draw the straight lines connecting the subdividing points according to rendering parameters.


To sum up, the invention achieves efficient curve approximation and efficient graphic-display control by acquiring the number information of the subdividing points for subdividing a curve by means of using the coordinate information of the control points of the curve, acquiring the coordinate information of the subdividing points according to the number information of the subdividing points and the coordinate information of the control points.





BRIEF DESCRIPTION OF THE DRAWINGS

The invention can be easily understood from the following description of the preferred embodiments of this invention in conjunction with the drawings, in which



FIG. 1 illustrates schematic diagrams of a quadratic Bezier curve, a cubic Bezier curve and an elliptical curve;



FIG. 2 illustrates schematic diagram of a relationship between an area difference and a subdividing step, wherein the area difference is the difference between the area of a curve segment corresponding to the subdividing step with respect to X coordinate axis and the area of a line segment of two points corresponding to the subdividing step on the curve with respect to X coordinate axis;



FIG. 3 illustrates a conceptual schematic diagram of forward differencing for approximating a Bezier curve;



FIG. 4 illustrates a schematic diagram of the procedure for affine transforming a unit circle to acquire an ellipse;



FIG. 5 illustrates a block diagram of a graphic-display control apparatus according to an embodiment of the invention;



FIG. 6 illustrates a detailed block diagram of a subdivision module shown in FIG. 5; and



FIG. 7 illustrates a detailed block diagram of a coordinate calculation module shown in FIG. 5.





DESCRIPTIONS OF THE PREFERRED EMBODIMENTS

Features in respective aspects and exemplary embodiments of the invention will be described in detail below. In the following detailed description, a number of specific details are proposed to provide thorough understanding of the invention. However, it is obvious to those skilled in the art that the invention can be implemented without some of the specific details. The following descriptions of the embodiments are merely to provide better understanding of the invention by illustrating examples of the invention. The invention is not limited to any specific configuration and algorithm mentioned below, and covers any modification, substitution and improvement of the elements, components and algorithms without departing from the spirit of the invention. In the figures and the following description, well-known structures and techniques are not disclosed to avoid unnecessarily obscuring the invention.



FIG. 1 illustrates diagrams of a quadratic Bezier curve, a cubic Bezier curve and an elliptical curve. As shown in FIG. 1, the quadratic Bezier curve 102 has three control points: P0(x0, y0), P1(x1, y1) and P2 (x2 y2); the cubic Bezier curve 104 has four control points: P0(x0, y0), P1(x1, y1), P2 (x2,y2) and P3 (x3,y3). These control points constitute a control polygon for each curve respectively. The elliptical curve 106 has a horizontal radius rh, a vertical radius rv, a starting angle θ0, a terminating angle θ1, a center point Pc(xc, yc), a rotation angle rot and a symbol indicating whether the elliptical curve rotates counterclockwise (CCW) or clockwise (CW).


The parametrical equation of the quadratic Bezier curve is






x(t)=(1−t)2x0+2t(1−t)x1+t2x2






y(t)=(1−t)2y0+2t(1−t)y1+t2y2  (1)


where 0≦t≦1. The parametrical equation of the quadratic Bezier curve can be set as another form:






x(t)=aqxt2+bqxt+cqx






y(t)=aqyt2+bqyt+cqy  (2)


where aqx=x2−2x1+x0, bqx=2(x1−x0), cqx=x0, aqy=y2−2y1+y0, bqy=2(y1−y0), and cqy=y0.


The parametrical equation of the cubic Bezier curve is






x(t)=(1−t)3x0+3t(1−t)2x1+3t2(1−t)x2+t3x3






y(t)=(1−t)3y0+3t(1−t)2y1+3t2(1−t)y2+t3y3  (3)


where 0≦t≦1. The parametrical equations of the cubic Bezier curve can also be set as another form:






x(t)=acxt3+bcxt2+ccxt+dcx






y(t)=acyt3+bcyt2+ccyt+dcy  (4)


wherein acx=x3−3x2+3x1−x0, bcx=3x2−6x1+3x0, ccx=3x1−3x0, dcx=x0, acy=y3−3y2+3y1−y0, bcy=3y2−6y1+3y0, ccy,=3y1−3y0 and dcy=y0.


The parametrical equation of the elliptical curve is











[



x




y




1



]

=


[




rh
·

cos


(
rot
)







-
rv

·

sin


(
rot
)






x
c






rh
·

sin


(
rot
)






rv
·

cos


(
rot
)






y
c





0


0


1



]



[




cos





θ






sin





θ





1



]



,




(
5
)







where θ is the parameter of any point on the elliptical curve, and rot is the rotation angle of the elliptical curve relative to the coordinate system. The elliptical curve can be regarded as a result of affine transforming a unit circle (cos θ, sin θ).



FIG. 2 illustrates a schematic diagram of a relationship between an area difference and a subdividing step, wherein the area difference is the difference between the area of a curve segment corresponding to the subdividing step with respect to X coordinate axis and the area of a line segment of two points corresponding to the subdividing step on the curve with respect to X coordinate axis.


The area difference ΔA between the area of a curve segment corresponding to a subdividing step Δt with respect to X coordinate axis and the area of a line segment between two points corresponding to the subdividing step on the curve with respect to X coordinate axis can be obtained by the following expression:





ΔA=A−Aa,  (6)


where A is the area of the curve segment corresponding to Δt with respect to X coordinate axis, and Aa is the area of the line segment between two end points on the curve segment with respect to X coordinate axis.


If the curve segment is part of the quadratic Bezier curve, then there exist the following equations












A
=





t

t
+

Δ





t






y


(
t
)










x


(
t
)











=





t

t
+

Δ





t






(



a
qy



t
2


+


b
qy


t

+

c
qy


)



(


2


a
qx


t

+

b
qx


)




t









=







a
qx



a
qy


2


Δ






t
4


+


(


2


a
qx



a
qy


t

+




a
qy



b
qx


+

2


a
qx



b
qy



3


)


Δ






t
3


+












(





3


a
qx



a
qy



t
2


+








(



a
qy



b
qx


+

2


a
qx



b
qy



)


t

+









b
qx



b
qy


+

2


a
qx



c
qy



2




)


Δ






t
2


+




(





2


a
qx



a
qy



t
3


+








(



a
qy



b
qx


+

2


a
qx



b
qy



)



t
2


+








(



b
qx



b
qy


+

2


a
qx



c
qy



)


t

+







b
qx



c
qy





)


Δ





t









(
7
)





and














A
a

=





(


y


(
t
)


+

y
(





t
+

Δ





t


)


)

·

(


x
(





t
+

Δ





t


)

-

x


(
t
)



)


2







=




1
2




(






a
qy



t
2


+


b
qy


t

+

c
qy

+



a
qy

(





t
+

Δ





t


)

2

+








b
qy

(





t
+

Δ





t


)

+

c
qy





)

·











(



a
qx



(


Δ






t
2


+

2


t
·
Δ






t


)


+


b
qx


Δ





t


)







=







a
qx



a
qy


2


Δ






t
4


+


(


2


a
qx



a
qy


t

+




a
qy



b
qx


+


a
qx



b
qy



2


)


Δ






t
3


+












(





3


a
qx



a
qy



t
2


+








(



a
qy



b
qx


+

2


a
qx



b
qy



)


t

+









b
qx



b
qy


+

2


a
qx



c
qy



2




)


Δ






t
2


+


(





2


a
qx



a
qy



t
3


+








(



a
qy



b
qx


+

2


a
qx



b
qy



)



t
2


+








(



b
qx



b
qy


+

2


a
qx



c
qy



)


t

+







b
qx



c
qy





)


Δ





t









(
8
)







Therefore, the area difference between the area of the curve segment corresponding to Δt with respect to X coordinate axis and the area of the line segment between the two points on the curve segment corresponding to the subdividing step with respect to X coordinate axis is













Δ





A

=

A
-

A
a








=


(





a
qy



b
qx


+

2


a
qx



b
qy



3

-




a
qy



b
qx


+


a
qx



b
qy



2


)


Δ






t
3








=





a
qx



b
qy


-


a
qy



b
qx



6


Δ






t
3








=


Q
·
Δ







t
3









(
9
)







As can be seen from the above expression, the area difference has no relationship with the parameter t, but with Δt. If ΔA is set to a threshold T, (5 pixels, for example), Δt can be obtained by the following expression:










Δ





t

=



T
Q

3

.





(
10
)







If the curve segment is part of the cubic Bezier curve, then there exist the following equations:












A
=





t

t
+

Δ





t






y


(
t
)










x


(
t
)











=





t

t
+

Δ





t






(



a
cy



t
3


+


b
cy



t
2


+


c
cy


t

+

d
cy


)



(


3


a
cx



t
2


+

2


b
cx


t

+

c
cx


)




t









=







a
cx



a
cy


2


Δ






t
6


+


(


3


a
cx



a
cy


t

+



3


a
cx



b
cy


+

2


a
cy



b
cx



5


)


Δ






t
5


+












(




15


a
cx



a
cy


2



t
2


+


(





2


a
cy



b
cx


+






3


a
cx



b
cy





)


t

+

(







a
cy



c
cx


+







2


b
cx



b
cy


+






3


a
cx



c
cy





4

)


)


Δ






t
4


+












(





10


a
cx



a
cy



t
3


+


(





4


a
cy



b
cx


+






6


a
cx



b
cy





)



t
2


+


(






a
cy



c
cx


+







2


b
cx



b
cy


+






3


a
cx



c
cy





)


t

+









b
cy



c
cx


+

2


b
cx



c
cy


+

3


a
cx



d
cy



3




)


Δ






t
3


+












(







15


a
cx



a
cy


2



t
4


+


(





4


a
cy



b
cx


+






6


a
cx



b
cy





)



t
3


+


(






3


a
cy



c
cx


+







6


b
cx



b
cy


+






9


a
cx



c
cy





2

)



t
2


+








(






b
cy



c
cx


+







2


b
cx



c
cy


+






3


a
cx



d
cy





)


t

+




c
cx



c
cy


+

2


b
cx



d
cy



2





)


Δ






t
2


+











(





3


a
cx



a
cy



t
5


+


(





2


a
cy



b
cx


+






3


a
cx



b
cy





)



t
4


+


(






a
cy



c
cx


+







2


b
cx



b
cy


+






3


a
cx



c
cy





)



t
3


+








(






b
cy



c
cx


+







2


b
cx



c
cy


+






3


a
cx



d
cy





)



t
2


+


(



c
cx



c
cy


+

2


b
cx



d
cy



)


t

+


c
cx



d
cy






)


Δ





t








(
11
)





and














A
a

=





(


y


(
t
)


+

y
(





t
+

Δ





t


)


)

·

(


x
(





t
+

Δ





t


)

-

x


(
t
)



)


2







=




1
2




(






a
cy



t
3


+


b
cy



t
2


+


c
cy


t

+

d
cy

+



a
cy

(





t
+

Δ





t


)

3

+









b
cy

(





t
+

Δ





t


)

2

+


c
cy

(





t
+

Δ





t


)

+

d
cy





)

·











(



a
cx



(


Δ






t
3


+

3


t
·
Δ







t
2


+

3







t
2

·
Δ






t


)


+


b
cx



(


Δ






t
2


+

2


t
·
Δ






t


)


+


c
cx


Δ





t


)







=







a
cx



a
cy


2


Δ






t
6


+


(


3


a
cx



a
cy


t

+




a
cx



b
cy


+


a
cy



b
cx



2


)


Δ






t
5


+












(







15


a
cx



a
cy


2



t
2


+










5


a
cy



b
cx


+

5


a
cx



b
cy



2


t

+









a
cy



c
cx


+


b
cx



b
cy


+


a
cx



c
cy



2




)


Δ






t
4


+












(





10


a
cx



a
cy



t
3


+




9


a
cy



b
cx


+

11


a
cx



b
cy



2



t
2


+










5


a
cx



c
cy


+

4


b
cx



b
cy


+

3


a
cy



c
cx



2


t

+









b
cy



c
cx


+


b
cx



c
cy


+

2


a
cx



d
cy



2




)


Δ






t
3


+












(







15


a
cx



a
cy


2



t
4


+


(


4


a
cy



b
cx


+

6


a
cx



b
cy



)



t
3


+










3


a
cy



c
cx


+

6


b
cx



b
cy


+

9


a
cx



c
cy



2



t
2


+








(



b
cy



c
cx


+

2


b
cx



c
cy


+

3


a
cx



d
cy



)


t

+









c
cx



c
cy


+

2


b
cx



d
cy



2




)


Δ






t
2


+











(





3


a
cx



a
cy



t
5


+


(


2


a
cy



b
cx


+

3


a
cx



b
cy



)



t
4


+








(



a
cy



c
cx


+

2


b
cx



b
cy


+

3


a
cx



c
cy



)



t
3


+








(



b
cy



c
cx


+

2


b
cx



c
cy


+

3


a
cx



d
cy



)



t
2


+








(



c
cx



c
cy


+

2


b
cx



d
cy



)


t

+


c
cx



d
cy






)


Δ





t








(
12
)






Then
,















Δ





A

=



A
-

A
a








=





(




a
cx



b
cy


-


a
cy



b
cx



10

)


Δ






t
5


+


(









a
cx



b
cy


-


a
cy



b
cx



2


t

+









a
cx



c
cy


-


a
cy



c
cx



4




)


Δ






t
4


+











(









a
cx



b
cy


-


a
cy



b
cx



2



t
2


+











a
cx



c
cy


-


a
cy



c
cx



2


t

+









b
cx



c
cy


-


b
cy



c
cx



6




)


Δ






t
3









(
13
)







As Δt is between (0,1] under general conditions, two items Δt5Δt4 can be omitted, then the above mentioned equation (13) becomes













Δ





A






(









a
cx



b
cy


-


a
cy



b
cx



2



t
2


+











a
cx



c
cy


-


a
cy



c
cx



2


t

+




b
cx



c
cy


-


b
cy



c
cx



6





)


Δ






t
3








=





C


(
t
)


·
Δ








t
3

.









(
14
)







If the maximum value of













C


(
t
)


=






a
cx



b
cy


-


a
cy



b
cx



2



t
2


+





a
cx



c
cy


-


a
cy



c
cx



2


t

+




b
cx



c
cy


-


b
cy



c
cx



6








=


L
·

t
2


+

M
·
t

+
N
















can be obtained, then the abovementioned equation (14) will be





ΔA≈Cmax·Δt3  (15)


As in general cases, the scope of t is [0.0,1.0], to find the maximum value of C(t) is to find the maximum value of among t=0.0, t=1.0 and






t
=

-


M

2

L


.






These three values are











val

t
=
0


=




b
x



c
y


-


b
y



c
x



6









val

t
=
1


=





a
x



b
y


-


a
y



b
x



2

+




a
x



c
y


-


a
y



c
x



2

+




b
x



c
y


-


b
y



c
x



6










val

t
=


-
M

/

(

2

L

)




=


-


M
2


4

L



+
N






(
16
)







Therefore,






C
max=max(valt=0,valt=1,valt=−M/(2L))  (17)


Finally, if ΔA is set to a threshold T (5 pixels, for example), then the following expression will be gotten:










Δ





t

=


T

C
max


3





(
18
)







If the curve segment is part of the elliptical curve, which is centered at the original point of the coordinate system, and has no rotation relative to X coordinate axis, then there exist the following equations:












A
=



t

t
+

Δ





t






y


(
t
)










x


(
t
)











=



t

t
+

Δ





t






(

rv





sin





t

)



(


-
rh






sin





t

)




t









=



rh
·
rv

2



(






sin
(





t
+

Δ





t


)



cos
(





t
+

Δ





t


)


-







sin





t





cos





t

-

Δ





t





)









(
19
)





and














A
a

=



(


y


(
t
)


+

y
(





t
+

Δ





t


)


)

·

(


x
(





t
+

Δ





t


)

-

x


(
t
)



)


2







=



(


rv





sin





t

+

rv






sin
(





t
+

Δ





t


)



)

·

(


rh






cos
(





t
+

Δ





t


)


-

rh





cos





t


)


2







=



rh
·
rv

2



(





sin





t






cos
(





t
+

Δ





t


)


-





sin





t





cos





t

+








sin
(





t
+

Δ





t


)



cos
(





t
+

Δ





t


)


-


sin
(





t
+

Δ





t


)


cos





t





)









(
20
)





Then














Δ





A

=

A
-

A
a








=



rh
·
rv

2



(


sin





Δ





t

-

Δ





t


)









(
21
)







The absolute value of ΔA is















Δ





A



=





rh
·
rv

2



(


Δ





t

-

sin





Δ





t


)








=





rh
·
rv

2



(


Δ





t

-

(


Δ





t

-


Δ






t
3



3
!


+


Δ






t
5



5
!


+


)


)














rh
·
rv

2




Δ






t
3



3
!









=





rh
·
rv

12


Δ






t
3








=




E
·
Δ







t
3









(
22
)







Finally, if ΔA is set to a threshold T, (5 pixels, for example), then










Δ





t

=


T
E

3





(
23
)







After the subdividing step Δt is obtained, the number of the subdividing points can be obtained by the following expression:






n=int(1/Δt)+1  (24)


As the elliptical curve can be obtained by affine transforming a unit circle curve, coordinate information of the subdividing points can be calculated on the unit circle curve. As the number n of the subdividing points has already been obtained and the angle of the circular arc on the unit circle curve corresponding to the elliptical curve is θ1−θ0 all, the angle difference between two adjacent subdividing points on the circular arc of the unit circle is (θ1−θ0)/n . From θ0 to θ1, the coordinates of each subdividing point on the circular arc are calculated according to x=cos θ and y=sin θ. Herein, the number of subdividing points on the circular arc of the unit circle is the same as that of the elliptical curve.



FIG. 3 illustrates a conceptual schematic diagram of forward differencing for approximating a Bezier curve. For any point Pt+Δt on the curve, the coordinate values can be calculated from the coordinate values of the previous point Pt, given the curve length difference ΔPt, as follows:






P
t+Δt=Pt+ΔPt  (25)


If Pt+Δt is treated as parameter equations, then






x(t+Δt)=x(t)+Δx(t)






y(t+Δt)=y(t)+Δy(t)  (26)


If the curve is a quadratic Bezier curve, then





Δx(t)=2(X1−X0t·t+(X1−X02t+2X0Δt





Δy(t)=2(Y1−Y0t·t+(Y1−Y02t+2Y0Δt  (27)


where X0=x1−x0, Y0=y1−y0, X1=x2−x1, and Y1=y2−y1.


Similarly,




Δx(t+Δt)=Δx(t)+Δ2x(t)





Δy(t+Δt)=Δy(t)+Δ2y(t)  (28)





So,





Δ2x(t)=Δ(Δx(t))=2(X1−X02t





Δ2y(t)=Δ(Δy(t))=2(Y1−Y02t  (29)


If the curve is defined in iterative terms xn+1=xn+Δxn, Δxn=Δxn−12xn−1, and yn+1=yn+Δyn, yn+1=yn+Δyn, then xn+1 and yn+1 can be obtained in an iterative way.


The coordinate values of the first subdividing point, Δx and Δy between the second and first subdividing points can be obtained by substituting the value of t on the first subdividing point into the expressions (1) and (27) respectively. Herein, the value of t can be, for example, 0.


If the curve is a cubic Bezier curve, then





Δx(t)=3AxΔt·t2+3(AxΔ2t+2BxΔt)t+(AxΔ3t+3BxΔ2t+3CxΔt)





Δy(t)=3AyΔt·t2+3(AyΔ2t+2ByΔt)t+(AyΔ3t+3ByΔ2t+3CyΔt)  (30)


where Ax=(X2−X1)−(X1−X0), Bx=(X1−X0), Cx=X0, X2=x3−x2, Ay=(Y2−Y1)−(Y1−Y0), By=(Y1−Y0), Cy=Y0 and Y2=y3−y2.


Likewise,





Δ2x(t)=Δ(Δx(t))=6AxΔ2t·t+6AxΔ3t+6BxΔ2t





Δ2y(t)=Δ(Δy(t))=6AyΔ2t·t+6AyΔ3t+6ByΔ2t  (31)





and





Δ3x(t)=Δ(Δ2x(t))=6AxΔ3t





Δ3y(t)=Δ(Δ2y(t))=6AyΔ3t  (32)


If the curve is defined in iterative terms xn+1=xn+Δxn, Δxn=Δxn−12xn−1, Δ2xn−12xn−23xn−2, and yn+1=yn+Δyn, yn+1=yn+Δyn, Δ2yn−12yn−23yn−2, then xn+1 and yn+1 can be calculated in an iterative way. Likewise, the coordinate values of the first subdividing point, Δx and Δy between the second and first subdividing points, and Δ2x and Δ2y between the second and first subdividing points can be obtained by substituting the value of t on the first subdividing point into the expressions (3), (30) and (31) respectively. Herein, the value of t on the first subdividing point can be, for example, 0.



FIG. 4 illustrates a schematic diagram of the procedure for affine transforming a unit circle, with translation, rotation and scaling, to acquire an ellipse. The unit circle curve can be defined as (x(θ),y(θ),1)T=(cos θ,sin θ,1)T, and the ellipse curve can be obtained by first subdividing the unit circle into points and then affine transforming the subdividing points. According to the coordinates (cos θ, sin θ,1)T of the subdividing points on the unit circle arc and the equation (5), the coordinates (x, y,1)T of an ellipse curve after affine transformation can be obtained through the following specific calculating formulas:






x=rh·cos(rot)·cos θ−rv·sin(rot)·sin θ+xc






y=rh·sin(rot)·cos θ+rv·cos(rot)·sin θ+xc  (33)



FIG. 5 illustrates a block diagram of a graphic-display control apparatus according to an embodiment of the invention. As shown in FIG. 5, the graphic-display control apparatus comprises a subdivision module (corresponding to the number acquiring unit) 502, a coordinate calculation module (corresponding to the coordinate acquiring unit) 504, and a rendering module (corresponding to the curve rendering unit) 506. A curve and rendering parameters are acquired by the graphic-display control apparatus from outside, and the curve is represented by its control points. Firstly, the subdivision module acquires number information of subdividing points for subdividing a curve by using coordinate information of control points of the curve. Secondly, the coordinate calculation module acquires the coordinate information of each subdividing point according to the number information of the subdividing points and the coordinate information of the control points, by using the method of forward difference when the curve is a Bezier curve or the method of affine transformation when the curve is an ellipse curve. Finally the rendering module connects the subdividing points by straight lines according to the coordinate information of each subdividing point and renders the straight lines connecting respective subdividing points by using the rendering parameters.



FIG. 6 illustrates a detailed block diagram of a subdivision module shown in FIG. 5. As shown in FIG. 6, the subdividing module calculates coefficients Q, Cmax and E in a curve function according to the coordinate information of the control points of the curve input from outside, acquires the relationship between an area difference and a subdividing step based on the curve function, the area difference being the difference between the area of a curve segment corresponding to the subdividing step on the curve with respect to X coordinate axis and the area of a line segment of two points corresponding to the subdividing step on the curve with respect to X coordinate axis, calculates the subdividing step Δt according to the acquired relationship and a threshold input from outside, and calculates the number n of the subdividing points by using the subdividing step Δt.



FIG. 7 illustrates a detailed block diagram of a coordinate calculation module shown in FIG. 5. As shown in FIG. 7, the coordinate calculation module calculates the parameter difference Δt according to the number of the subdividing points, and calculates the coordinate information of the first subdividing point according to coordinate information of the control points. Then it calculates a curve difference ΔP between adjacent subdividing points for the Bezier curve, and calculates affine transformation coefficients for the ellipse curve. By using the difference value ΔP between adjacent subdividing points, it calculates the coordinate values of the subdividing points of the Bezier curve. By using the affine transformation coefficients, it affine transforms the subdividing points on the unit circle to the subdividing points on the ellipse curve. Finally, the coordinate values of each subdividing point are stored in an external memory for the rendering module.


To sum up, the invention acquires the number information of subdividing points for subdividing a curve by using coordinate information of control points of the curve, and then acquires coordinate information of the subdividing points according to the number information of the subdividing points and the coordinate information of the control points, thereby achieving high efficient curve approximation and further high efficient graphic-display control.


What needs to be noted is that respect modules and/or units shown in FIG. 5 can be implemented by using pre-programmed firmware or hardware component (for example ASIC) or by using data processing devices including EEPROM or other components.


Those skilled in the art will understand that there exist more optional embodiments and modifications for implementing the embodiments of this invention, and the above-mentioned embodiments and examples are only descriptions of one or more embodiments. Therefore, the scope of this invention is restricted only by the claims attached.

Claims
  • 1. A method for approximating a curve, comprising the steps of: acquiring number information of subdividing points for subdividing a curve needed to be approximated based on coordinate information of control points of the curve;acquiring coordinate information of the subdividing points based on the number information of the subdividing points and the coordinate information of the control points; andconnecting the subdividing points with straight lines based on the coordinate information of the subdividing points.
  • 2. The method for approximating a curve of claim 1, characterized in that the process of acquiring the number information of the subdividing points comprises the sub-steps of: acquiring a curve function of the curve based on the coordinate information of the control points;acquiring a relationship between an area difference and a subdividing step based on the curve function, wherein the area difference is the difference between the area of a curve segment corresponding to the subdividing step on the curve with respect to X coordinate axis and the area of a line segment of two points corresponding to the subdividing step on the curve with respect to X coordinate axis;acquiring a subdividing step corresponding to a set area difference based on the relationship between the area difference and the subdividing step; andacquiring the number information of the subdividing points using the subdividing step corresponding to the set area difference.
  • 3. The method for approximating a curve of claim 1, characterized in that when the curve is a Bezier curve, the coordinate information of the subdividing points is acquired by forward differencing.
  • 4. The method for approximating a curve of claim 1, characterized in that when the curve is an elliptic curve, the coordinate information of the subdividing points is acquired by affine transforming.
  • 5. An apparatus for approximating a curve, comprising: a number acquiring unit configured to acquire number information of subdividing points for subdividing a curve needed to be approximated based on coordinate information of control points of the curve;a coordinate acquiring unit configured to acquire coordinate information of the subdividing points based on the number information of the subdividing points and the coordinate information of the control points; anda curve approximating unit configured to connect the subdividing points with straight lines based on the coordinate information of the subdividing points.
  • 6. The apparatus for approximating a curve of claim 5, characterized in that the number acquiring unit comprises: a curve function acquiring unit configured to acquire a curve function of the curve based on the coordinate information of the control points;a mutual relationship acquiring unit configured to acquire a relationship between an area difference and a subdividing step based on the curve function, wherein the area difference is the difference between the area of a curve segment corresponding to the subdividing step on the curve with respect to X coordinate axis and the area of a line segment of two points corresponding to the subdividing step on the curve with respect to X coordinate axis;a subdividing step acquiring unit configured to acquire a subdividing step corresponding to a set area difference based on the relationship between the area difference and the subdividing step; anda number information acquiring unit configured to acquire the number information of the subdividing points using the subdividing step corresponding to the set area difference.
  • 7. The apparatus for approximating a curve of claim 5, characterized in that in the case that the curve is a Bezier curve, the coordinate acquiring unit acquires the coordinate information of the subdividing points by forward differencing.
  • 8. The apparatus for approximating a curve of claim 5, characterized in that in the case that the curve is an elliptic curve, the coordinate acquiring unit acquires the coordinate information of the subdividing points by affine transforming.
  • 9. A graphic display control method, comprising the steps of: acquiring number information of subdividing points for subdividing a curve needed to be rendered based on coordinate information of control points of the curve;acquiring coordinate information of the subdividing points based on the number information of the subdividing points and the coordinate information of the control points; andconnecting the subdividing points with straight lines based on the coordinate information of the subdividing points and drawing the straight lines connecting the subdividing points according to rendering parameters.
  • 10. The graphic display control method of claim 9, characterized in that the process of acquiring the number information of the subdividing points comprises the sub-steps of: acquiring a curve function of the curve based on the coordinate information of the control points;acquiring a relationship between an area difference and a subdividing step based on the curve function, wherein the area difference is the difference between the area of a curve segment corresponding to the subdividing step on the curve with respect to X coordinate axis and the area of a line segment of two points corresponding to the subdividing step on the curve with respect to X coordinate axis;acquiring a subdividing step corresponding to a set area difference based on the relationship between the area difference and the subdividing step; andacquiring the number information of the subdividing points using the subdividing step corresponding to the set area difference.
  • 11. A graphic display control apparatus comprising: a number acquiring unit configured to acquire number information of subdividing points for subdividing a curve needed to be rendered based on coordinate information of control points of the curve;a coordinate acquiring unit configured to acquire coordinate information of the subdividing points based on the number information of the subdividing points and the coordinate information of the control points; anda curve rendering unit configured to connect the subdividing points with straight lines based on the coordinate information of the subdividing points and draw the straight lines connecting the subdividing points according to rendering parameters.
  • 12. The graphic display control apparatus of claim 11, characterized in that the number acquiring unit comprises: a curve function acquiring unit configured to acquire a curve function of the curve based on the coordinate information of the control points;a mutual relationship acquiring unit configured to acquire a relationship between an area difference and a subdividing step based on the curve function, wherein the area difference is the difference between the area of a curve segment corresponding to the subdividing step on the curve with respect to X coordinate axis and the area of a line segment of two points corresponding to the subdividing step on the curve with respect to X coordinate axis;a subdividing step acquiring unit configured to acquire a subdividing step corresponding to a set area difference based on the relationship between the area difference and the subdividing step; anda number information acquiring unit configured to acquire the number information of the subdividing points using the subdividing step corresponding to the set area difference.
Priority Claims (1)
Number Date Country Kind
200910142113.4 May 2009 CN national