mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-12-02 11:56:50 +01:00
feat(editor): a curve laid slower than its line, its speed kept with its vertex, the norms asked of it at that speed
The laying traced on the photo (quirky-crafting-summit, Etap 1): a curve seen on the photo sharper than the norms allow at the speed of the line is laid with the speed restricted on it, not refused. - alignment::vertex::speed: the speed its curve is laid for where it's below the design's, 0 the design's; alignment::curve_speed gives it. fit_between and make_cants ask the norms of the curve at it (the least radius, the acceleration across, the transitions, the cant ramps, the shortest arc), the curve_report tells it (speed) and meets_norms judges by it. The geometry is the same. - Kept with the design in the scenery (//$h vertex ... speed <km/h>) and read back. Tests: U: R 300 m on a line of 120 km/h below the norms at it, meeting them laid for 70 km/h; the speed written and read back.
This commit is contained in:
@@ -1186,3 +1186,30 @@ TEST_CASE("alignment: the cant ramp the norms ask for, which a track laid on fro
|
||||
previous = length;
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("alignment: a curve laid slower than the design is checked at its own speed, its cant and transitions asked at it") {
|
||||
// R 300 m on a line of 120 km/h: the norms ask for more than it has; at 70 km/h, as it's laid, they're met
|
||||
auto design{straights({600.0, 600.0}, {50.0 * pi / 180.0}, 120.0)};
|
||||
auto &vertex{design.vertices.front()};
|
||||
vertex.radius = 300.0;
|
||||
auto const slower{alignment::recommend(70.0, 300.0, design.norms)};
|
||||
vertex.cant = slower.cant;
|
||||
vertex.transition_in = vertex.transition_out = slower.transition;
|
||||
auto const fast{alignment::compute(design)};
|
||||
REQUIRE(fast.valid);
|
||||
REQUIRE(fast.curves.size() == 1);
|
||||
CHECK_FALSE(alignment::meets_norms(fast.curves.front(), design));
|
||||
CHECK_FALSE(fast.warnings.empty());
|
||||
vertex.speed = 70.0;
|
||||
CHECK(alignment::curve_speed(design, vertex) == 70.0);
|
||||
auto const slow{alignment::compute(design)};
|
||||
REQUIRE(slow.valid);
|
||||
CHECK(slow.curves.front().speed == 70.0);
|
||||
CHECK(alignment::meets_norms(slow.curves.front(), design));
|
||||
CHECK(slow.warnings.empty());
|
||||
// the geometry is the same, only the speed it's checked at differs
|
||||
CHECK(slow.length == doctest::Approx(fast.length));
|
||||
// a speed above the design's is the design's
|
||||
vertex.speed = 160.0;
|
||||
CHECK(alignment::curve_speed(design, vertex) == 120.0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user