X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2F3d%2Ftrack.cpp;h=a5c5dbf62a166904a5e3203d28b53af8a637284c;hb=bc8ac89bbe774bb133b758416182aa18e5e0a5a5;hp=3241852f1ed32c606ad8c0dd07ea6a97e34684db;hpb=48dff17ed3144d944965e7cb534e1f8fb92bd620;p=r2c2.git diff --git a/source/3d/track.cpp b/source/3d/track.cpp index 3241852..a5c5dbf 100644 --- a/source/3d/track.cpp +++ b/source/3d/track.cpp @@ -63,6 +63,20 @@ void Track3D::get_bounds(float angle, Point &minp, Point &maxp) const minp.z += slope; } +Point Track3D::get_node() const +{ + const Point &pos = track.get_position(); + Point minp; + Point maxp; + type.get_bounds(0, minp, maxp); + float rot = track.get_rotation(); + float c = cos(rot); + float s = sin(rot); + + Point center((minp.x+maxp.x)/2, (minp.y+maxp.y)/2, 0); + return Point(pos.x+c*center.x-s*center.y, pos.y+s*center.x+c*center.y, pos.z+0.02); +} + void Track3D::render(const GL::Tag &tag) const { GL::PushMatrix push_mat;