17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-02 06:59:13 +01:00

fix(editor): a track bent by its second control vector is drawn bent: the straightening of a straight with control vectors (world/Track.cpp) checked the first vector twice, so with it left along the straight the second one, dragged with the gizmo, changed the data but not the track drawn; now a straight only where both vectors lie along it or aren't given. A track bent by hand into an S between two points dragged is labelled with its length (L 77 m), not with a radius of many kilometres read off it; the "K: split here" by the cursor isn't shown while a point is dragged; Ctrl+Z takes away the warning by the cursor of what it took back (the paths that left the kept design). The tutorial clips of editing recorded again: selecting and fixing without the gizmo (a joint dragged, the warning read, Ctrl+Z), and the new one of editing with the gizmo (Q, a control vector dragged bending the track, W, E)

This commit is contained in:
maj00r
2026-10-25 12:57:23 +01:00
parent a312fd9935
commit 79a8c13586
7 changed files with 15 additions and 5 deletions

View File

@@ -836,9 +836,11 @@ void TTrack::init_segments( bool const Initial ) {
}
// length2 is better than length for comparing because it does not require sqrt function
if( glm::length2((p1 + p1 + p2) / 3.0 - p1 - cp1) < sq(0.02)
|| glm::length2((p1 + p2 + p2) / 3.0 - p2 + cp1) < sq(0.02) ) {
// "prostowanie" prostych z kontrolnymi, dokładność 2cm
// "prostowanie" prostych z kontrolnymi, dokładność 2cm: a straight only where both control vectors lie along it, or aren't
// given; one of them moved off it, the other one left where a straight has it, makes a curve
auto const startalong { cp1 == glm::dvec3() || glm::length2( ( p1 + p1 + p2 ) / 3.0 - p1 - cp1 ) < sq( 0.02 ) };
auto const endalong { cp2 == glm::dvec3() || glm::length2( ( p1 + p2 + p2 ) / 3.0 - p2 - cp2 ) < sq( 0.02 ) };
if( startalong && endalong ) {
cp1 = cp2 = glm::dvec3(0, 0, 0);
}