17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-03 00:26:22 +01:00

refactor(editor): the joints check is a tool of its own

The third tool out of editor_mode. It reaches the terrain model and the
places of the tracks on it through the services, the place of a track
for the terrain model is a type of its own now, and the laying and the
switches ask the tool for the kink it allows. A self-test command can
ask to be run again in the next frame, as the check against the terrain
model does while the model comes in.
This commit is contained in:
maj00r
2026-10-21 09:23:36 +02:00
parent 0c2880f48f
commit 8ba8345faf
10 changed files with 232 additions and 163 deletions

View File

@@ -583,7 +583,7 @@ bool editor_mode::plan_switch_link(switch_link &Plan) const
}
if (shape.length > line.length - 0.02)
return false;
auto const kink{glm::radians(m_joints.angle * 0.5)};
auto const kink{glm::radians(m_joints.kink_angle() * 0.5)};
auto const plan = [&](double const Along) {
Plan.along = Along;
Plan.paths = place(Along);
@@ -643,7 +643,7 @@ bool editor_mode::plan_branch_link(editor_track::branch_link &Link, std::string
return false;
auto const &diverging{tool.track->m_paths[1]};
auto const radius{editor_track::branch_radius(diverging)};
Link = editor_track::link_branch(branch_start(diverging), radius, branch_target(target), glm::radians(m_joints.angle * 0.5),
Link = editor_track::link_branch(branch_start(diverging), radius, branch_target(target), glm::radians(m_joints.kink_angle() * 0.5),
editor_track::reverse_insert(std::min(editor_track::diverging_speed(radius), design_speed(tool.track, target.track))), stretchable(target));
Reason = link_problem(target, Link);
return Reason.empty();