Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Divide a number
Message
De
03/02/1999 21:50:28
 
 
À
24/01/1999 09:31:35
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00179550
Message ID:
00183744
Vues:
19
Hi Cetin,

Thanks for the reply. Sorry, for the late reply. I think that I have the answer to my problem. Your example and Marc's helped me arrive at this solution.

Thanks

#DEFINE STEPDIST .01
* Calculate the step angle...
lnStepAngle = RTOD(ATAN((STEPDIST/lnRadius)/2))

* Make sure it is divided evenly into the arc
lnArcDist = lnArcEnd - lnArcOrig
lnCalcStep = lnArcDist / lnStepAngle
IF (INT(lnCalcStep) - lnCalcStep) <> 0
lnStepAngle = ROUND(lnStepAngle, 3)
DO WHILE (INT(lnCalcStep) - lnCalcStep) <> 0
lnStepAngle = lnStepAngle - .001
lnCalcStep = lnArcDist / lnStepAngle
ENDDO
ENDIF

>>I need to figure out how to divide a number and not have a remainder. I can decrease the divisor by small amounts until it will go evenly. I would like to stay within 6 decmil places. The number I divide will between 0.000001 and 360.000000. The divisor will always be less than 1/4 of the number being divided.
>>
>>For example my arc is 360.000000 degrees and the angle is 10.00000. This will give me exactly 36 steps for the circle. So if I have an arc of 360.000000 and an angle of 2.347678 I get 153.343005 steps. If I round the steps to 153 I get 2.352941 degrees per step. If I then multiply the step angle by the steps I get less than 360 degrees which is the final angle. The step angle must end up at he final angle exactly.
>>
>>360.000000 / 2.347678 = 153.343005 Steps
>>360.000000 / 153 = 2.352941 Degrees per step
>>153 * 2.352941 = 359.999973 Final angle
>>
>>Thanks for any help
>
lnArc = 360.000000
>lnDegree = 2.347678
>lnSteps = ceiling(lnArc / lnDegree)
>for ix = 1 to lnSteps
>  lnThisAngle = min(ix*lnDegree, lnArc)
>endfor
Cetin
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform