Math Atan2
Return the angle whose tangent is the quotient of the two specified numbers.
Syntax
Atan2 ( float y, float x ) |
Parameters
x | float | The x coordinate of a point |
y | float | The y coordinate of a point |
Return Values
An angle, measured in the unit specified in SetAngleUnits, where (x, y) is a point in the Cartesian plane. |
Copy
Example
----- This will display the inverse tangent value of theta angle by using Atan2 command
--Millimeters mode used
SetUnits(Units.Millimeters)
--Set angle units
SetAngleUnits(AngleUnits.Radians)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200
--Assign value to theta
theta = 45
--Returns theta in to radians
thetaRad = Math.Rad(theta)
--Sin value of angle theta
sinTheta = Math.Sin(thetaRad)
--Cos value of angle theta
cosTheta = Math.Cos(thetaRad)
--Inverse Tangent value in radians
Report("Theta is "..Math.Atan2(sinTheta,cosTheta))