#include <iostream>      /* puts, printf */
#include <time.h> /* time_t, struct tm, time, localtime */
#include <math.h> using namespace std;
struct Position{
double x;
double y;
double z;
};
struct Orientation{
double w;
double x;
double y;
double z;
};
struct point{
Position position;
Orientation orientation;
}; double getdistance(point cur,point des){
return sqrt(pow((cur.position.x-des.position.x),)+pow((cur.position.y-des.position.y),));
} point getdes(){
point des;
des.position.x=-8.75;
des.position.y=-10.93;
des.position.z=0.0;
des.orientation.w=0.0;
des.orientation.x=0.0;
des.orientation.y=0.0;
des.orientation.z=0.0;
return des;
} point getcur(){
point cur;
cur.position.x=-4.95;
cur.position.y=-2.07;
cur.position.z=0.0;
cur.orientation.w=0.25;
cur.orientation.x=0.0;
cur.orientation.y=0.0;
cur.orientation.z=0.97;
return cur;
} point getclosest(point cur){
//获取会车点
point des;
des=getdes();
//获取距离当前位置最近的会车点
double distance=getdistance(cur,des);
char* s="huichedian";
printf("距离最近的会车点是%s,距离为:%lf\n",s,distance);
return des;
}
int main ()
{
//当前位置
point cur,closest;
cur=getcur();
closest=getclosest(cur); return ;
}

c++ ros 计算两点距离的更多相关文章

  1. 计算两点距离 ios

    //计算两点距离 -(float)distanceBetweenTwoPoint:(CGPoint)point1 point2:(CGPoint)point2 { ) + powf(point1.y ...

  2. 【百度地图API】如何根据摩卡托坐标进行POI查询,和计算两点距离

    原文:[百度地图API]如何根据摩卡托坐标进行POI查询,和计算两点距离 摘要: 百度地图API有两种坐标系,一种是百度经纬度,一种是摩卡托坐标系.在本章你将学会: 1.如何相互转换这两种坐标: 2. ...

  3. js根据经纬度计算两点距离

    js版-胡老师 google.maps.LatLng.prototype.distanceFrom = function(latlng) {    var lat = [this.lat(), lat ...

  4. NX二次开发-UFUN计算两点距离UF_VEC3_distance

    NX11+VS2013 #include <uf.h> #include <uf_curve.h> #include <uf_vec.h> UF_initializ ...

  5. mySQL函数根据经纬度计算两点距离

    DROP FUNCTION IF EXISTS func_calcDistance ; CREATE FUNCTION func_calcDistance( origLng ,), -- 目的地经度 ...

  6. [UE4]计算两点距离

    (Vector-Vector).VectorLength (Vector_End- Vector_Start ).Normalize,获取从起始位置指向目标位置的单位向量.

  7. mySQL函数根据经纬度计算两点距离 复制代码

    http://www.cnblogs.com/lujiulong/p/6185041.html https://my.oschina.net/u/2273085/blog/505172?p={{pag ...

  8. Skill 计算两点距离

    https://www.cnblogs.com/yeungchie/ code procedure(ycHowFar(a b) prog((xAB yAB sAB) xAB = xCoord(a) - ...

  9. php根据地球上任意两点的经纬度计算两点间的距离 原理

    地球是一个近乎标准的椭球体,它的赤道半径为6378.140千米,极半径为6356.755千米,平均半径6371.004千米.如果我们假设地球是一个完美的球体,那么它的半径就是地球的平均半径,记为R.如 ...

随机推荐

  1. RabbitMQ的应用场景

    进入正题. 一.异步处理 场景:发送手机验证码,邮件 传统古老处理方式如下图 这个流程,全部在主线程完成,注册->入库->发送邮件->发送短信,由于都在主线程,所以要等待每一步完成才 ...

  2. .NET 对文件和文件夹操作的介绍

    1 Directory和File类只包含静态方法,不能被实例化 2 DirectoryInfo和FileInfo他们是有状态的,需要被实例化 //构造函数初始化一个文件的路径 FileInfo myF ...

  3. java判定数据(对象)类型

    1.说明一 int 是关键字,Integer是包装类,Number是所有数字了的基类(父类).所以,Number是Integer的基础,Integer是int的基础,也称Integer是int的原型类 ...

  4. __init__、__new__方法详解

    __init__详解 class Dog(object): def __init__(self): print('init方法') def __del__(self): print('del方法') ...

  5. centos6.x下让redis以服务方式运行

    1.从官网下载redis-2.8.9.tar.gz之后,将redis解压在/usr/local下,目录是redis-2.8.9,然后按照官网给出的办法安装redis即可. 2.安装完在redis-2. ...

  6. SQL SERVER-JOB搬迁脚本

    选中JOB,按F7打开对象游览器: 选中相应的JOB,生成脚本. 搬迁JOB,新实例上要有相应的DB和操作员. 脚本中有2个@enabled,一个是job enable,一个是schedule是否生效 ...

  7. Linux 之 压缩解压缩

    Linux中常见的压缩格式 .zip            .gz             .bz2           .tar.gz      tar.bz2 zip zip格式的压缩文件和win ...

  8. linux 的GUNB修复问题

    1.意外断电,kali linux 虚拟机没有正常关机的时候 , 突然断电之后重启电脑之后,kali linux 直接黑屏了无法进入系统.如下面的界面 光标一直在闪烁. 这里可以使用 快捷键 同时按住 ...

  9. 在Linux中安装适用于arm64位的nodejs

    # 安装适用于arm64位的nodejs runtime v10.16.3 mkdir /runtimes cd /runtimes wget https://nodejs.org/dist/v10. ...

  10. python中的函数、生成器的工作原理

    1.python中函数的工作原理 def foo(): bar() def bar(): pass python的解释器,也就是python.exe(c编写)会用PyEval_EvalFramEx(c ...