精度比acos , asin 什么的高些。

Parameters

y
Value representing the proportion of the y-coordinate.
x
Value representing the proportion of the x-coordinate.

If both arguments passed are zero, a domain error occurs.

所以使用前只需排除x=y=0的情况

例子:

/* atan2 example */
#include <stdio.h> /* printf */
#include <math.h> /* atan2 */ #define PI 3.14159265 int main ()
{
double x, y, result;
x = -10.0;
y = 10.0;
result = atan2 (y,x) * / PI;
printf ("The arc tangent for (x=%f, y=%f) is %f degrees\n", x, y, result );
return ;
}

结果:

The arc tangent for (x=-10.000000, y=10.000000) is 135.000000 degrees.

返回值为(-PI,PI]的例子

printf("%lf",atan2(,-)*/PI);

输出:180.000000

计算点与x轴正半轴夹角atan2(double y,double x),返回弧度制(-PI,PI]的更多相关文章

  1. 将坐标转化为与X轴正半轴夹角模板

    //还需加PI 和 mabs 函数 double chg(double x,double y) { double tmps; )<1e-) { ) tmps=90.0; else tmps=27 ...

  2. 将几何画板x轴坐标值换成弧度制的方法

    大家在学习数学的过程中,都会遇到函数,这个时候大家都会遇到函数图像.对于函数图像我们一般都会通过先建立坐标系,然后让图像呈现在坐标系中.函数的种类有很多,三角函数就是其中之一,在绘制三角函数图像时,我 ...

  3. js 把x,y轴两个数组变成[[x,y],[x,y]]的二维数组

    例如有X轴数组xarr=[2006,2007,2008],Y轴数组yarr=[12,15,18],代码如下: //调用 mergexy([2006,2007,2008],[12,15,18]); // ...

  4. matlab画二维直方图以及双y轴坐标如何修改另一边y轴的颜色

    1.首先讲一下如何用hist画二维直方图 x=[- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ...

  5. WPF DevExpress Chart控件多Y轴,指定数据参考的Y轴

    当Chart中有两个及以上的Y轴时,我们就要指明图表中的柱子或折线对应的是哪个Y轴了,这时候需要指明柱子或者折线的dxc:XYDiagram2D.SeriesAxisY属性,来设置对应的Y轴(dxc: ...

  6. TeeChart的X轴为时间,多个Y轴的显示

    最后上代码 public partial class Test : Form { private TChart tChart = new TChart(); ; public Test() { Ini ...

  7. 【BZOJ1185】[HNOI2007]最小矩形覆盖(凸包,旋转卡壳)

    [BZOJ1185][HNOI2007]最小矩形覆盖(凸包,旋转卡壳) 题面 BZOJ 洛谷 题解 最小的矩形一定存在一条边在凸包上,那么枚举这条边,我们还差三个点,即距离当前边的最远点,以及做这条边 ...

  8. 初探FFT(快速傅里叶变换)

    第一次接触省选的知识点呢!zrf大佬在课堂上讲的非常清楚,但由于本蒟蒻实在太菜了,直接掉线了.今天赶紧恶补一下. 那么这篇博客将分为两块,第一块是FFT的推导和实现,第二块则是FFT在OI上的应用 因 ...

  9. Educational Codeforces Round 1 (C) (atan2 + long double | 大数)

    这题只能呵呵了. 东搞西搞,折腾快一天,最后用了一个800多行的代码AC了. 好好的题目你卡这种精度干啥. 还有要卡您就多卡点行不,为什么long double 又可以过... 废了N长时间写个了不管 ...

随机推荐

  1. word如何修改尾注

    两篇处理利用尾注处理参考文献的方式,值得注意. 实用技巧:Word 2003中修改尾注位置http://www.kuqin.com/shuoit/20090422/47316.html Word尾注格 ...

  2. linux下小试redis demo

    先启动  redis-server /etc/redis/redis.conf package com.test; import java.util.ArrayList; import java.ut ...

  3. Nginx常用Rewrite(伪静态规则)WordPress/PHPCMS/ECSHOP/ShopEX/SaBlog/Discuz/DiscuzX/PHPWind/Typecho/DEDECMS

    目前已收集Wordpress.Wordpress二级目录.PHPCMS.ECSHOP.ShopEX.SaBlog.Discuz.Discuz X.PHPWind.Typecho.DEDECMS: Wo ...

  4. [Algorithms] Refactor a Linear Search into a Binary Search with JavaScript

    Binary search is an algorithm that accepts a sorted list and returns a search element from the list. ...

  5. perl学习笔记——输入与输出

    读取标准输入 用<STDIN>进行标准输入:chomp($line=<STDIN>); 如果读到文件尾,行输入操作符就会返回undef.便可利用这一性质跳出循环. while( ...

  6. springboot jpa | mybaits

    一.jpa: 1.jpa可以使用jpaRepository,@query的查询, 当然如果方法命名规范,可以不写sql代码 2.jpa可也使用EntityManager,通过@PersistenceC ...

  7. hdu4930 Fighting the Landlords(模拟 多校6)

    题目链接:pid=4930">http://acm.hdu.edu.cn/showproblem.php? pid=4930 Fighting the Landlords Time L ...

  8. C#操作消息列队

    首先安装消息队列MSMQ,在“计算机管理-服务和应用程序-消息队列-专用队列”中新建列队名称Demo: static void SendAndReceiveMsg() { MessageQueue m ...

  9. slam command tool

    cd imu_ws source devel/setup.bash ls -l /dev |grep ttyUSB sudo chmod /dev/ttyUSB0 rosrun imu_pb imu ...

  10. Linux下基于命令行的抓包方法

    大家可能都已经对著名的抓包工具Ethereal比较熟悉了,这里再介绍一种基于命令行的抓包工具tcpdump. 举例:抓本机1813端口上的数据,并将抓包结果保存在test.cap文件中 然后在本地可以 ...