Total Pageviews

Wednesday, April 9, 2014

math.atan2

Math.atan2()
វាត្រូវប្រើសំរាប់ត្រឡប់មកវិញនៅ Arc tangent របស់ y/x នៅក្នុង Radians ប៉ុន្តែត្រូវបានប្រើជា Signs របស់ Parameters ទាំង២ក្នុងការស្វែងរក Quadrant result។ វានឹង Handles correctly of the case X being 0។ លទ្ធផលវានឹង interval [-pi, +pi] នៅក្នុង Radians។ ហ្វាំងសិននេះគឺមានប្រយោជន៏ណាស់នៅពេលបំលែង rectangle coordiates to polar coordinates។ សំរាប់ math.atan2() ប្រើ Sign of both arguments to place the result into the correct quadrant, and also produces correct values when one of its arguments is 0 or very close to 0
Syntax: math.atan2 (y,x)
Y(តំរូវការ) វាជាចំនួនលេខប្រើជាតំណាងឪ្យ Y Coordinate
X(តំរូវការវាជាចំនួនលេខប្រើជាតំណាងឪ្យ X Coordinate

សូមមើលកូដះ
Print (math.atan2 (1,0)) – pi/2
Print (math.atan2 (-1,0)) -- -pi/2
Print (math.atan2 (0,1)) -- 0
Print (math.atan2 (0, -1)) -- pi

No comments:

Post a Comment