17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-18 05:39:19 +02:00

feat(editor): track gizmo rings along the track: direction, grade and cant

The rotate gizmo stands along the track. The cross ring changes the grade about the middle or the selected
end, the joined tracks take the grade at the joints; the ring along the track changes the cant of the track
or of the selected end, the joined tracks take it at the joints and ramp it. On a control vector the cross
ring tilts it up or down. Ctrl steps by 5 degrees, 1 per mille, 5 mm.
This commit is contained in:
maj00r
2026-10-11 13:22:47 +02:00
parent b486eb33d5
commit a756beb34b
6 changed files with 225 additions and 26 deletions

View File

@@ -665,6 +665,19 @@ void editor_track::follow(TTrack const &Track, std::vector<joint> const &Joints)
}
}
void editor_track::follow_grade(TTrack const &Track, std::vector<joint> const &Joints)
{
for (auto const &joint : Joints)
{
if (joint.own.path >= static_cast<int>(Track.m_paths.size()) || joint.theirs.path >= static_cast<int>(joint.other->m_paths.size()))
continue;
geometry::bezier const own{Track.m_paths[joint.own.path]};
auto const outward{joint.own.kind == point_kind::start ? -own.first(0.0) : own.first(1.0)};
auto &control{joint.other->m_paths[joint.theirs.path].points[joint.theirs.kind == point_kind::start ? segment_data::point::control1 : segment_data::point::control2]};
control.y = geometry::grade_of(outward) * glm::length(geometry::plan_of(control));
}
}
std::vector<int> editor_track::hold_controls(TTrack &Track)
{
std::vector<int> result;