zoukankan      html  css  js  c++  java
  • 2个点之间的旋转

    编辑器加载中...

     1 float WGDragLine::PointRotate(CCPoint p1,CCPoint p2)
    2 {
    3 float x;
    4 float ix,iy;
    5 ix = p1.x - p2.x;
    6 iy = p1.y - p2.y;
    7 if (ix >= 0 && iy < 0) {
    8 if (ix == 0) {
    9 x= 270;
    10 } else {
    11 iy *= -1;
    12 x = 180 + (float) (atan(iy / ix) * 180 / (float)(M_PI));
    13 }
    14 } else if (ix > 0 && iy >= 0) {
    15 if (iy == 0) {
    16 x = 180;
    17 } else {
    18 x = 90+(float) ( atan(ix / iy) * 180 / (float)(M_PI));
    19 }
    20 } else if (ix <= 0 && iy > 0) {
    21 if (ix == 0) {
    22 x = 90;
    23 } else {
    24 ix *= -1;
    25 x = (float) ( atan(iy / ix) * 180 / (float)(M_PI));
    26 }
    27 } else {
    28 if (iy == 0) {
    29 x = 0;
    30 } else {
    31 ix *= -1;
    32 iy *= -1;
    33 x = 270 + (float) ( atan(ix / iy) * 180 / (float)(M_PI));
    34 }
    35 }
    36 return x;
    37 }
  • 相关阅读:
    直方图均衡
    k-means聚类方法
    核函数
    支持向量机(SVM)
    函数的定义和调用
    ES5新增方法
    继承
    构造函数和原型
    面向对象版tab 栏切换
    ES6中的对象与类
  • 原文地址:https://www.cnblogs.com/GameDeveloper/p/2320711.html
Copyright © 2011-2022 走看看