]> git.tdb.fi Git - r2c2.git/commitdiff
Use the tilt member in OrientedPoint in certain objects
authorMikko Rasa <tdb@tdb.fi>
Tue, 23 Jul 2013 13:40:35 +0000 (16:40 +0300)
committerMikko Rasa <tdb@tdb.fi>
Tue, 23 Jul 2013 13:40:35 +0000 (16:40 +0300)
source/libr2c2/beamgate.cpp
source/libr2c2/vehicle.cpp

index ad559120f491c22a45d4c6337bbdce2aab639912..698cb4595ac5fa1091993ad78842b855ee9ca0c6 100644 (file)
@@ -57,6 +57,7 @@ void BeamGate::update_attachment()
                OrientedPoint p = track.point();
                position = p.position;
                rotation = p.rotation;
+               tilt = p.tilt;
        }
 }
 
index fa44916a19b56cdc5bc5919026917c514994635c..17d67b666a28a49ae73822f82e91aec6162db1b1 100644 (file)
@@ -204,6 +204,7 @@ void Vehicle::update_position()
        position = p.position;
        position.z += layout.get_catalogue().get_rail_elevation();
        rotation = p.rotation;
+       tilt = p.tilt;
        signal_moved.emit();
 }
 
@@ -378,6 +379,7 @@ OrientedPoint Vehicle::get_point(const Vector &front, const Vector &back, float
        OrientedPoint p;
        p.position = back+span*ratio;
        p.rotation = Geometry::atan2(span.y, span.x);
+       p.tilt = Geometry::atan2(span.z, LinAl::Vector<float, 2>(span).norm());
 
        return p;
 }