CARLA
Toggle main menu visibility
Loading...
Searching...
No Matches
LibCarla
source
osm2odr
Frame.h
Go to the documentation of this file.
1
// Copyright (c) 2026 Computer Vision Center (CVC) at the Universitat Autonoma
2
// de Barcelona (UAB).
3
//
4
// This work is licensed under the terms of the MIT license.
5
// For a copy, see <https://opensource.org/licenses/MIT>.
6
7
#pragma once
8
9
#include <string>
10
11
namespace
twinmodel
{
12
13
/// WGS84 <-> local ENU metres, a transverse Mercator centred on the origin.
14
/// Ported from twinmodel/frame.py, which gets the same projection from pyproj.
15
class
LocalFrame
{
16
public
:
17
18
LocalFrame
() =
default
;
19
20
LocalFrame
(
double
origin_lat,
double
origin_lon)
21
:
_origin_lat
(origin_lat),
_origin_lon
(origin_lon) {}
22
23
static
LocalFrame
FromBoundingBox
(
double
south,
double
west,
double
north,
double
east) {
24
return
LocalFrame
((south + north) * 0.5, (west + east) * 0.5);
25
}
26
27
double
GetOriginLatitude
()
const
{
return
_origin_lat
; }
28
double
GetOriginLongitude
()
const
{
return
_origin_lon
; }
29
30
/// The +proj string written as the OpenDRIVE <geoReference>.
31
std::string
GetProjString
()
const
;
32
33
void
ToLocal
(
double
lon,
double
lat,
double
&x,
double
&y)
const
;
34
void
ToWGS84
(
double
x,
double
y,
double
&lon,
double
&lat)
const
;
35
36
private
:
37
38
double
_origin_lat
= 0.0;
39
double
_origin_lon
= 0.0;
40
};
41
42
}
// namespace twinmodel
twinmodel::LocalFrame::LocalFrame
LocalFrame(double origin_lat, double origin_lon)
Definition
Frame.h:20
twinmodel::LocalFrame::ToWGS84
void ToWGS84(double x, double y, double &lon, double &lat) const
Definition
Frame.cpp:64
twinmodel::LocalFrame::GetProjString
std::string GetProjString() const
The +proj string written as the OpenDRIVE <geoReference>.
Definition
Frame.cpp:26
twinmodel::LocalFrame::GetOriginLongitude
double GetOriginLongitude() const
Definition
Frame.h:28
twinmodel::LocalFrame::GetOriginLatitude
double GetOriginLatitude() const
Definition
Frame.h:27
twinmodel::LocalFrame::_origin_lon
double _origin_lon
Definition
Frame.h:39
twinmodel::LocalFrame::LocalFrame
LocalFrame()=default
twinmodel::LocalFrame::ToLocal
void ToLocal(double lon, double lat, double &x, double &y) const
Definition
Frame.cpp:34
twinmodel::LocalFrame::_origin_lat
double _origin_lat
Definition
Frame.h:38
twinmodel::LocalFrame::FromBoundingBox
static LocalFrame FromBoundingBox(double south, double west, double north, double east)
Definition
Frame.h:23
twinmodel
Definition
Frame.cpp:12
Generated by
1.18.0