-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathgeo_transforms.cpp
More file actions
55 lines (48 loc) · 2.01 KB
/
geo_transforms.cpp
File metadata and controls
55 lines (48 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
* This file is part of the CoverageControl library
*
* Author: Saurav Agarwal
* Contact: [email protected], [email protected]
* Repository: https://github.com/KumarRobotics/CoverageControl
*
* Copyright (c) 2024, Saurav Agarwal
*
* The CoverageControl library is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* The CoverageControl library is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* CoverageControl library. If not, see <https://www.gnu.org/licenses/>.
*/
#include <CoverageControl/geographiclib_wrapper.h>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <random>
#include <string>
#include <GeographicLib/LocalCartesian.hpp>
int main(int argc, char** argv) {
CoverageControl::GeoLocalTransform geo_transform(40.74050005471615,
-74.1759877275644, 0);
auto lla = geo_transform.Reverse(100, 100, 0);
std::cout << "lat: " << lla[0] << std::endl;
std::cout << "lon: " << lla[1] << std::endl;
std::cout << "hgt: " << lla[2] << std::endl;
auto xyz = geo_transform.Forward(lla[0], lla[1], lla[2]);
std::cout << "x: " << xyz[0] << std::endl;
std::cout << "y: " << xyz[1] << std::endl;
std::cout << "z: " << xyz[2] << std::endl;
GeographicLib::LocalCartesian geo_transform1(40.74050005471615,
-74.1759877275644);
geo_transform1.Forward(lla[0], lla[1], lla[2], xyz[0], xyz[1], xyz[2]);
std::cout << "x: " << xyz[0] << std::endl;
std::cout << "y: " << xyz[1] << std::endl;
std::cout << "z: " << xyz[2] << std::endl;
return 0;
}