From: Mikko Rasa Date: Tue, 23 Jul 2013 13:40:35 +0000 (+0300) Subject: Use the tilt member in OrientedPoint in certain objects X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=a2b6ee3a345cb851c98e52608020ba2838326769;p=r2c2.git Use the tilt member in OrientedPoint in certain objects --- diff --git a/source/libr2c2/beamgate.cpp b/source/libr2c2/beamgate.cpp index ad55912..698cb45 100644 --- a/source/libr2c2/beamgate.cpp +++ b/source/libr2c2/beamgate.cpp @@ -57,6 +57,7 @@ void BeamGate::update_attachment() OrientedPoint p = track.point(); position = p.position; rotation = p.rotation; + tilt = p.tilt; } } diff --git a/source/libr2c2/vehicle.cpp b/source/libr2c2/vehicle.cpp index fa44916..17d67b6 100644 --- a/source/libr2c2/vehicle.cpp +++ b/source/libr2c2/vehicle.cpp @@ -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(span).norm()); return p; }