zoukankan      html  css  js  c++  java
  • 已知两点坐标,及在从其中一点开始移动的距离,求移动到的坐标

     //两点间距离  
        double dis = Math.pow(MathUtil.getDistanceSquare(list.get(i + 1).x, list.get(i + 1).y, list.get(i).x, list.get(i).y), 0.5);  
          
        // 计算斜率  
        double kx = (list.get(i + 1).x - list.get(i).x) / dis;  
        double kz = (list.get(i + 1).y - list.get(i).y) / dis;  
          
        //c为在两点间移动的距离  
        c = 2;  
          
        // 计算现在应该到达的距离  
        float x = (float) (list.get(i).x + (dis - (sumD - c)) * kx);  
        float z = (float) (list.get(i).y + (dis - (sumD - c)) * kz);  
          
        p.setX(x);  
        p.setY(nowPosition.getY());  
        p.setZ(z);  
          
        road.setIndex(i);  
          
        return p;
    这个博客主要是javaEE相关或者不相关的记录, hadoop与spark的相关文章我写在下面地址的博客啦~ http://www.cnblogs.com/sorco
  • 相关阅读:
    EasyUI
    EasyUI
    EasyUI
    django MTV架构下的网站开发步骤
    Centos7下安装python3
    python 线程间事件通知
    hadoop MapReduce
    hadoop文件配置
    DataFrame 数据去重
    用selenium获取cookies
  • 原文地址:https://www.cnblogs.com/orco/p/6150487.html
Copyright © 2011-2022 走看看