Tech Tip: Working with Degrees and Radians
PRODUCT: 4D | VERSION: 12 | PLATFORM: Mac & Win
Published On: February 10, 2011
If the occasion arises that there is a need to do a little bit of trigonometry in 4D, it is handy to know to be able to use 4D functions with angle measurements in degrees. This is important because for the 4D functions Arctan, Cos, Sin, and Tan the measurement of angles is in Radians .
So the necessity is to change the common angle measurements in degrees to radians.
4D provides the predefined constants Pi, Degree, and Radian. Pi returns the Pi number (3.14159...), Degree returns one degree expressed in radians (0.01745...), and Radian returns one radian expressed in degrees (57.29577...). With the constants Degree and Radian the conversion between the two different angular measurement can be made quite easily:
AngleInRadians := AngleInDegrees * Degree AngleInDegrees := AngleInRadians / Degree |
So to solve Pythagorean theorem for a right triangle of a^2 + b^2 = c^2 in 4D is like this:
If you know the angle, theta (θ), in degrees, of a right triangle and the length of the hypotenuse (C) you can get the length of sides X and Y:
X := (C * Cos( θ * Degree )) Y := (C * Sin( θ * Degree )) |
or you know the values of X and Y you can determine the angle Ø, in degrees, and length of the hypotenuse (C):
C := Square root(( X^2 )+( Y^2 )) θ := Arctan(( Y/X ))/Degree |