c++ ros 计算两点距离
#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 计算两点距离的更多相关文章
- 计算两点距离 ios
//计算两点距离 -(float)distanceBetweenTwoPoint:(CGPoint)point1 point2:(CGPoint)point2 { ) + powf(point1.y ...
- 【百度地图API】如何根据摩卡托坐标进行POI查询,和计算两点距离
原文:[百度地图API]如何根据摩卡托坐标进行POI查询,和计算两点距离 摘要: 百度地图API有两种坐标系,一种是百度经纬度,一种是摩卡托坐标系.在本章你将学会: 1.如何相互转换这两种坐标: 2. ...
- js根据经纬度计算两点距离
js版-胡老师 google.maps.LatLng.prototype.distanceFrom = function(latlng) { var lat = [this.lat(), lat ...
- NX二次开发-UFUN计算两点距离UF_VEC3_distance
NX11+VS2013 #include <uf.h> #include <uf_curve.h> #include <uf_vec.h> UF_initializ ...
- mySQL函数根据经纬度计算两点距离
DROP FUNCTION IF EXISTS func_calcDistance ; CREATE FUNCTION func_calcDistance( origLng ,), -- 目的地经度 ...
- [UE4]计算两点距离
(Vector-Vector).VectorLength (Vector_End- Vector_Start ).Normalize,获取从起始位置指向目标位置的单位向量.
- mySQL函数根据经纬度计算两点距离 复制代码
http://www.cnblogs.com/lujiulong/p/6185041.html https://my.oschina.net/u/2273085/blog/505172?p={{pag ...
- Skill 计算两点距离
https://www.cnblogs.com/yeungchie/ code procedure(ycHowFar(a b) prog((xAB yAB sAB) xAB = xCoord(a) - ...
- php根据地球上任意两点的经纬度计算两点间的距离 原理
地球是一个近乎标准的椭球体,它的赤道半径为6378.140千米,极半径为6356.755千米,平均半径6371.004千米.如果我们假设地球是一个完美的球体,那么它的半径就是地球的平均半径,记为R.如 ...
随机推荐
- Spring Cloud Alibaba学习笔记(9) - RocketMQ安装与RocketMQ控制台
搭建RocketMQ 系统环境准备 64位操作系统,推荐使用Linux.Unix.MacOS 64位 JDK1.8+ Maven 3.2.x 适用于Broker服务器的4g +可用磁盘 下载与搭建 下 ...
- Spark机器学习基础-监督学习
监督学习 0.线性回归(加L1.L2正则化) from __future__ import print_function from pyspark.ml.regression import Linea ...
- Suricata Rules
Suricata Rules https://redmine.openinfosecfoundation.org/projects/suricata/wiki/Suricata_Rules https ...
- Go 实现短 url 项目
首先说一下这种业务的应用场景: 把一个长 url 转换为一个短 url 网址 主要用于微博,二维码,等有字数限制的场景 主要实现的功能分析: 把长 url 地址转换为短 url 地址 通过短 url ...
- elementui限制开始日期和结束日期
项目需求:开始日期和结束日期 禁用当前日期之前的日期.同时结束日期 禁用开始日期之前的日期 <div class='startTime'> 开始时间:<el-date-picker ...
- vue使用阿里矢量图标
官方注册注册 1.加入购物车 在阿里矢量图标库将想要的图标加入购物车,然后在购物车中将图标添加到项目: 2.下载 到我的项目中,将图标下载到本地 3.解压引入 在vue项目的asset ...
- C++ 解决文件重复包含
// 如果zzz没有定义就定义zzz,然后执行下面的代码,定义了就不执行 #if !defined(zzz) #define zzz struct PPoint { int x; int y; }; ...
- nginx 作为静态资源web服务
Nginx作为静态资源web服务 静态资源web服务-CDN场景 Nginx资源存储中心会把静态资源分发给“北京Nginx”,“湖南Nginx”,“山东Nginx”. 然后北京User发送静态资源请求 ...
- MySql 学习之 一条查询sql的执行过程
相信大家都接触过Mysql数据库,而且也肯定都会写sql.我不知道大家有没有这样的感受,反正我是有过这样的想法.就是当我把一条sql语句写完了,并且执行完得到想要的结果.这时我就在想为什么我写这样的一 ...
- Java中异常关键字throw和throws使用方式的理解
Java中应用程序在非正常的情况下停止运行主要包含两种方式: Error 和 Exception ,像我们熟知的 OutOfMemoryError 和 IndexOutOfBoundsExceptio ...