CARLA
Loading...
Searching...
No Matches
PlanView.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 <array>
10#include <vector>
11
12#include "Geometry.h"
13
14namespace twinmodel {
15
16 /// A vertex whose rounding would pull the curve further than this off the
17 /// polyline becomes a corner instead; export/xodr.py's MAX_PLANVIEW_OFFSET.
18 constexpr double kMaxPlanViewOffset = 0.25;
19
20 struct Geom {
21 double s = 0.0;
22 double x = 0.0;
23 double y = 0.0;
24 double hdg = 0.0;
25 double length = 0.0;
26 bool is_line = true;
27 /// aU bU cU dU aV bV cV dV, with aU = aV = bV = 0 by construction.
28 std::array<double, 8> coeffs{};
29 };
30
31 /// Fit a polyline as a piecewise cubic paramPoly3 planview. Tangent
32 /// directions are Catmull-Rom, magnitudes the chord length, each segment
33 /// expressed in the frame rotated to its start tangent so hdg stays G1.
34 std::vector<Geom> FitPlanView(const geom::Line3 &line,
35 double max_offset = kMaxPlanViewOffset);
36
37} // namespace twinmodel
std::vector< Point3 > Line3
std::vector< Geom > FitPlanView(const geom::Line3 &line, double max_offset)
Fit a polyline as a piecewise cubic paramPoly3 planview.
Definition PlanView.cpp:102
constexpr double kMaxPlanViewOffset
A vertex whose rounding would pull the curve further than this off the polyline becomes a corner inst...
Definition PlanView.h:18
double length
Definition PlanView.h:25
std::array< double, 8 > coeffs
aU bU cU dU aV bV cV dV, with aU = aV = bV = 0 by construction.
Definition PlanView.h:28