Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
A Christmas puzzle
Message
De
24/12/2003 13:13:34
Jay Johengen
Altamahaw-Ossipee, Caroline du Nord, États-Unis
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00861878
Message ID:
00861969
Vues:
22
Must have missed something... All I get for output is:
(0,0)
(8.660254037844387,-4.999999999999999)
(10,-10)
(5.000000000000001,-8.660254037844386)

(0,0)
(7.071067811865476,-7.071067811865475)
(10,-10)
(-10,-10)
(-8.660254037844387,-4.999999999999999)

(0,0)
(5.000000000000001,8.660254037844386)
(10,10)
(10,-10)
(1.736481776669304,-9.84807753012208)

(0,0)
(-10,-0.000000000000001)
(-10,10)
(-5.000000000000004,8.660254037844384)
>I think you may be doing too much work with that code. If I understand the question correctly, then all that's need is a polygon that contains the part of the 'donut' between angle 1 and angle 2, and no other part of the donut. The poly doesn't need to match the shape of the arcs.
>
>I'm assuming that the procedure is going to be to XOR the large circle with the small circle to get the donut region, and then AND that result with the polygon. So the shape of the polygon outside the donut area doesn't matter.
>
>
>CLEAR
>PrintCoords(30,60,10)
>PrintCoords(45,150,10)
>PrintCoords(300,80,10)
>PrintCoords(180,240,10)
>
>* params are the starting and ending angle in degrees,
>* and the radius of the larger circle.
>* this code assumes that the distance from angle1 to angle2 is not more than 180 deg.
>FUNCTION PrintCoords( tnAngle1, tnAngle2, tnRadius )
>
>DIMENSION aCoords[6,2]
>LOCAL nPoints
>nPoints = 4
>
>aCoords[1,1] = 0
>aCoords[1,2] = 0
>aCoords[2,1] = COS(DTOR(tnAngle1)) * tnRadius
>aCoords[2,2] = -SIN(DTOR(tnAngle1)) * tnRadius
>aCoords[3,1] = IIF( tnAngle1 >= 90 AND tnAngle1 < 270, -tnRadius, tnRadius )
>aCoords[3,2] = IIF( tnAngle1 < 180, -tnRadius, tnRadius )
>
>IF INT(tnAngle1/90) # INT(tnAngle2/90)
>	nPoints = 5
>	aCoords[4,1] = IIF( tnAngle1 < 180, -tnRadius, tnRadius )
>	aCoords[4,2] = IIF( tnAngle1 >= 270 OR tnAngle1 < 90, -tnRadius, tnRadius )
>	IF ( INT(tnAngle1/90) + 1 ) % 4 # INT(tnAngle2/90)
>		nPoints = 6
>		aCoords[5,1] = IIF( tnAngle1 >= 90 AND tnAngle1 < 270, tnRadius, -tnRadius )
>		aCoords[5,2] = IIF( tnAngle1 < 180, tnRadius, -tnRadius )
>	ENDIF
>ENDIF
>
>aCoords[nPoints,1] = COS(DTOR(tnAngle2)) * tnRadius
>aCoords[nPoints,2] = -SIN(DTOR(tnAngle2)) * tnRadius
>
>FOR ii = 1 TO nPoints
>	? "(" + TRANSFORM(aCoords[ii,1]) + "," + TRANSFORM(aCoords[ii,2]) + ")"
>ENDFOR
>? ""
>
>ENDFUNC
>
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform