Radians to degrees conversions

Started by RWSurvey, June 17, 2011, 06:46:06 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

RWSurvey

Here are a couple handi items to add to your Constants.d3i file. Multiply by the appropriate constant to convert ***Decimal*** degrees to radians or radians to ***decimal*** degrees. Note that they do not work with degrees in the DMS (Degrees, Minutes, Seconds) format.

alias R2D      57.2957795130823    '180/pi   DEG = RAD x 180/pi
alias D2R      0.01745329251994    'pi/180   RAD = DEG x pi/180

To use simply multiply by the appropriate constant value:

deg = rad * R2D

or

rad = deg * D2R

Rob S

#1
Cool, I did not know one could even add to that file!!  Upon checking further, I don't even have such a file anyplace I can find it???

However, probably not too many of us even know or have any need to remember what a radian is   ???

Long time ago someone put me on to an amazing little program called convert.exe, converts anything to just about anything else!!  For anyone who doesn't have it:

http://wscope.com/convert.htm

Unfortunately dirt to gold is not one of the built-in conversions  ;D
User since forever

Pearco

Rob;

Aww Man. You had my hopes up for a moment.
Jim
User since ProDesign 1.5

Bob P

Is constants.d3i strictly a V21 file, or am I missing something from my earlier versions?

Rob S

I guess I took his word for it that there was such a file to edit, I don't have one either, maybe you just create one???

RWSurvey, you'll have to chime back in here!!!
User since forever

DrollTroll

It's a file YOU can create, and YOU can Include in your macros, but there's nothing "built-in".

Or you can simply define the aliases he's described directly in your macros without need for Include.
25 years with DesignCAD

RWSurvey

Well said DT! Three files I have are the aliases.d3i, Constants.d3i and Units.d3i. Include them in your program or just copy the relevant portions to your program.

Has anyone got a Decimal to Sexigismal angle converter written? Before you get your hopes up that would be from decimal degrees to degrees, minutes, seconds and the reverse.

Bob P

That converter is relatively easy.  No text converter necessary.

Here's the math (I think - haven't checked it yet...) without the correct input/output code.

What angle in decimal-degrees format? ddecimal
deg=int(ddecimal)
min=int((ddecimal-deg)*60)
sec=int((ddecimal-deg-min/60)*3600)