CN101625765A - Method for drawing rotating elliptical arc - Google Patents

Method for drawing rotating elliptical arc Download PDF

Info

Publication number
CN101625765A
CN101625765A CN200910057764A CN200910057764A CN101625765A CN 101625765 A CN101625765 A CN 101625765A CN 200910057764 A CN200910057764 A CN 200910057764A CN 200910057764 A CN200910057764 A CN 200910057764A CN 101625765 A CN101625765 A CN 101625765A
Authority
CN
China
Prior art keywords
ellipse
revolution
coordinate
arc
revolution arc
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN200910057764A
Other languages
Chinese (zh)
Other versions
CN101625765B (en
Inventor
林�吉
毛礼荣
俞高宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Left Bank Investment Management Co ltd
Shanghai Kelu Software Co Ltd
Original Assignee
Shanghai Kelu Software Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Kelu Software Co Ltd filed Critical Shanghai Kelu Software Co Ltd
Priority to CN200910057764.3A priority Critical patent/CN101625765B/en
Publication of CN101625765A publication Critical patent/CN101625765A/en
Application granted granted Critical
Publication of CN101625765B publication Critical patent/CN101625765B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention discloses a method for drawing rotating elliptical arc, including that a rotating ellipse corresponding to the rotating elliptical arc is divided into a standard ellipse (namely an ellipse major axis or minor axis of which is parallel to the horizontal axis) and the standard ellipse is transformed into a transformation matrix required to rotate the ellipse; a corresponding standard ellipse can be obtained according to the major axis or minor axis described by the rotating elliptical arc, coordinates of each point corresponding to the rotating elliptical arc on the standard ellipse are determined by the rotating elliptical arc, and the coordinates of each corresponding point on the standard ellipse are combined with the transformation matrix to obtain the coordinates of each point on the rotating elliptical arc; and the rotating elliptical arc is drawn on a display screen according to the coordinates of each point on the rotating elliptical arc. The rotating elliptical arc is fast drawn without establishing a mathematical model of the rotating ellipse.

Description

A kind of method for drafting of ellipse of revolution arc
Technical field
The present invention relates to a kind of graphics plotting, relate in particular to a kind of rendering technique of elliptic arc.
Background technology
To same vector graphics multiple mathematical description can be arranged, with the elliptic arc is example, the elliptic arc of software drafting all is that promptly the major axis of elliptic arc or minor axis are parallel to the x axle or the y axle (being designated hereinafter simply as the elliptic arc of standard) of rectangular coordinate system respectively not through the elliptic arc of rotation generally speaking.As shown in Figure 1, the parameter of describing a standard ellipse arc has: and the coordinate of the top left corner apex of transverse length a, ellipse short shaft length b, oval circumscribed rectangle (x, y), the start angle α of elliptic arc and the angle β of elliptic arc start angle and termination point.
The standard ellipse arc has been owing to set up mathematical model, thus can access the coordinate of each point on the elliptic arc, and then finish the drafting of camber line.Specifically, the mathematical model of complete ellipse has been arranged at present, has comprised ripe elliptic equation: ( x - x 0 ) 2 a 2 + ( y - y 0 ) 2 b 2 = 1 , Wherein, (x0 y0) is the oval center of circle, and a is oval transverse axis, and b is the oval longitudinal axis.According to this equation, can determine each point coordinate on the standard ellipse, the angle of the start angle of combined standard elliptic arc and start angle and termination point again, each point coordinate on the elliptic arc that can settle the standard, and then on display screen, draw this standard ellipse arc.
Yet in many cases, the elliptic arc that the user need draw not is to be standard, but has certain anglec of rotation.That is to say that the ellipse of ellipse of revolution arc correspondence is an ellipse of revolution, its major axis and minor axis also are not parallel to the x axle and the y axle of rectangular coordinate system, but form certain angle with x axle and y axle, are called the anglec of rotation.
As in SVG (but vector graphics of scaling), just there is the ellipse of revolution arc that forms certain angle with the x axle.The characterising parameter of elliptic arc is: rx, ry, x-axis-rotation, large-arc-flag, sweep-flag, x1, y1, x2, y2.Wherein, x-axis-rotation is the anglec of rotation, promptly is the x axle of ellipse at this section arc place and the angle of horizontal direction; Rx is oval semi-major axis length; Ry is oval semi-minor axis length; Large-arc-flag and sweep-flag have determined the drafting direction of elliptic arc, and value is 0 or 1, and large-arc-flag is 1 expression wide-angle camber line, are 0 to represent the low-angle camber line; Sweep-flag be 1 the representative from the origin-to-destination camber line around the elliptical center clockwise direction, be 0 represent the counter clockwise direction; X1, y1 are starting point coordinates, and x2, y2 are terminal point coordinates.
For example, elliptic arc starting point A as shown in Figure 2, terminal point B, semi-major axis a, semi-minor axis b, the anglec of rotation is r (a scope 0-180 degree), large-arc-flag is 1: get orthodrome, sweep-flag is 0: counterclockwise (draw counterclockwise from A to B).
Elliptic arc starting point A as shown in Figure 3, terminal point B, major axis a, minor axis b, the anglec of rotation is r (a scope 0-180 degree), large-arc-flag is 1: get orthodrome, sweep-flag is 1: clockwise direction (drawing clockwise from A to B).
Owing to do not have the mathematical model of moulding at present for ellipse of revolution, the formula that does not also have corresponding ellipse of revolution, so software can't directly obtain each point coordinate on the ellipse of revolution, thereby can't directly draw the ellipse of revolution arc, can only draw major axis or minor axis (is the transverse axis and the longitudinal axis, can transverse axis be major axis, also can minor axis be major axis) the standard ellipse arc parallel with transverse axis.In addition,,, and then draw the ellipse of revolution arc, will reduce the render speed of ellipse of revolution arc if pass through to calculate the equation of ellipse of revolution because the calculating of ellipse of revolution is very complicated.
Summary of the invention
The technical matters that the present invention mainly solves provides a kind of method for drafting of ellipse of revolution arc, makes software can pass through less operand, and is easy and draw the ellipse of revolution arc apace.
In order to solve the problems of the technologies described above, the invention provides a kind of method for drafting of ellipse of revolution arc, comprise following steps:
The ellipse of revolution of ellipse of revolution arc correspondence is decomposed into standard ellipse and this standard ellipse is transformed into the required transformation matrix of this ellipse of revolution, and the major axis or the minor axis of described standard ellipse are parallel to transverse axis;
Determine each point coordinate of described ellipse of revolution arc correspondence on described standard ellipse, each corresponding on described standard ellipse point coordinate is combined with described transformation matrix, obtain each point coordinate on the ellipse of revolution arc;
According to each point coordinate on the described ellipse of revolution arc, on display screen, draw described ellipse of revolution arc.
As improvement of the technical scheme, described ellipse of revolution with ellipse of revolution arc correspondence is decomposed in the step of standard ellipse and transformation matrix, can comprise following substep:
A obtains the parameter of ellipse of revolution arc to be drawn, and comprises semi-major axis length, the semi-minor axis length of the ellipse of revolution of starting point coordinate, terminal point coordinate, this ellipse of revolution arc correspondence, the anglec of rotation of this ellipse of revolution arc;
B determines the standard ellipse of described ellipse of revolution arc correspondence according to described starting point coordinate, terminal point coordinate and semi-major axis length, semi-minor axis length;
C determines the conversion starting point and the conversion terminal point of described ellipse of revolution arc correspondence on described standard ellipse according to the anglec of rotation of described ellipse of revolution arc, the starting point coordinate and the terminal point coordinate of described ellipse of revolution arc;
D determines that according to the origination data of the described anglec of rotation, described ellipse of revolution arc and/or original equipment manufacturer coordinate, corresponding conversion starting point and/or conversion terminal point coordinate on described standard ellipse described standard ellipse is transformed to the required transformation matrix of described ellipse of revolution.
As improvement of the technical scheme, among the described step B, comprise following substep:
With described origination data coordinate, original equipment manufacturer coordinate and semi-major axis length, semi-minor axis length substitution elliptic equation ( x - x 0 ) 2 a 2 + ( y - y 0 ) 2 b 2 = 1 , Try to achieve the central coordinate of circle of described standard ellipse, determine the elliptic equation of described standard ellipse.
As improvement of the technical scheme, the central coordinate of circle of described standard ellipse can for: x 0 = - D + D 2 - 4 CE 2 C , y 0=A+Bx 0Perhaps, x 0 = - D - D 2 - 4 CE 2 C , y 0=A+Bx 0
Wherein, A = b 2 ( x 2 2 - x 1 2 ) + a 2 ( y 2 2 - y 1 2 ) 2 a 2 ( y 2 - y 1 ) ; B = b 2 ( x 1 - x 2 ) a 2 ( y 2 - y 1 ) ; C=b 2+a 2B 2;D=-2a 2(y 1-A)B-2b 2x 1;E=a 2(y 1-A) 2+b 2x 1 2-a 2b 2
The parameter of described ellipse of revolution arc can also comprise: the camber line size indicates, and being used to indicate described ellipse of revolution arc is wide-angle camber line or low-angle camber line; Draw hand designations, the origin-to-destination that is used to indicate described ellipse of revolution arc is a clockwise direction or counterclockwise;
Indicate and described drafting hand designations unique central coordinate of circle of determining described standard ellipse among the described step B according to described camber line size.
As improvement of the technical scheme, among the described step C, can comprise following substep:
Origination data coordinate and original equipment manufacturer coordinate according to described ellipse of revolution arc are determined straight line, and this straight line is rotated counterclockwise, and the angle of rotation is the anglec of rotation of this ellipse of revolution arc;
With postrotational straight line under the constant situation of slope, intersect with standard ellipse, the profound length that intersects 2 formations equals the profound length that described ellipse of revolution arc origination data coordinate and original equipment manufacturer coordinate constitute, and described crossing 2 be the conversion starting point and the conversion terminal point of described ellipse of revolution arc correspondence on described standard ellipse.
As improvement of the technical scheme, equal in the profound length of described intersection point under the condition of the profound length that described ellipse of revolution arc origination data coordinate and original equipment manufacturer coordinate constitute, if the straight line that intersects with described standard ellipse is more than one, then according to the anglec of rotation of described ellipse of revolution arc, select wherein described crossing straight line, unique conversion starting point and conversion terminal point of determining described ellipse of revolution arc correspondence on described standard ellipse.
As improvement of the technical scheme, among the described step D, can comprise following substep: the transformation matrix between described standard ellipse and the described ellipse of revolution is | cos ( a ) - sin ( a ) tx sin ( a ) cos ( a ) ty 0 0 1 | ;
Wherein, tx is the coordinate figure that moves horizontally, and ty is the coordinate figure of vertical moving, and a is the anglec of rotation of described ellipse of revolution arc;
Described conversion starting point or conversion terminal point are rotated a angle along initial point, obtain postrotational conversion starting point coordinate or postrotational conversion terminal point coordinate, the origination data coordinate or the original equipment manufacturer coordinate of described ellipse of revolution arc are deducted this postrotational conversion starting point coordinate or postrotational conversion terminal point coordinate, obtain the coordinate figure tx that moves horizontally between described standard ellipse and the ellipse of revolution and the coordinate figure ty of vertical moving.
As improvement of the technical scheme, the parameter of described ellipse of revolution arc also comprises: the camber line size indicates, and being used to indicate described ellipse of revolution arc is wide-angle camber line or low-angle camber line; Draw hand designations, the origin-to-destination that is used to indicate described ellipse of revolution arc is a clockwise direction or counterclockwise;
In the step of described definite ellipse of revolution arc each corresponding point coordinate on described standard ellipse, can indicate and described drafting hand designations according to the conversion starting point of determining among the standard ellipse of determining among the described step B, the described step C and conversion terminal point, described camber line size, obtain each point coordinate of described ellipse of revolution arc correspondence on described standard ellipse.
Embodiment of the present invention compared with prior art, the key distinction and effect thereof are: the present invention has utilized the mathematical model of existing standard ellipse, the ellipse of ellipse of revolution arc correspondence is decomposed into standard ellipse+transformation matrix, the elliptic equation of the standard ellipse by correspondence, determine each point coordinate of ellipse of revolution arc correspondence on this standard ellipse, again these coordinates are combined with transformation matrix, obtain each point coordinate on the ellipse of revolution arc, under the prerequisite of the mathematical model that need not to set up ellipse of revolution, by less operand, finish the drafting of ellipse of revolution arc, method for drafting is easy and consume system resources is few.
Description of drawings
Below in conjunction with the drawings and specific embodiments the present invention is described in further detail.
Fig. 1 is the synoptic diagram of standard elliptic arc in the prior art;
Fig. 2 is the synoptic diagram of ellipse of revolution arc example 1 in the prior art;
Fig. 3 is the synoptic diagram of ellipse of revolution arc example 2 in the prior art;
Fig. 4 is the method for drafting process flow diagram of the ellipse of revolution arc of first embodiment of the invention;
Fig. 5 is the synoptic diagram of the standard ellipse of ellipse of revolution arc correspondence in the method for drafting of ellipse of revolution arc of first embodiment of the invention;
Fig. 6 is the synoptic diagram in two centers of circle of standard ellipse in the method for drafting of ellipse of revolution arc of first embodiment of the invention;
Fig. 7 is the synoptic diagram of two tangent lines intersecting with standard ellipse in the method for drafting of ellipse of revolution arc of first embodiment of the invention.
Embodiment
For making the purpose, technical solutions and advantages of the present invention clearer, embodiments of the present invention are described in further detail below in conjunction with accompanying drawing.
First embodiment of the invention relates to a kind of method for drafting of ellipse of revolution arc.Present embodiment is an example with the ellipse of revolution arc among the SVG, concrete method for drafting is described, as shown in Figure 4.
Step 401, obtain the parameter value of ellipse of revolution arc to be drawn, comprise starting point coordinate A (x1, y1), terminal point coordinate B (x2, y2), semi-major axis (transverse axis) the length a of the ellipse of revolution of this ellipse of revolution arc correspondence, semi-minor axis (longitudinal axis) length b, the anglec of rotation α of this ellipse of revolution arc (promptly is the transverse axis of this ellipse of revolution and the angle of transverse axis, oval transverse axis is rotated counterclockwise by transverse axis and obtains then being positive-angle, clockwise rotate and obtain then being negative angle), the camber line size indicates large-arc-flag, large-arc-flag is 1 expression wide-angle camber line, is 0 to represent the low-angle camber line; Draw hand designations sweep-flag, sweep-flag is that 1 representative is drawn around the elliptical center clockwise direction from the origin-to-destination camber line, is that 0 representative is counterclockwise drawn around elliptical center from the origin-to-destination camber line.Need to prove that in the present embodiment, the anglec of rotation is the angle of transverse axis and transverse axis, but in concrete the application, different according to definition, the anglec of rotation also can be the angle of angle, transverse axis and Z-axis of angle, the longitudinal axis and the Z-axis of the longitudinal axis and transverse axis.
Step 402 according to starting point coordinate A, terminal point coordinate B and semi-major axis length a, semi-minor axis length b, is determined the standard ellipse of ellipse of revolution arc correspondence, and the anglec of rotation of standard ellipse is zero, as shown in Figure 5.
Specifically, general standard ellipse arc has had mathematical model, standard ellipse equation formula: ( x - x 0 ) 2 a 2 + ( y - y 0 ) 2 b 2 = 1 . The mode of drawing the standard ellipse arc can be the standard ellipse formula of the elliptic arc correspondence that settles the standard, and according to this formula, can obtain the oval coordinate of going up each point, in conjunction with the starting point and the terminal point of elliptic arc, just can determine this standard ellipse arc again.Yet, so in the present embodiment, need the ellipse of revolution of this ellipse of revolution arc correspondence is converted to standard ellipse+transformation matrix because the ellipse (being the ellipse that there are certain angle in transverse axis and transverse axis) of rotation does not have mathematical model.
In this step, under the constant situation of semi-major axis length a, semi-minor axis length b, according to known starting point coordinate A and the terminal point coordinate B ellipse that settles the standard.
Basic elliptic equation formula: ( x - x 0 ) 2 a 2 + ( y - y 0 ) 2 b 2 = 1
Terminal A and B brought into obtain:
( x 1 - x 0 ) 2 a 2 + ( y 1 - y 0 ) 2 b 2 = 1 . . . ( 1 ) ( x 2 - x 0 ) 2 a 2 + ( y 2 - y 0 ) 2 b 2 = 1 . . . ( 2 )
(2)-(1) obtain:
( x 2 - x 0 ) 2 a 2 - ( x 1 - x 0 ) 2 a 2 + ( y 2 - y 0 ) 2 b 2 - ( y 1 - y 0 ) 2 b 2 = 0
b 2(x 2 2-x 1 2)+2b 2x 0(x 1-x 2)+a 2(y 2 2-y 1 2)+2a 2y 0(y 2-y 2)=0
y 0 = b 2 ( x 2 2 - x 1 2 ) + 2 b 2 x 0 ( x 1 - x 2 ) + a 2 ( y 2 2 - y 1 2 ) 2 a 2 ( y 2 - y 1 )
y 0 = b 2 ( x 2 2 - x 1 2 ) + a 2 ( y 2 2 - y 1 2 ) 2 a 2 ( y 2 - y 1 ) + 2 b 2 ( x 1 - x 2 ) 2 a 2 ( y 2 - y 1 ) x 0
Order: A = b 2 ( x 2 2 - x 1 2 ) + a 2 ( y 2 2 - y 1 2 ) 2 a 2 ( y 2 - y 1 ) ; B = b 2 ( x 1 - x 2 ) a 2 ( y 2 - y 1 ) .
y 0=A+Bx 0????(3)
(3) substitution (1) is obtained:
( x 1 - x 0 ) 2 a 2 + ( y 1 - ( A + Bx 0 ) ) 2 b 2 = 1
b 2(x 1-x 0) 2+a 2(y 2-A+Bx 0) 2-a 2b 2=0
b 2(x 1 2-2x 1x 0+x 0 2)+a 2((y 1-A) 2-2(y 1-A)Bx 0+B 2x 0 2)-a 2b 2=0
b 2x 1 2-2b 2x 1x 0+b 2x 0 2+a 2(y 1-A) 2-2a 2(y 1-A)Bx 0+a 2B 2x 0 2-a 2b 2=0
( b 2 + a 2 B 2 ) x 0 2 + ( - 2 a 2 ( y 2 - A ) B - 2 b 2 x 1 ) x 0 + a 2 ( y 1 - A ) 2 + b 2 x 2 2 - a 2 b 2 = 0
Order: C=b 2+ a 2B 2D=-2a 2(y 1-A) B-2b 2x 1E=a 2(y 1-A) 2+ b 2x 1 2-a 2b 2, obtain:
Cx 0 2+Dx 0+E=0
Use radical formula:
Ax 2+ bx+c=0 radical formula:
Figure A20091005776400142
Solve an equation: Cx 0 2+ Dx 0+ E=0
: x 0 = - D ± D 2 - 4 CE 2 C
Substitution (3) y 0=A+Bx 0
Try to achieve y 0
So just determined oval central coordinate of circle, one has 2 satisfactory central coordinate of circle, is respectively:
x 01 = - D - D 2 - 4 CE 2 C y 01 = A + Bx 01
x 02 = - D + D 2 - 4 CE 2 C y 02 = A + Bx 02
Wherein, A = b 2 ( x 2 2 - x 1 2 ) + a 2 ( y 2 2 - y 1 2 ) 2 a 2 ( y 2 - y 1 ) ; B = b 2 ( x 1 - x 2 ) a 2 ( y 2 - y 1 ) ; C=b 2+a 2B 2;D=-2a 2(y 1-A)B-2b 2x 1;E=a 2(y 1-A) 2+b 2x 1 2-a 2b 2
Indicate large-arc-flag and draw hand designations sweep-flag according to the camber line of ellipse of revolution arc size then, determine adopt which value as the center of circle:
Suppose that two centers of circle determining are respectively θ 1, θ 2, as shown in Figure 6.Calculate respectively
Figure A20091005776400148
The angle of (to be positive dirction counterclockwise) is α 1, and α 2, can draw α 1 according to the principle of similitude, and 2 two angle additions of α equal 360 degree.
Below divide the situation discussion:
??α1>α2 ??α2>α1
Orthodrome is counterclockwise ??θ1 ??θ2
Orthodrome is clockwise ??θ2 ??θ1
Little circular arc is counterclockwise ??θ2 ??θ1
Little circular arc is clockwise ??θ1 ??θ2
Table 1
The parameter and the table 1 of this elliptic arc are compared, can be unique determine the center of circle of this standard ellipse, and then the ellipse formula of unique this standard ellipse of affirmation.
In step 403,, determine the conversion starting point A ' and the conversion terminal point B ' of this ellipse of revolution arc correspondence on this standard ellipse according to the anglec of rotation of this ellipse of revolution arc.
Specifically, the standard ellipse that obtains in the step 402 is that ellipse of revolution oppositely reverses α (anglec of rotation of ellipse of revolution arc) and obtains, yet as can be seen from Figure 5, this ellipse of revolution reverses in the process of standard ellipse, and being not is along the oval center of circle or certain point of fixity rotates.
Though ellipse of revolution is not around the fixing rotation of certain point to standard ellipse, it can be considered as rotating around the oval center of circle earlier, and translation takes place after the rotation again.Equally, the starting point A of ellipse of revolution arc and terminal point B also can regard as earlier and rotate around the oval center of circle, and translation takes place after the rotation again, correspond to the starting point A ' on the standard ellipse, terminal point B '.The angle of rotation is known, be-α, the position of translation can't be determined, can be by rotating the straight line AB that forms by ellipse of revolution arc starting point and terminal point earlier, the angle of rotation is-α, again postrotational straight line is intersected with standard ellipse under the constant situation of slope, the profound length that intersects 2 formations equals the profound long AB that ellipse of revolution arc origination data A and original equipment manufacturer B constitute, and by intersecting of obtaining of this method 2 are ellipse of revolution arc corresponding conversion starting point A ' and conversion terminal point B ' on this standard ellipse.Specific as follows:
1) at first calculates the profound length of 2 of AB L = ( x 1 - x 2 ) 2 + ( y 1 - y 2 ) 2 .
2) determine the slope of straight line AB then by A, B two point coordinate k 1 = y 1 - y 2 x 1 - x 2 , Obtain the angle tag θ=k of straight line AB and horizontal x axle 1Get θ=arctank 1AB is rotated counterclockwise α with straight line, obtains total angle and is (α+θ), rotate back straight slope K 2=tag (α+θ).
With postrotational straight-line equation y=k 2X+t substitution standard ellipse equation ( x - x 0 ) 2 a 2 + ( y - y 0 ) 2 b 2 = 1 , Obtain rotating the intersection point of back straight line and standard ellipse:
b 2(x-x 0) 2+a 2(k 2x+t-y 0) 2=a 2b 2
(b 2+a 2k 2 2)x 2+(-2b 2x 0+2a 2k 2(t-y 0))x+b 2x 0 2+a 2(t-y 0) 2-a 2b 2=0
Order: F=(b 2+ a 2k 2 2) G=(2b 2x 0-2a 2k 2y 0) H=b 2x 0 2-a 2b 2
Then equation becomes:
Fx 2+(G+2a 2k 2t)x+H+a 2(t-y 0) 2=0
Radical formula must rotate the coordinate of the intersection point of back straight line and standard ellipse, promptly the starting point A of ellipse of revolution arc (x1, y1) and terminal point B (x2, y2) on standard ellipse corresponding starting point A ' (x3, y3) with terminal point B ' (x4, coordinate y4):
x = - ( G + 2 a 2 k 2 t ) = ( ( G + 2 a 2 k 2 t ) ) 2 - 4 F ( H + a 2 ( t - y 0 ) 2 ) 2 F ; (being x3, x4) formula (5)
Y=k 2X+t; (being y3, y4)
At this moment, t does not also find the solution.
According to the chord length formula:
L = ( x 3 - x 4 ) 2 + ( y 2 - y 4 ) 2
= ( x 3 - x 4 ) 2 + ( k 2 x 2 - k 2 x 4 ) 2
= ( 1 + k 2 ) ( x 3 - x 4 ) 2
= ( 1 + k 2 ) ( ( x 3 + x 4 ) 2 - 4 x 3 x 4 )
= ( 1 + k 2 ) ( ( - ( G + 2 a 2 k 2 t ) F ) 2 - 4 H + a 2 ( t - y 0 ) 2 F )
( 1 + k 2 ) ( ( - ( G + 2 a 2 k 2 t ) F ) 2 - 4 H + a 2 ( t - y 0 ) 2 F ) = L 2
(1+k 2)((G+2a 2k 2t) 2-4F(H+a 2(t-y 0) 2))=L 2F 2
( ( G + 2 a 2 k 2 t ) 2 - 4 F ( H + a 2 ( t - y 0 ) 2 ) ) = L 2 F 2 ( 1 + k 2 )
G 2 + 4 Ga 2 k 2 t + 4 a 4 k 2 2 t 2 - 4 FH - 4 Fa 2 ( t - y 0 ) 2 = L 2 F 2 ( 1 + k 2 )
G 2 + 4 Ga 2 k 2 t + 4 a 4 k 2 2 t 2 - 4 FH - 4 Fa 2 ( t 2 - 2 y 0 t + y 0 2 ) = L 2 F 2 ( 1 + k 2 )
G 2 + 4 Ga 2 k 2 t + 4 a 4 k 2 2 t 2 - 4 FH - 4 Fa 2 t 2 + 8 y 0 Fa 2 t - 4 Fa 2 y 0 2 ) = L 2 F 2 ( 1 + k 2 )
( 4 a 4 k 2 2 - 4 Fa 2 ) t 2 + ( 4 Ga 2 k 2 + 8 y 0 Fa 2 ) t + G 2 - 4 FH - 4 Fa 2 y 0 2 - L 2 F 2 ( 1 + k 2 ) = 0
Order: [=4a 4k 2 2-4Fa 2:]=4Ga 2k 2+ 8y 0Fa 2: K = G 2 - 4 FH - 4 Fa 2 y 0 2 - L 2 F 2 ( 1 + k 2 )
Then equation becomes:
It 2+Jt+K=0
Solve two roots of equation: t = - j ± j 2 - 4 IK 2 l
Total can obtain two groups and separate, respectively two straight line l1, l2 in the corresponding diagram 7.
Two orthoscopic parallel relation can be determined by the slope of straight line, and then the upper and lower relation of two straight lines can be determined.If the anglec of rotation is the 0-180 degree, then get top straight line l1, t = - j + j 2 - 4 IB 2 l , If 180-360 or-the 180-0 degree then takes off the straight line l2 of face, t = - j - j 2 - 4 IK 2 l .
Get t = - j + j 2 - 4 IK 2 l Substitution formula (5) obtains, and the anglec of rotation is 0-180 when spending, and the starting point A of ellipse of revolution arc and terminal point B corresponding starting point A ' and the coordinate of terminal point B ' on standard ellipse are:
x = - ( G - 2 a 2 k 2 ( - j + j 2 - 4 IK 2 l ) ) ± ( ( G - 2 a 2 k 2 ( - j - j 2 - 4 IK 2 l ) ) ) 2 - 4 F ( H - a 2 ( ( - j + j 2 - 4 IK 2 l ) - y 2 ) 2 ) 2 F (be x3, x4)
y = k 2 x + - j + j 2 - 4 IK 2 l (be y3, y4)
Get t = - j - j 2 - 4 IK 2 l Substitution formula (5) obtains, the anglec of rotation be 180-360 or-when 180-0 spent, the starting point A of ellipse of revolution arc and terminal point B corresponding starting point A ' and the coordinate of terminal point B ' on standard ellipse were:
x = - ( G - 2 a 2 k 2 ( - j - j 2 - 4 IK 2 l ) ) ± ( ( G + 2 a 2 k 2 ( - j - j 2 - 4 IK 2 l ) ) ) 2 - 4 F ( H + a 2 ( ( - j - j 2 - 4 IK 2 l ) - y 2 ) 2 ) 2 F (be x3, x4)
y = k 2 x + - j - j 2 - 4 IK 2 l (be y3, y4)
Wherein, K 2=tag (α+θ), F=(b 2+ a 2k 2 2) G=(2b 2x 0-2a 2k 2y 0) H=b 2x 0 2-a 2b 2
In step 404,, determine the transformation matrix between this standard ellipse and this ellipse of revolution according to the anglec of rotation of this ellipse of revolution arc, the beginning or end coordinate of this ellipse of revolution arc, corresponding beginning or end coordinate on this standard ellipse.
This transformation matrix is made up of translation and rotation two parts, and the matrix form of expression of existing computer graphic fractal transform is as follows:
Translation matrix: | 1 0 tx 0 1 ty 0 0 1 | ; Rotation matrix: | cos ( a ) - sin ( a ) 0 sin ( a ) cos ( a ) 0 0 0 1 | ;
Existing translation has the transformation matrix of rotation to be again: | cos ( a ) - sin ( a ) tx sin ( a ) cos ( a ) ty 0 0 1 | ;
Wherein, tx is the coordinate figure that moves horizontally, and ty is the coordinate figure of vertical moving; A is the angle of rotation.
This standard ellipse is transformed to the angle that this ellipse of revolution rotates and is the transverse axis of this ellipse of revolution arc and the angle of transverse axis in the present embodiment, and corresponding rotation matrix is: | cos ( α ) - sin ( α ) 0 sin ( α ) cos ( α ) 0 0 0 1 | ; The displacement coordinate value of translation is unknown.
In this step, at first (x3 y3) is set to the 3*1 matrix with A ' coordinate points | x 3 y 3 1 | , Again with rotation matrix | cos ( α ) - sin ( α ) 0 sin ( α ) cos ( α ) 0 0 0 1 | Dot product A ' coordinates matrix | x 3 y 3 1 | , Obtain postrotational A " coordinates matrix | x 5 y 5 1 | . Wherein, x 5=cos (α) x 3-sin (α) y 3y 5=sin (α) x 3+ cos (α) y 3
(x1 y1) deducts A, and " (x5 y5), has just obtained translational coordination to coordinate with the A point coordinate.According to this translational coordination and the anglec of rotation, can determine the transformation matrix between this standard ellipse and this ellipse of revolution | cos ( a ) - sin ( a ) tx sin ( a ) cos ( a ) ty 0 0 1 | , Tx is the coordinate figure (being x1-x5) that moves horizontally, and ty is the coordinate figure (being y1-y5) of vertical moving; A is anglec of rotation α.
In step 405, according to the ellipse of revolution arc of determining in the equation of the standard ellipse that calculates in the step 402 and the step 403 corresponding starting point and terminal point on this standard ellipse, obtain each point coordinate of ellipse of revolution arc correspondence on this standard ellipse, the transformation matrix of determining in these point coordinate and the step 404 is multiplied each other, obtain each point coordinate on the ellipse of revolution arc.
In step 406,, on display screen, draw this ellipse of revolution arc according to each point coordinate on the ellipse of revolution arc.Specifically can utilize drawing instrument, as GDI (Graphics Device Interface: Graphics Device Interface), GDI+, openG1 (high performance graphics algorithm industry standard) etc. directly draw these coordinate points, and these coordinate points are formed elliptic arc.
In sum, present embodiment has been utilized the mathematical model of existing standard ellipse, the ellipse of ellipse of revolution arc correspondence is decomposed into standard ellipse+transformation matrix, the elliptic equation of the standard ellipse by correspondence, determine each point coordinate of ellipse of revolution arc correspondence on this standard ellipse, again these coordinates are combined with transformation matrix, obtain each point coordinate on the ellipse of revolution arc, thereby under the prerequisite of the mathematical model that need not to set up ellipse of revolution, by less operand, finish the drafting of ellipse of revolution arc, method for drafting is easy and consume system resources is few.
Need to prove that to be example with the SVG figure be illustrated the method for drafting of ellipse of revolution arc present embodiment, in actual applications, can use the present invention to draw the ellipse of revolution arc of the extended formatting except that the SVG figure equally.
Though pass through with reference to some of the preferred embodiment of the invention, the present invention is illustrated and describes, but those of ordinary skill in the art should be understood that and can do various changes to it in the form and details, and without departing from the spirit and scope of the present invention.

Claims (8)

1. the method for drafting of an ellipse of revolution arc is characterized in that, comprises following steps:
The ellipse of revolution of ellipse of revolution arc correspondence is decomposed into standard ellipse and this standard ellipse is transformed into the required transformation matrix of this ellipse of revolution, and the major axis or the minor axis of described standard ellipse are parallel to transverse axis;
Determine each point coordinate of described ellipse of revolution arc correspondence on described standard ellipse, each corresponding on described standard ellipse point coordinate is combined with described transformation matrix, obtain each point coordinate on the ellipse of revolution arc;
According to each point coordinate on the described ellipse of revolution arc, on display screen, draw described ellipse of revolution arc.
2. the method for drafting of ellipse of revolution arc according to claim 1 is characterized in that, described ellipse of revolution with ellipse of revolution arc correspondence is decomposed in the step of standard ellipse and transformation matrix, comprises following substep:
A obtains the parameter of ellipse of revolution arc to be drawn, and comprises semi-major axis length, the semi-minor axis length of the ellipse of revolution of starting point coordinate, terminal point coordinate, this ellipse of revolution arc correspondence, the anglec of rotation of this ellipse of revolution arc;
B determines the standard ellipse of described ellipse of revolution arc correspondence according to described starting point coordinate, terminal point coordinate and semi-major axis length, semi-minor axis length;
C determines the conversion starting point and the conversion terminal point of described ellipse of revolution arc correspondence on described standard ellipse according to the anglec of rotation of described ellipse of revolution arc, the starting point coordinate and the terminal point coordinate of described ellipse of revolution arc;
D determines that according to the origination data of the described anglec of rotation, described ellipse of revolution arc and/or original equipment manufacturer coordinate, corresponding conversion starting point and/or conversion terminal point coordinate on described standard ellipse described standard ellipse is transformed to the required transformation matrix of described ellipse of revolution.
3. the method for drafting of ellipse of revolution arc according to claim 2 is characterized in that, among the described step B, comprises following substep:
With described origination data coordinate, original equipment manufacturer coordinate and semi-major axis length, semi-minor axis length substitution elliptic equation ( x - x 2 ) 2 a 2 + ( y - y 2 ) 2 b 2 = 1 , Try to achieve the central coordinate of circle of described standard ellipse, determine the elliptic equation of described standard ellipse.
4. the method for drafting of ellipse of revolution arc according to claim 3 is characterized in that, the central coordinate of circle of described standard ellipse is: x 0 = - D + D 2 - 4 CE 2 C , y 0 = A + B x 0 ; Perhaps, x 0 = - D - D 2 - 4 CE 2 C , y 0=A+Bx 0
Wherein, A = b 2 ( x 2 2 - x 1 2 ) + a 2 ( y 2 2 - y 1 2 ) 2 a 2 ( y 2 - y 1 ) ; B = b 2 ( x 1 - x 2 ) a 2 ( y 2 - y 1 ) ; C=b 2+a 2B 2;D=-2a 2(y 1-A)B-2b 2x 1;E=a 2(y 1-A) 2+b 2x 1 2-a 2b 2
The parameter of described ellipse of revolution arc also comprises: the camber line size indicates, and being used to indicate described ellipse of revolution arc is wide-angle camber line or low-angle camber line; Draw hand designations, the origin-to-destination that is used to indicate described ellipse of revolution arc is a clockwise direction or counterclockwise;
Indicate and described drafting hand designations unique central coordinate of circle of determining described standard ellipse among the described step B according to described camber line size.
5. the method for drafting of ellipse of revolution arc according to claim 2 is characterized in that, among the described step C, comprises following substep:
Origination data coordinate and original equipment manufacturer coordinate according to described ellipse of revolution arc are determined straight line, and this straight line is rotated counterclockwise, and the angle of rotation is the anglec of rotation of this ellipse of revolution arc;
With postrotational straight line under the constant situation of slope, intersect with standard ellipse, the profound length that intersects 2 formations equals the profound length that described ellipse of revolution arc origination data coordinate and original equipment manufacturer coordinate constitute, and described crossing 2 be the conversion starting point and the conversion terminal point of described ellipse of revolution arc correspondence on described standard ellipse.
6. the method for drafting of ellipse of revolution arc according to claim 5, it is characterized in that, equal in the profound length of described intersection point under the condition of the profound length that described ellipse of revolution arc origination data coordinate and original equipment manufacturer coordinate constitute, if the straight line that intersects with described standard ellipse is more than one, then according to the anglec of rotation of described ellipse of revolution arc, select wherein described crossing straight line, unique conversion starting point and conversion terminal point of determining described ellipse of revolution arc correspondence on described standard ellipse.
7. the method for drafting of ellipse of revolution arc according to claim 2 is characterized in that, among the described step D, comprises following substep:
Transformation matrix between described standard ellipse and the described ellipse of revolution is cos ( a ) - sin ( a ) tx sin ( a ) cos ( a ) ty 0 0 1 ;
Wherein, tx is the coordinate figure that moves horizontally, and ty is the coordinate figure of vertical moving, and a is the anglec of rotation of described ellipse of revolution arc;
Described conversion starting point or conversion terminal point are rotated a angle along initial point, obtain postrotational conversion starting point coordinate or postrotational conversion terminal point coordinate, the origination data coordinate or the original equipment manufacturer coordinate of described ellipse of revolution arc are deducted this postrotational conversion starting point coordinate or postrotational conversion terminal point coordinate, obtain the coordinate figure tx that moves horizontally between described standard ellipse and the ellipse of revolution and the coordinate figure ty of vertical moving.
8. the method for drafting of ellipse of revolution arc according to claim 2 is characterized in that, the parameter of described ellipse of revolution arc also comprises: the camber line size indicates, and being used to indicate described ellipse of revolution arc is wide-angle camber line or low-angle camber line; Draw hand designations, the origin-to-destination that is used to indicate described ellipse of revolution arc is a clockwise direction or counterclockwise;
In the step of described definite ellipse of revolution arc each corresponding point coordinate on described standard ellipse, indicate and described drafting hand designations according to the conversion starting point of determining among the standard ellipse of determining among the described step B, the described step C and conversion terminal point, described camber line size, obtain each point coordinate of described ellipse of revolution arc correspondence on described standard ellipse.
CN200910057764.3A 2009-08-18 2009-08-18 Method for drawing rotating elliptical arc Active CN101625765B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN200910057764.3A CN101625765B (en) 2009-08-18 2009-08-18 Method for drawing rotating elliptical arc

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN200910057764.3A CN101625765B (en) 2009-08-18 2009-08-18 Method for drawing rotating elliptical arc

Publications (2)

Publication Number Publication Date
CN101625765A true CN101625765A (en) 2010-01-13
CN101625765B CN101625765B (en) 2015-07-15

Family

ID=41521605

Family Applications (1)

Application Number Title Priority Date Filing Date
CN200910057764.3A Active CN101625765B (en) 2009-08-18 2009-08-18 Method for drawing rotating elliptical arc

Country Status (1)

Country Link
CN (1) CN101625765B (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102724440A (en) * 2011-05-11 2012-10-10 新奥特(北京)视频技术有限公司 Method for realizing object rotation operation in three dimensional scene
CN104217450A (en) * 2014-09-05 2014-12-17 南京航空航天大学 Quick drawing method of any-angle circular arc
CN104715452A (en) * 2013-12-12 2015-06-17 鸿合科技有限公司 Regular prism plane display method and device
CN109903357A (en) * 2019-03-05 2019-06-18 武汉轻工大学 Surface equation method for drafting, device, terminal device and readable storage medium storing program for executing
CN111062181A (en) * 2019-12-25 2020-04-24 成都九芯微科技有限公司 Method for telescopic editing arc in integrated circuit layout
CN113706659A (en) * 2021-08-18 2021-11-26 江苏红豆工业互联网有限公司 Discretization parameter drawing method based on four elliptical arc lines of clothes

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2844387B2 (en) * 1990-11-27 1999-01-06 株式会社ロゼフテクノロジー A fast method for generating elliptical figures in computer graphics
US6100903A (en) * 1996-08-16 2000-08-08 Goettsche; Mark T Method for generating an ellipse with texture and perspective
CN100489898C (en) * 2007-10-30 2009-05-20 深圳市蓝韵实业有限公司 Method for drawing inclined ellipse on computer screen
CN100489899C (en) * 2007-10-30 2009-05-20 深圳市蓝韵实业有限公司 Method for drawing inclined imaginary ellipse on computer screen

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102724440A (en) * 2011-05-11 2012-10-10 新奥特(北京)视频技术有限公司 Method for realizing object rotation operation in three dimensional scene
CN102724440B (en) * 2011-05-11 2015-08-26 北京美摄网络科技有限公司 The method of object rotation process is realized in a kind of three-dimensional scenic
CN104715452A (en) * 2013-12-12 2015-06-17 鸿合科技有限公司 Regular prism plane display method and device
CN104715452B (en) * 2013-12-12 2017-12-15 鸿合科技有限公司 Regular prism plane display method and device
CN104217450A (en) * 2014-09-05 2014-12-17 南京航空航天大学 Quick drawing method of any-angle circular arc
CN104217450B (en) * 2014-09-05 2017-02-22 南京航空航天大学 Quick drawing method of any-angle circular arc
CN109903357A (en) * 2019-03-05 2019-06-18 武汉轻工大学 Surface equation method for drafting, device, terminal device and readable storage medium storing program for executing
CN109903357B (en) * 2019-03-05 2023-04-25 武汉轻工大学 Curve equation drawing method and device, terminal equipment and readable storage medium
CN111062181A (en) * 2019-12-25 2020-04-24 成都九芯微科技有限公司 Method for telescopic editing arc in integrated circuit layout
CN113706659A (en) * 2021-08-18 2021-11-26 江苏红豆工业互联网有限公司 Discretization parameter drawing method based on four elliptical arc lines of clothes
CN113706659B (en) * 2021-08-18 2023-09-19 江苏红豆工业互联网有限公司 Discretization parameter drawing method based on clothing quarter elliptical arc

Also Published As

Publication number Publication date
CN101625765B (en) 2015-07-15

Similar Documents

Publication Publication Date Title
CN101625765B (en) Method for drawing rotating elliptical arc
US9619853B2 (en) GPU-accelerated path rendering
EP3084727B1 (en) Gpu-accelerated path rendering
US9275498B2 (en) GPU-accelerated path rendering
US8698808B2 (en) Conversion of dashed strokes into quadratic Bèzier segment sequences
CN105493151A (en) Prefixed summed length in graphics processing
US20150178961A1 (en) System, method, and computer program product for angular subdivision of quadratic bezier curves
JPH0677265B2 (en) Curve generator
CN103310409A (en) Quick triangle partitioning method of Tile-based rendering architecture central processing unit (CPU)
CN100489898C (en) Method for drawing inclined ellipse on computer screen
Koiso et al. Equilibria for anisotropic surface energies and the Gielis formula
CN103824322A (en) Method and system for interactively creating three-dimensional curve by use of perspective relation
CN107564082B (en) Drawing application system and display method of geometric structure angle and corner mark thereof
CN107085824A (en) A kind of pole view extracting method of threedimensional model
CN109191365B (en) Three-dimensional space handwritten character dimension reduction method based on directed cuboid
CN112562036A (en) Method for drawing configuration system turnout icon by linear polygon
CN102509258B (en) Method for quickly clipping elliptic curve in rectangular window
CN2895097Y (en) Stereo-figure drawing template
CN117473786A (en) Model collision detection method based on multithreading
CN116611991B (en) Processing method and system for drawing complex scene based on GPU
CN109677265B (en) Digital instrument and display method thereof
CN115115799A (en) Method, device, equipment, storage medium and program product for drawing space line
CN102324103A (en) Method for realizing projection transformation of descriptive geometry by utilizing computer
CN108305319A (en) A kind of asymmetric surface of revolution construction method and device
JPH01150989A (en) Graphic display device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CP02 Change in the address of a patent holder
CP02 Change in the address of a patent holder

Address after: 201203 403D 5, 3000 Longdong Avenue, Pudong New Area, Shanghai.

Patentee after: Shanghai Kelu Software Co.,Ltd.

Address before: 201204 No. 9, Lane 299, Bi Sheng Road, Zhangjiang hi tech park, Shanghai

Patentee before: Shanghai Kelu Software Co.,Ltd.

TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20231101

Address after: 201203 north, 2nd floor, No.82, Lane 887, Zuchongzhi Road, Pudong New Area, Shanghai

Patentee after: Shanghai Kelu Software Co.,Ltd.

Patentee after: Shanghai Left Bank Investment Management Co.,Ltd.

Address before: 201203 403D 5, 3000 Longdong Avenue, Pudong New Area, Shanghai.

Patentee before: Shanghai Kelu Software Co.,Ltd.