]> git.tdb.fi Git - r2c2.git/commitdiff
Rename Point to Vector
authorMikko Rasa <tdb@tdb.fi>
Tue, 8 Mar 2011 11:31:05 +0000 (11:31 +0000)
committerMikko Rasa <tdb@tdb.fi>
Tue, 8 Mar 2011 11:31:05 +0000 (11:31 +0000)
37 files changed:
source/3d/axle.cpp
source/3d/bogie.cpp
source/3d/catalogue.cpp
source/3d/endpoint.cpp
source/3d/object.h
source/3d/overlay.cpp
source/3d/rod.cpp
source/3d/track.cpp
source/3d/track.h
source/3d/tracktype.cpp
source/3d/tracktype.h
source/3d/vehicle.cpp
source/3d/vehicle.h
source/designer/cameracontroller.cpp
source/designer/designer.cpp
source/designer/designer.h
source/designer/manipulator.cpp
source/designer/manipulator.h
source/designer/measure.cpp
source/designer/measure.h
source/designer/svgexporter.cpp
source/designer/trackwrap.cpp
source/engineer/engineer.cpp
source/engineer/trainview.cpp
source/libr2c2/catalogue.cpp
source/libr2c2/geometry.h
source/libr2c2/profile.cpp
source/libr2c2/profile.h
source/libr2c2/track.cpp
source/libr2c2/track.h
source/libr2c2/trackpart.cpp
source/libr2c2/trackpart.h
source/libr2c2/tracktype.h
source/libr2c2/vehicle.cpp
source/libr2c2/vehicle.h
source/libr2c2/vehicletype.cpp
source/libr2c2/vehicletype.h

index 5123106e5c805f8736292d7996ec47d7f97080c6..2da94b992764b4caf47e6595270cd2d07effb398 100644 (file)
@@ -41,7 +41,7 @@ void Axle3D::setup_render(GL::Renderer &renderer, const GL::Tag &) const
 {
        GL::Matrix matrix;
 
-       const Point &pos = vehicle.get_position();
+       const Vector &pos = vehicle.get_position();
        matrix.translate(pos.x, pos.y, pos.z);
        matrix.rotate(vehicle.get_direction(), 0, 0, 1);
 
index 234bd88a403559b795db56f86ae655064ef31296..03f7dce255c3291192079559b02a13796fabde8c 100644 (file)
@@ -33,7 +33,7 @@ void Bogie3D::setup_render(Msp::GL::Renderer &renderer, const GL::Tag &) const
 {
        GL::Matrix matrix;
 
-       const Point &pos = vehicle.get_position();
+       const Vector &pos = vehicle.get_position();
        matrix.translate(pos.x, pos.y, pos.z);
        matrix.rotate(vehicle.get_direction(), 0, 0, 1);
 
index 6cb7558157eb4c3339354b162d4b4fc8e14a92a7..3f3aa6cfd1590632fb7f2be3f48873ced9e63644 100644 (file)
@@ -78,12 +78,12 @@ void Catalogue3D::vehicle_added(const VehicleType &veh)
 void Catalogue3D::build_endpoint_mesh()
 {
        const Profile &ballast_profile = catalogue.get_ballast_profile();
-       const Point &ballast_min = ballast_profile.get_min_coords();
-       const Point &ballast_max = ballast_profile.get_max_coords();
+       const Vector &ballast_min = ballast_profile.get_min_coords();
+       const Vector &ballast_max = ballast_profile.get_max_coords();
 
        const Profile &rail_profile = catalogue.get_rail_profile();
-       const Point &rail_min = rail_profile.get_min_coords();
-       const Point &rail_max = rail_profile.get_max_coords();
+       const Vector &rail_min = rail_profile.get_min_coords();
+       const Vector &rail_max = rail_profile.get_max_coords();
 
        float gauge = catalogue.get_gauge();
 
index 23bd20f130653966cacab27a85f49af42ea9f176..5b7f8104f808dee56d30304e747597c6bd121d68 100644 (file)
@@ -34,7 +34,7 @@ void Endpoint3D::render(GL::Renderer &renderer, const GL::Tag &tag) const
 {
        if(tag=="unlit")
        {
-               Point p = track.get_track().get_endpoint_position(index);
+               Vector p = track.get_track().get_endpoint_position(index);
                float a = track.get_track().get_endpoint_direction(index)+M_PI;
 
                GL::MatrixStack::Push push_mtx(renderer.matrix_stack());
index a9ac7156f6e8af3cc864637b3c21590c5dafb708..3da0cf3a03a31de6397fe8e659f5c33b1778cab0 100644 (file)
@@ -19,7 +19,7 @@ protected:
 public:
        virtual ~Object3D() { }
 
-       virtual Point get_node() const = 0;
+       virtual Vector get_node() const = 0;
        virtual bool is_visible() const = 0;
 };
 
index 5b251b653af6514945dc65d3111562ad9abce8d2..ed413cd4f943cb59e7dbaed00481889d8363b230 100644 (file)
@@ -104,7 +104,7 @@ void Overlay3D::render(const GL::Tag &tag) const
 
                        const Icon &icon = *i->second;
 
-                       Point node = i->first->get_node();
+                       Vector node = i->first->get_node();
                        GL::Vector3 p = camera.project(GL::Vector3(node.x, node.y, node.z));
 
                        GL::PushMatrix push_mat;
index 26d000d313afd67fe345a02bf20a716529322f1c..86a6a9cf95d434a6873cabb4607c90b65dc1b9c4 100644 (file)
@@ -32,7 +32,7 @@ void Rod3D::render(GL::Renderer &renderer, const GL::Tag &tag) const
 void Rod3D::setup_render(GL::Renderer &renderer, const GL::Tag &) const
 {
        GL::Matrix matrix;
-       const Point &pos = vehicle.get_position();
+       const Vector &pos = vehicle.get_position();
        matrix.translate(pos.x, pos.y, pos.z);
        matrix.rotate(vehicle.get_direction(), 0, 0, 1);
 
index 5d31a4de93294f1c2ec46b815ad804aa09767c3b..8b36b194220c0c3175da4c322e9b846e5112b656 100644 (file)
@@ -55,14 +55,14 @@ Track3D::~Track3D()
                delete *i;
 }
 
-void Track3D::get_bounds(float angle, Point &minp, Point &maxp) const
+void Track3D::get_bounds(float angle, Vector &minp, Vector &maxp) const
 {
        type.get_bounds(angle-track.get_rotation(), minp, maxp);
 
        float c = cos(-angle);
        float s = sin(-angle);
 
-       const Point &pos = track.get_position();
+       const Vector &pos = track.get_position();
        minp.x += c*pos.x-s*pos.y;
        maxp.x += c*pos.x-s*pos.y;
        minp.y += s*pos.x+c*pos.y;
@@ -77,23 +77,23 @@ void Track3D::get_bounds(float angle, Point &minp, Point &maxp) const
                minp.z += slope;
 }
 
-Point Track3D::get_node() const
+Vector Track3D::get_node() const
 {
-       const Point &pos = track.get_position();
-       Point minp;
-       Point maxp;
+       const Vector &pos = track.get_position();
+       Vector minp;
+       Vector 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);
+       Vector center((minp.x+maxp.x)/2, (minp.y+maxp.y)/2, 0);
+       return Vector(pos.x+c*center.x-s*center.y, pos.y+s*center.x+c*center.y, pos.z+0.02);
 }
 
 GL::Matrix Track3D::get_matrix() const
 {
-       const Point &pos = track.get_position();
+       const Vector &pos = track.get_position();
        float rot = track.get_rotation();
 
        GL::Matrix matrix;
index 9555bff7a67083edb30f991cdbcdd7e8d46eb549..d0a90f424ee2aed04b73ea0d095a8623f4718e5e 100644 (file)
@@ -39,10 +39,10 @@ public:
        Layout3D &get_layout() const { return layout; }
        Track &get_track() const { return track; }
        const TrackType3D &get_type() const { return type; }
-       void get_bounds(float, Point &, Point &) const;
+       void get_bounds(float, Vector &, Vector &) const;
        Path3D &get_path() { return *path; }
 
-       virtual Point get_node() const;
+       virtual Vector get_node() const;
        virtual bool is_visible() const { return true; }
 
        Msp::GL::Matrix get_matrix() const;
index 8a62175381a66848748bac85c9c73a3e2191c575..47c85ab4dea6f85562346380ccaf86085358f1f7 100644 (file)
@@ -16,7 +16,7 @@ using namespace Msp;
 
 namespace {
 
-bool compare_z(const R2C2::Point &p1, const R2C2::Point &p2)
+bool compare_z(const R2C2::Vector &p1, const R2C2::Vector &p2)
 {
        return p1.z<p2.z;
 }
@@ -27,7 +27,7 @@ Iter graham_scan(Iter begin, Iter end)
        // http://en.wikipedia.org/wiki/Graham_scan
 
        // Find point with lowest X coordinate
-       R2C2::Point lowest = *begin;
+       R2C2::Vector lowest = *begin;
        for(Iter i=begin; i!=end; ++i)
                if(i->x<lowest.x || (i->x==lowest.x && i->y>lowest.y))
                        lowest = *i;
@@ -80,13 +80,13 @@ TrackType3D::TrackType3D(Catalogue3D &cat3d, const TrackType &tt):
        const vector<TrackPart> &parts = tt.get_parts();
 
        const Profile &ballast_profile = cat.get_ballast_profile();
-       const Point &ballast_min = ballast_profile.get_min_coords();
-       const Point &ballast_max = ballast_profile.get_max_coords();
+       const Vector &ballast_min = ballast_profile.get_min_coords();
+       const Vector &ballast_max = ballast_profile.get_max_coords();
        float ballast_h = ballast_max.y-ballast_min.y;
 
        const Profile &rail_profile = cat.get_rail_profile();
-       const Point &rail_min = rail_profile.get_min_coords();
-       const Point &rail_max = rail_profile.get_max_coords();
+       const Vector &rail_min = rail_profile.get_min_coords();
+       const Vector &rail_max = rail_profile.get_max_coords();
        float rail_h = rail_max.y-rail_min.y;
 
        float gauge = cat.get_gauge();
@@ -106,14 +106,14 @@ TrackType3D::TrackType3D(Catalogue3D &cat3d, const TrackType &tt):
                unsigned index = 0;
                bld.texcoord(0.25, 0.5);
                for(vector<TrackPart>::const_iterator i=parts.begin(); i!=parts.end(); ++i)
-                       build_part(*i, ballast_profile, Point(0, -ballast_min.y), false, bld, index);
+                       build_part(*i, ballast_profile, Vector(0, -ballast_min.y), false, bld, index);
 
                bld.texcoord(0.75, 0.5);
                float y = ballast_h-rail_min.y;
                for(vector<TrackPart>::const_iterator i=parts.begin(); i!=parts.end(); ++i)
-                       build_part(*i, rail_profile, Point(-gauge/2, y), true, bld, index);
+                       build_part(*i, rail_profile, Vector(-gauge/2, y), true, bld, index);
                for(vector<TrackPart>::const_iterator i=parts.begin(); i!=parts.end(); ++i)
-                       build_part(*i, rail_profile, Point(gauge/2, y), false, bld, index);
+                       build_part(*i, rail_profile, Vector(gauge/2, y), false, bld, index);
 
                object = new GL::Object;
                object->set_mesh(mesh);
@@ -131,13 +131,13 @@ TrackType3D::TrackType3D(Catalogue3D &cat3d, const TrackType &tt):
                        unsigned index = 0;
                        for(vector<TrackPart>::const_iterator j=parts.begin(); j!=parts.end(); ++j)
                                if(j->get_path()==i)
-                                       build_part(*j, cat.get_path_profile(), Point(0, ballast_h+1.5*rail_h), false, bld, index);
+                                       build_part(*j, cat.get_path_profile(), Vector(0, ballast_h+1.5*rail_h), false, bld, index);
                }
                path_meshes.push_back(m);
        }
 
        min_z = max_z = border.front().z;
-       for(vector<Point>::iterator i=border.begin(); i!=border.end(); ++i)
+       for(vector<Vector>::iterator i=border.begin(); i!=border.end(); ++i)
        {
                min_z = min(min_z, i->z);
                max_z = max(max_z, i->z);
@@ -151,16 +151,16 @@ TrackType3D::~TrackType3D()
                delete *i;
 }
 
-void TrackType3D::get_bounds(float angle, Point &minp, Point &maxp) const
+void TrackType3D::get_bounds(float angle, Vector &minp, Vector &maxp) const
 {
        float c = cos(-angle);
        float s = sin(-angle);
 
-       minp = maxp = Point();
+       minp = maxp = Vector();
        minp.z = min_z;
        maxp.z = max_z;
 
-       for(vector<Point>::const_iterator i=border.begin(); i!=border.end(); ++i)
+       for(vector<Vector>::const_iterator i=border.begin(); i!=border.end(); ++i)
        {
                float x = c*i->x-s*i->y;
                float y = s*i->x+c*i->y;
@@ -179,7 +179,7 @@ const GL::Mesh &TrackType3D::get_path_mesh(unsigned p) const
        return *path_meshes[p];
 }
 
-void TrackType3D::build_part(const TrackPart &part, const Profile &profile, const Point &offset, bool mirror, GL::MeshBuilder &bld, unsigned &base_index)
+void TrackType3D::build_part(const TrackPart &part, const Profile &profile, const Vector &offset, bool mirror, GL::MeshBuilder &bld, unsigned &base_index)
 {
        float plen = part.get_length();
        unsigned nsegs = (part.is_curved() ? static_cast<unsigned>(plen*32)+1 : 1);
@@ -194,14 +194,14 @@ void TrackType3D::build_part(const TrackPart &part, const Profile &profile, cons
                for(unsigned j=0; j<n_vertices; ++j)
                {
                        const Profile::Vertex &v = profile.get_vertex(mirror ? n_vertices-1-j : j);
-                       Point p = v.pos;
+                       Vector p = v.pos;
                        if(mirror)
                                p.x = -p.x;
                        p.z = basep.pos.z+p.y+offset.y;
                        p.y = basep.pos.y-c*(p.x+offset.x);
                        p.x = basep.pos.x+s*(p.x+offset.x);
 
-                       Point n = v.normal;
+                       Vector n = v.normal;
                        if(mirror)
                                n.x = -n.x;
 
index 10806470b28e5c74dbcd65c9081b28638768b0a8..e43dc428f1867a217a19ef8204fdeb159d6caca7 100644 (file)
@@ -25,7 +25,7 @@ private:
        Msp::GL::Mesh *mesh;
        Msp::GL::Object *object;
        std::vector<Msp::GL::Mesh *> path_meshes;
-       std::vector<Point> border;
+       std::vector<Vector> border;
        float min_z;
        float max_z;
 
@@ -33,12 +33,12 @@ public:
        TrackType3D(Catalogue3D &, const TrackType &);
        ~TrackType3D();
 
-       void get_bounds(float, Point &, Point &) const;
+       void get_bounds(float, Vector &, Vector &) const;
        const Msp::GL::Object &get_object() const { return *object; }
        const Msp::GL::Mesh &get_path_mesh(unsigned) const;
 
 private:
-       void build_part(const TrackPart &, const Profile &, const Point &, bool, Msp::GL::MeshBuilder &, unsigned &);
+       void build_part(const TrackPart &, const Profile &, const Vector &, bool, Msp::GL::MeshBuilder &, unsigned &);
 };
 
 } // namespace R2C2
index 78899fd371d07a25f3f8046c7411974daedcf179..42ac924783d156dec0b8eab1a20670ecd2d55450 100644 (file)
@@ -78,10 +78,10 @@ Vehicle3D::~Vehicle3D()
                delete *i;
 }
 
-Point Vehicle3D::get_node() const
+Vector Vehicle3D::get_node() const
 {
-       Point p = vehicle.get_position();
-       return Point(p.x, p.y, p.z+0.01+vehicle.get_type().get_height());
+       Vector p = vehicle.get_position();
+       return Vector(p.x, p.y, p.z+0.01+vehicle.get_type().get_height());
 }
 
 bool Vehicle3D::is_visible() const
@@ -100,7 +100,7 @@ void Vehicle3D::render(GL::Renderer &renderer, const GL::Tag &tag) const
 void Vehicle3D::setup_render(GL::Renderer &renderer, const GL::Tag &) const
 {
        GL::Matrix matrix;
-       const Point &pos = vehicle.get_position();
+       const Vector &pos = vehicle.get_position();
        matrix.translate(pos.x, pos.y, pos.z);
        matrix.rotate(vehicle.get_direction(), 0, 0, 1);
        renderer.matrix_stack() *= matrix;
index 84b10beb4c6bb1da3bbb514cf30c9a8cf6d59698..36853c95a944786649a933a03961eb4fe90e4ff0 100644 (file)
@@ -37,7 +37,7 @@ public:
        Vehicle &get_vehicle() const { return vehicle; }
        const VehicleType3D &get_type() const { return type; }
 
-       virtual Point get_node() const;
+       virtual Vector get_node() const;
        virtual bool is_visible() const;
 
        virtual void render(Msp::GL::Renderer &, const Msp::GL::Tag &) const;
index 6b98f3dba1bb32cda7aed57acc4bad688ce42a02..97703206588b038c1b6ad862f0dd78d4f1f8f4a7 100644 (file)
@@ -46,14 +46,14 @@ void CameraController::set_look_direction(const GL::Vector3 &look)
 
 void CameraController::view_all()
 {
-       Point minp;
-       Point maxp;
+       Vector minp;
+       Vector maxp;
 
        const Layout3D::TrackMap &tracks = designer.get_layout_3d().get_tracks();
        for(Layout3D::TrackMap::const_iterator i=tracks.begin(); i!=tracks.end(); ++i)
        {
-               Point tmin;
-               Point tmax;
+               Vector tmin;
+               Vector tmax;
                i->second->get_bounds(0, tmin, tmax);
                minp.x = min(minp.x, tmin.x);
                minp.y = min(minp.y, tmin.y);
index 2002bd987910a7d28893ba32b1efd15db0671e39..3b43efd11ff5226b64cfa0cc9478a72adca90fde 100644 (file)
@@ -335,14 +335,14 @@ void Designer::add_selection_to_zone()
        show_zone(*cur_zone);
 }
 
-Point Designer::map_pointer_to_ground(int x, int y)
+Vector Designer::map_pointer_to_ground(int x, int y)
 {
        float xf = x*2.0/window.get_width()-1.0;
        float yf = y*2.0/window.get_height()-1.0;
        GL::Vector4 vec = camera.unproject(GL::Vector4(xf, yf, 0, 0));
        const GL::Vector3 &pos = camera.get_position();
 
-       return Point(pos.x-vec.x*pos.z/vec.z, pos.y-vec.y*pos.z/vec.z);
+       return Vector(pos.x-vec.x*pos.z/vec.z, pos.y-vec.y*pos.z/vec.z);
 }
 
 void Designer::tick()
@@ -462,7 +462,7 @@ void Designer::button_press(int x, int y, unsigned btn, unsigned mod)
        y = window.get_height()-y-1;
        mod = Input::mod_from_sys(mod);
 
-       Point ground = map_pointer_to_ground(x, y);
+       Vector ground = map_pointer_to_ground(x, y);
 
        if(mode==CATALOGUE)
        {
@@ -506,7 +506,7 @@ void Designer::pointer_motion(int x, int y)
 
        if(!root.get_child_at(x, y))
        {
-               Point ground = map_pointer_to_ground(x, y);
+               Vector ground = map_pointer_to_ground(x, y);
                measure.pointer_motion(x, y, ground.x, ground.y);
        }
 }
index 52904e44a13d01e458ca7755f76f8809af977410..da6cb0e4b4ba76fd33bba808d119149e498e96f5 100644 (file)
@@ -112,7 +112,7 @@ public:
        R2C2::Zone *get_current_zone() const { return cur_zone; }
        void add_selection_to_zone();
 
-       R2C2::Point map_pointer_to_ground(int, int);
+       R2C2::Vector map_pointer_to_ground(int, int);
 private:
        void tick();
        void key_press(unsigned, unsigned, wchar_t);
index b41b29eeac9ac6e6562df825824f316a817fa3f7..359fbbb5e0b8d05feb884ac4ada0fb3707ebaceb 100644 (file)
@@ -119,8 +119,8 @@ void Manipulator::flatten()
 
        for(vector<MTrack>::iterator i=tracks.begin(); i!=tracks.end(); ++i)
        {
-               Point p = i->track->get_position();
-               i->track->set_position(Point(p.x, p.y, z));
+               Vector p = i->track->get_position();
+               i->track->set_position(Vector(p.x, p.y, z));
                i->track->set_slope(0);
        }
 
@@ -228,7 +228,7 @@ void Manipulator::connect()
        float limit = designer.get_layout().get_catalogue().get_gauge()/10;
 
        Track *track1 = tracks.front().track;
-       Point pos1;
+       Vector pos1;
        float dir1;
        Track *track2 = tracks.back().track;
        bool ok = false;
@@ -246,7 +246,7 @@ void Manipulator::connect()
                        if(track2->get_link(j))
                                continue;
 
-                       Point pos2 = track2->get_endpoint_position(j);
+                       Vector pos2 = track2->get_endpoint_position(j);
                        float dir2 = track2->get_endpoint_direction(j);
 
                        float dz = pos2.z-pos1.z;
@@ -307,7 +307,7 @@ void Manipulator::cancel()
 
        for(vector<MTrack>::iterator i=tracks.begin(); i!=tracks.end(); ++i)
        {
-               i->track->set_position(Point(center.x+i->pos.x, center.y+i->pos.y, center.z+i->pos.z));
+               i->track->set_position(Vector(center.x+i->pos.x, center.y+i->pos.y, center.z+i->pos.z));
                i->track->set_rotation(i->rot);
        }
 
@@ -377,11 +377,11 @@ void Manipulator::pointer_motion(int x, int y)
 
        if(mode==MOVE)
        {
-               Point delta(gpointer.x-move_origin.x, gpointer.y-move_origin.y, 0);
-               Point offset(center.x+delta.x, center.y+delta.y, center.z);
+               Vector delta(gpointer.x-move_origin.x, gpointer.y-move_origin.y, 0);
+               Vector offset(center.x+delta.x, center.y+delta.y, center.z);
                for(vector<MTrack>::iterator i=tracks.begin(); i!=tracks.end(); ++i)
                {
-                       i->track->set_position(Point(offset.x+i->pos.x, offset.y+i->pos.y, offset.z+i->pos.z));
+                       i->track->set_position(Vector(offset.x+i->pos.x, offset.y+i->pos.y, offset.z+i->pos.z));
                        i->track->set_rotation(i->rot);
                }
 
@@ -406,14 +406,14 @@ void Manipulator::pointer_motion(int x, int y)
                        float da = snapped->track->get_rotation()-snapped->rot;
                        float c = cos(da);
                        float s = sin(da);
-                       const Point &sp = snapped->track->get_position();
+                       const Vector &sp = snapped->track->get_position();
                        for(vector<MTrack>::iterator i=tracks.begin(); i!=tracks.end(); ++i)
                        {
                                if(&*i==snapped)
                                        continue;
 
-                               Point dp(i->pos.x-snapped->pos.x, i->pos.y-snapped->pos.y, 0);
-                               i->track->set_position(Point(sp.x+c*dp.x-s*dp.y, sp.y+s*dp.x+c*dp.y, sp.z+i->pos.z-snapped->pos.z));
+                               Vector dp(i->pos.x-snapped->pos.x, i->pos.y-snapped->pos.y, 0);
+                               i->track->set_position(Vector(sp.x+c*dp.x-s*dp.y, sp.y+s*dp.x+c*dp.y, sp.z+i->pos.z-snapped->pos.z));
                                i->track->set_rotation(i->rot+da);
                        }
                }
@@ -428,7 +428,7 @@ void Manipulator::pointer_motion(int x, int y)
                {
                        float c = cos(angle);
                        float s = sin(angle);
-                       i->track->set_position(Point(center.x+c*i->pos.x-s*i->pos.y, center.y+s*i->pos.x+c*i->pos.y, center.z+i->pos.z));
+                       i->track->set_position(Vector(center.x+c*i->pos.x-s*i->pos.y, center.y+s*i->pos.x+c*i->pos.y, center.z+i->pos.z));
                        i->track->set_rotation(angle+i->rot);
                }
        }
@@ -439,14 +439,14 @@ void Manipulator::pointer_motion(int x, int y)
                signal_status.emit(format("Elevation: %+.0fmm (%.0fmm)", dz*1000, (center.z+dz)*1000));
 
                for(vector<MTrack>::iterator i=tracks.begin(); i!=tracks.end(); ++i)
-                       i->track->set_position(Point(center.x+i->pos.x, center.y+i->pos.y, center.z+i->pos.z+dz));
+                       i->track->set_position(Vector(center.x+i->pos.x, center.y+i->pos.y, center.z+i->pos.z+dz));
 
                for(set<Track *>::iterator i=neighbors.begin(); i!=neighbors.end(); ++i)
                        (*i)->check_slope();
        }
        else if(mode==EXTEND)
        {
-               Point pos;
+               Vector pos;
                float dir = 0;
                float length = 0;
                for(vector<MTrack>::iterator i=tracks.begin(); i!=tracks.end(); ++i)
@@ -457,7 +457,7 @@ void Manipulator::pointer_motion(int x, int y)
                                if(i->track->get_link(j))
                                        continue;
 
-                               Point ep_pos = i->track->get_endpoint_position(j);
+                               Vector ep_pos = i->track->get_endpoint_position(j);
                                float ep_dir = i->track->get_endpoint_direction(j);
                                float c = cos(ep_dir);
                                float s = sin(ep_dir);
@@ -509,13 +509,13 @@ void Manipulator::selection_changed()
 
 void Manipulator::update_tracks()
 {
-       Point minp, maxp;
+       Vector minp, maxp;
        for(vector<MTrack>::iterator i=tracks.begin(); i!=tracks.end(); ++i)
        {
                unsigned n_endpoints = i->track->get_type().get_endpoints().size();
                for(unsigned j=0; j<n_endpoints; ++j)
                {
-                       Point p = i->track->get_endpoint_position(j);
+                       Vector p = i->track->get_endpoint_position(j);
                        if(i==tracks.begin() && j==0)
                                minp = maxp = p;
                        else
@@ -529,11 +529,11 @@ void Manipulator::update_tracks()
                }
        }
 
-       center = Point((minp.x+maxp.x)/2, (minp.y+maxp.y)/2, minp.z);
+       center = Vector((minp.x+maxp.x)/2, (minp.y+maxp.y)/2, minp.z);
        for(vector<MTrack>::iterator i=tracks.begin(); i!=tracks.end(); ++i)
        {
-               const Point &tp = i->track->get_position();
-               i->pos = Point(tp.x-center.x, tp.y-center.y, tp.z-center.z);
+               const Vector &tp = i->track->get_position();
+               i->pos = Vector(tp.x-center.x, tp.y-center.y, tp.z-center.z);
                i->rot = i->track->get_rotation();
        }
 }
@@ -563,20 +563,20 @@ void Manipulator::update_neighbors()
 
 void Manipulator::set_slope(TrackOrder &track, float z, float dz)
 {
-       const Point &p = track.track->get_position();
+       const Vector &p = track.track->get_position();
        if(track.rev)
        {
-               track.track->set_position(Point(p.x, p.y, z+dz));
+               track.track->set_position(Vector(p.x, p.y, z+dz));
                track.track->set_slope(-dz);
        }
        else
        {
-               track.track->set_position(Point(p.x, p.y, z));
+               track.track->set_position(Vector(p.x, p.y, z));
                track.track->set_slope(dz);
        }
 }
 
-vector<Track *> Manipulator::create_straight(const R2C2::Point &start, float dir, float length, float limit)
+vector<Track *> Manipulator::create_straight(const R2C2::Vector &start, float dir, float length, float limit)
 {
        const Catalogue::TrackMap &track_types = designer.get_catalogue().get_tracks();
        std::map<float, const TrackType *> types_by_length;
@@ -636,7 +636,7 @@ vector<Track *> Manipulator::create_straight(const R2C2::Point &start, float dir
 
        if(!lengths.empty())
        {
-               Point pos = start;
+               Vector pos = start;
                float c = cos(dir);
                float s = sin(dir);
                for(vector<float>::iterator i=lengths.begin(); i!=lengths.end(); ++i)
index 75fafe569afbab67dfaf9e34662f65d9f6ea2b79..d8c3986a6161db02dd1bea7a84bd44a8e09d6841 100644 (file)
@@ -28,7 +28,7 @@ private:
        struct MTrack
        {
                R2C2::Track *track;
-               R2C2::Point pos;
+               R2C2::Vector pos;
                float rot;
 
                MTrack(R2C2::Track *);
@@ -51,12 +51,12 @@ private:
        Msp::Graphics::EventSource &event_source;
        Selection &selection;
        std::vector<MTrack> tracks;
-       R2C2::Point center;
+       R2C2::Vector center;
 
-       R2C2::Point gpointer;
+       R2C2::Vector gpointer;
        int pointer_y;
        Mode mode;
-       R2C2::Point move_origin;
+       R2C2::Vector move_origin;
        float angle;
        float rot_origin;
        int elev_origin;
@@ -82,7 +82,7 @@ private:
        void update_tracks();
        void update_neighbors();
        void set_slope(TrackOrder &, float, float);
-       std::vector<R2C2::Track *> create_straight(const R2C2::Point &, float, float, float);
+       std::vector<R2C2::Track *> create_straight(const R2C2::Vector &, float, float, float);
 };
 
 #endif
index 56efc1b55a16a969b28bbea4e33a69385307037e..e5e5abb542c3a434a96795df13e8c7f6e1571c01 100644 (file)
@@ -25,7 +25,7 @@ void Measure::start()
        state = STARTING;
 }
 
-void Measure::snap_to_tracks(Point &pt, float &dir)
+void Measure::snap_to_tracks(Vector &pt, float &dir)
 {
        const set<Track *> &ltracks = designer.get_layout().get_tracks();
        for(set<Track *>::const_iterator i=ltracks.begin(); i!=ltracks.end(); ++i)
@@ -40,7 +40,7 @@ void Measure::button_press(int, int, float gx, float gy, unsigned btn)
 
        if(btn==1)
        {
-               spoint = Point(gx, gy, 0);
+               spoint = Vector(gx, gy, 0);
                sdir = 0;
                snap_to_tracks(spoint, sdir);
 
@@ -63,13 +63,13 @@ void Measure::pointer_motion(int, int, float gx, float gy)
        if(!state)
                return;
 
-       pointer = Point(gx, gy, 0);
+       pointer = Vector(gx, gy, 0);
        float dir = sdir;
        snap_to_tracks(pointer, dir);
 
        if(state!=STARTING)
        {
-               Point delta(pointer.x-spoint.x, pointer.y-spoint.y, 0);
+               Vector delta(pointer.x-spoint.x, pointer.y-spoint.y, 0);
                float c = cos(sdir);
                float s = sin(sdir);
 
index 6800ecce307826fa0bcc46d204e0ec84b539b4b4..fc675a6b9a859fed36250140b0715e284f6e093b 100644 (file)
@@ -28,8 +28,8 @@ public:
 
 private:
        Designer &designer;
-       R2C2::Point pointer;
-       R2C2::Point spoint;
+       R2C2::Vector pointer;
+       R2C2::Vector spoint;
        float sdir;
        float par_dist;
        float perp_dist;
@@ -46,7 +46,7 @@ public:
        void pointer_motion(int, int, float, float);
        void render();
 private:
-       void snap_to_tracks(R2C2::Point &, float &);
+       void snap_to_tracks(R2C2::Vector &, float &);
 };
 
 #endif
index a9e13f8924db6470b02e27615af3b7cada4a91f3..a9ba131c6bedc88a70d43e9b157b55d3b393ce8d 100644 (file)
@@ -27,8 +27,8 @@ void SvgExporter::save(const string &fn)
        gauge = layout.get_catalogue().get_gauge()*1000;
 
        const Profile &rail_profile = layout.get_catalogue().get_rail_profile();
-       const Point &rail_min = rail_profile.get_min_coords();
-       const Point &rail_max = rail_profile.get_max_coords();
+       const Vector &rail_min = rail_profile.get_min_coords();
+       const Vector &rail_max = rail_profile.get_max_coords();
        rail_width = (rail_max.x-rail_min.x)*1000;
 
        xmlpp::Document *doc = new xmlpp::Document;
@@ -41,8 +41,8 @@ void SvgExporter::save(const string &fn)
                ".artnr { text-anchor: middle; font-size: %.3f; }\n",
                rail_width, rail_width, gauge*0.75));
 
-       Point minp;
-       Point maxp;
+       Vector minp;
+       Vector maxp;
        const set<Track *> &tracks = layout.get_tracks();
        for(set<Track *>::const_iterator i=tracks.begin(); i!=tracks.end(); ++i)
        {
@@ -52,7 +52,7 @@ void SvgExporter::save(const string &fn)
                unsigned n_endpoints = (*i)->get_type().get_endpoints().size();
                for(unsigned j=0; j<n_endpoints; ++j)
                {
-                       Point pos = (*i)->get_endpoint_position(j);
+                       Vector pos = (*i)->get_endpoint_position(j);
                        if(i==tracks.begin() && j==0)
                                minp = maxp = pos;
                        else
@@ -73,7 +73,7 @@ void SvgExporter::save(const string &fn)
 
 void SvgExporter::save_track(const Track &track, xmlpp::Element &group)
 {
-       const Point &pos = track.get_position();
+       const Vector &pos = track.get_position();
        float rot = track.get_rotation();
        string transform = format("translate(%.3f %.3f) rotate(%.3f)", pos.x*1000, -pos.y*1000, -rot*180/M_PI);
        group.set_attribute("transform", transform);
index 5e21ddc326b39e354c4a3ddf5e7c59e39aee3932..45ec19c85a8c1a33ac4b0bdfb1dbaac9c8c1ffe3 100644 (file)
@@ -34,7 +34,7 @@ void TrackWrap::render(const GL::Tag &) const
        for(list<Wrap>::const_iterator i=wraps.begin(); i!=wraps.end(); ++i)
        {
                GL::PushMatrix _pushm;
-               const Point &pos = i->track->get_position();
+               const Vector &pos = i->track->get_position();
                GL::translate(pos.x, pos.y, pos.z);
                GL::rotate(i->track->get_rotation()*180/M_PI, 0, 0, 1);
                i->mesh->draw();
@@ -64,12 +64,12 @@ GL::Mesh &TrackWrap::get_mesh(const TrackType &type)
 
        float min_area = -1;
        float angle = 0;
-       Point center;
+       Vector center;
        float width = 0;
        float height = 0;
        for(float a=0; a<M_PI; a+=0.01)
        {
-               Point minp, maxp;
+               Vector minp, maxp;
                type3d.get_bounds(a, minp, maxp);
                float area = (maxp.x-minp.x)*(maxp.y-minp.y);
                if(area<min_area || min_area<0)
@@ -78,7 +78,7 @@ GL::Mesh &TrackWrap::get_mesh(const TrackType &type)
                        float s = sin(a);
                        float x = (minp.x+maxp.x)/2;
                        float y = (minp.y+maxp.y)/2;
-                       center = Point(c*x-s*y, s*x+c*y, minp.z);
+                       center = Vector(c*x-s*y, s*x+c*y, minp.z);
                        angle = a;
                        width = maxp.x-minp.x+0.01;
                        height = maxp.y-minp.y+0.01;
index 90cb8eb7007fbb9ab08e62924888e42f546d6680..fad61693aef66161e1822dc18f7e8a209f7d33af 100644 (file)
@@ -237,7 +237,7 @@ void Engineer::tick()
                GL::PushMatrix push_mat;
 
                float rot = picking_track->get_endpoint_direction(picking_entry);
-               Point pos = picking_track->get_endpoint_position(picking_entry);
+               Vector pos = picking_track->get_endpoint_position(picking_entry);
 
                GL::translate(pos.x, pos.y, pos.z+0.03);
                GL::rotate(rot*180/M_PI+180, 0, 0, 1);
@@ -338,7 +338,7 @@ void Engineer::view_all()
                float max_y = 0;
                for(Layout3D::TrackMap::const_iterator i=tracks.begin(); i!=tracks.end(); ++i)
                {
-                       Point minp, maxp;
+                       Vector minp, maxp;
                        i->second->get_bounds(angle, minp, maxp);
                        min_x = min(min_x, minp.x);
                        max_x = max(max_x, maxp.x);
index 805fec5cfdf375f96dcd56bcbe8ca8d70c8ec3ca..a2dedf9e0f4f03df1011baf1f5581809bea92fed 100644 (file)
@@ -92,7 +92,7 @@ void TrainView::set_forward(bool f)
 void TrainView::prepare()
 {
        const Vehicle &veh = train.get_vehicle(0);
-       const Point &pos = veh.get_position();
+       const Vector &pos = veh.get_position();
        float angle = veh.get_direction();
        if(!forward)
                angle += M_PI;
index 51cad9a031a134ddc4107e7413f2d0b5da4b7a02..70a39859721ad607af1a972b9c4dff294d13e9bc 100644 (file)
@@ -96,8 +96,8 @@ void Catalogue::Loader::gauge(float g)
 {
        obj.gauge = g/1000;
        obj.path_profile = Profile();
-       obj.path_profile.append_vertex(Point(0.1*obj.gauge, 0), false);
-       obj.path_profile.append_vertex(Point(-0.1*obj.gauge, 0), false);
+       obj.path_profile.append_vertex(Vector(0.1*obj.gauge, 0), false);
+       obj.path_profile.append_vertex(Vector(-0.1*obj.gauge, 0), false);
 }
 
 void Catalogue::Loader::layout()
index 48bbd49eeb98736b5274dbd50ec91d723649b8be..8519499ef581c5d6a67ea656d1dbe1fee32aecb1 100644 (file)
@@ -13,21 +13,21 @@ Distributed under the GPL
 
 namespace R2C2 {
 
-struct Point
+struct Vector
 {
        float x, y, z;
 
-       Point(): x(0), y(0), z(0) { }
-       Point(float x_, float y_): x(x_), y(y_), z(0) { }
-       Point(float x_, float y_, float z_): x(x_), y(y_), z(z_) { }
+       Vector(): x(0), y(0), z(0) { }
+       Vector(float x_, float y_): x(x_), y(y_), z(0) { }
+       Vector(float x_, float y_, float z_): x(x_), y(y_), z(z_) { }
 };
 
-inline float distance(const Point &p, const Point &q)
+inline float distance(const Vector &p, const Vector &q)
 { return sqrt((p.x-q.x)*(p.x-q.x) + (p.y-q.y)*(p.y-q.y) + (p.z-q.z)*(p.z-q.z)); }
 
 struct TrackPoint
 {
-       Point pos;
+       Vector pos;
        float dir;
        float grade;
 
index 1b1aeeed7810f9e8a36d61587e875009bec228b9..96b06a2c185a1f174d3afa99f1f6de3b67a76569 100644 (file)
@@ -13,7 +13,7 @@ using namespace Msp;
 
 namespace R2C2 {
 
-void Profile::append_vertex(const Point &p, bool smooth)
+void Profile::append_vertex(const Vector &p, bool smooth)
 {
        if(vertices.size()>1 && !vertices.back().smooth)
                vertices.push_back(vertices.back());
@@ -32,7 +32,7 @@ void Profile::append_vertex(const Point &p, bool smooth)
 
                if(vertices.back().smooth)
                {
-                       Point &n = vertices.back().normal;
+                       Vector &n = vertices.back().normal;
                        n.x += v.normal.x;
                        n.y += v.normal.y;
                        len = sqrt(n.x*n.x+n.y*n.y);
@@ -76,12 +76,12 @@ Profile::Loader::Loader(Profile &p):
 
 void Profile::Loader::point(float x, float y)
 {
-       obj.append_vertex(Point(x/1000, y/1000), false);
+       obj.append_vertex(Vector(x/1000, y/1000), false);
 }
 
 void Profile::Loader::smooth_point(float x, float y)
 {
-       obj.append_vertex(Point(x/1000, y/1000), true);
+       obj.append_vertex(Vector(x/1000, y/1000), true);
 }
 
 } // namespace R2C2
index 4354a13705fd880959d482c91585125c1f21e3e2..9f56b2de92d4a6bafa47544d85c37f79048c6d02 100644 (file)
@@ -28,22 +28,22 @@ public:
 
        struct Vertex
        {
-               Point pos;
-               Point normal;
+               Vector pos;
+               Vector normal;
                bool smooth;
        };
 
 private:
        std::vector<Vertex> vertices;
-       Point min_coords;
-       Point max_coords;
+       Vector min_coords;
+       Vector max_coords;
 
 public:
-       void append_vertex(const Point &, bool);
+       void append_vertex(const Vector &, bool);
        unsigned get_n_vertices() const { return vertices.size(); }
        const Vertex &get_vertex(unsigned) const;
-       const Point &get_min_coords() const { return min_coords; }
-       const Point &get_max_coords() const { return max_coords; }
+       const Vector &get_min_coords() const { return min_coords; }
+       const Vector &get_max_coords() const { return max_coords; }
        float get_width() const { return max_coords.x-min_coords.x; }
        float get_height() const { return max_coords.y-min_coords.y; }
 };
index c6c1751d7b2388cdadeb78e9824a1fcb6fb544b5..0d4052ea999a83b6394bb79f7d03f9216604fc39 100644 (file)
@@ -65,7 +65,7 @@ Block &Track::get_block() const
        return *block;
 }
 
-void Track::set_position(const Point &p)
+void Track::set_position(const Vector &p)
 {
        pos = p;
 }
@@ -99,8 +99,8 @@ void Track::check_slope()
 
        if(links[0] && links[1])
        {
-               Point epp0 = links[0]->get_endpoint_position(links[0]->get_endpoint_by_link(*this));
-               Point epp1 = links[1]->get_endpoint_position(links[1]->get_endpoint_by_link(*this));
+               Vector epp0 = links[0]->get_endpoint_position(links[0]->get_endpoint_by_link(*this));
+               Vector epp1 = links[1]->get_endpoint_position(links[1]->get_endpoint_by_link(*this));
                pos.z = epp0.z;
                slope = epp1.z-pos.z;
        }
@@ -109,12 +109,12 @@ void Track::check_slope()
                slope = 0;
                if(links[0])
                {
-                       Point epp = links[0]->get_endpoint_position(links[0]->get_endpoint_by_link(*this));
+                       Vector epp = links[0]->get_endpoint_position(links[0]->get_endpoint_by_link(*this));
                        pos.z = epp.z;
                }
                else if(links[1])
                {
-                       Point epp = links[1]->get_endpoint_position(links[1]->get_endpoint_by_link(*this));
+                       Vector epp = links[1]->get_endpoint_position(links[1]->get_endpoint_by_link(*this));
                        pos.z = epp.z;
                }
        }
@@ -162,7 +162,7 @@ int Track::get_endpoint_by_link(Track &other) const
        return -1;
 }
 
-Point Track::get_endpoint_position(unsigned epi) const
+Vector Track::get_endpoint_position(unsigned epi) const
 {
        const vector<TrackType::Endpoint> &eps = type.get_endpoints();
        if(epi>=eps.size())
@@ -173,7 +173,7 @@ Point Track::get_endpoint_position(unsigned epi) const
        float c = cos(rot);
        float s = sin(rot);
 
-       Point p(pos.x+c*ep.pos.x-s*ep.pos.y, pos.y+s*ep.pos.x+c*ep.pos.y, pos.z);
+       Vector p(pos.x+c*ep.pos.x-s*ep.pos.y, pos.y+s*ep.pos.x+c*ep.pos.y, pos.z);
        if(eps.size()==2 && epi==1)
                p.z += slope;
        return p;
@@ -205,14 +205,14 @@ bool Track::snap_to(Track &other, bool link, float limit)
 
        for(unsigned i=0; i<eps.size(); ++i)
        {
-               Point epp = get_endpoint_position(i);
+               Vector epp = get_endpoint_position(i);
 
                for(unsigned j=0; j<other_eps.size(); ++j)
                {
                        if(other.get_link(j))
                                continue;
 
-                       Point epp2 = other.get_endpoint_position(j);
+                       Vector epp2 = other.get_endpoint_position(j);
                        float dx = epp2.x-epp.x;
                        float dy = epp2.y-epp.y;
                        float dz = epp2.z-epp.z;
@@ -221,7 +221,7 @@ bool Track::snap_to(Track &other, bool link, float limit)
                                if(!link || (!flex && !other.get_flex()))
                                {
                                        set_rotation(other.rot+other_eps[j].dir-eps[i].dir+M_PI);
-                                       Point p(epp2.x-(eps[i].pos.x*cos(rot)-eps[i].pos.y*sin(rot)),
+                                       Vector p(epp2.x-(eps[i].pos.x*cos(rot)-eps[i].pos.y*sin(rot)),
                                                epp2.y-(eps[i].pos.y*cos(rot)+eps[i].pos.x*sin(rot)),
                                                epp2.z);
                                        if(eps.size()==2 && i==1)
@@ -249,13 +249,13 @@ bool Track::snap_to(Track &other, bool link, float limit)
        return false;
 }
 
-bool Track::snap(Point &pt, float &d) const
+bool Track::snap(Vector &pt, float &d) const
 {
        const vector<TrackType::Endpoint> &eps = type.get_endpoints();
 
        for(unsigned i=0; i<eps.size(); ++i)
        {
-               Point epp = get_endpoint_position(i);
+               Vector epp = get_endpoint_position(i);
                float dx = pt.x-epp.x;
                float dy = pt.y-epp.y;
                if(dx*dx+dy*dy<1e-4)
@@ -307,7 +307,7 @@ TrackPoint Track::get_point(unsigned epi, unsigned path, float d) const
        float c = cos(rot);
        float s = sin(rot);
 
-       p.pos = Point(pos.x+c*p.pos.x-s*p.pos.y, pos.y+s*p.pos.x+c*p.pos.y, pos.z);
+       p.pos = Vector(pos.x+c*p.pos.x-s*p.pos.y, pos.y+s*p.pos.x+c*p.pos.y, pos.z);
        p.dir += rot;
        if(type.get_endpoints().size()==2)
        {
@@ -372,7 +372,7 @@ Track::Loader::Loader(Track &t):
 
 void Track::Loader::position(float x, float y, float z)
 {
-       obj.pos = Point(x, y, z);
+       obj.pos = Vector(x, y, z);
 }
 
 void Track::Loader::sensor_id(unsigned id)
index 82365a5ab02127ed5a0742e567bae153bf546cbd..8f75f78fc1c093f94e83f74e70a5518b1f378aa3 100644 (file)
@@ -40,7 +40,7 @@ private:
        Layout &layout;
        const TrackType &type;
        Block *block;
-       Point pos;
+       Vector pos;
        float rot;
        float slope;
        bool flex;
@@ -60,11 +60,11 @@ public:
 
        void set_block(Block *);
        Block &get_block() const;
-       void set_position(const Point &);
+       void set_position(const Vector &);
        void set_rotation(float);
        void set_slope(float);
        void set_flex(bool);
-       const Point &get_position() const { return pos; }
+       const Vector &get_position() const { return pos; }
        float get_rotation() const { return rot; }
        float get_slope() const { return slope; }
        bool get_flex() const { return flex; }
@@ -78,10 +78,10 @@ public:
        unsigned get_active_path() const { return active_path; }
 
        int get_endpoint_by_link(Track &) const;
-       Point get_endpoint_position(unsigned) const;
+       Vector get_endpoint_position(unsigned) const;
        float get_endpoint_direction(unsigned) const;
        bool snap_to(Track &, bool, float = 0);
-       bool snap(Point &, float &) const;
+       bool snap(Vector &, float &) const;
        void break_link(Track &);
        void break_links();
        const std::vector<Track *> &get_links() const { return links; }
index af2cf37999f23dd376ae5cb134149a90c18d4b22..f677c703ee5a7e89f7ffa9d241fbaa69754f433c 100644 (file)
@@ -43,12 +43,12 @@ TrackPoint TrackPart::get_point(float d) const
                float s = sin(a);
                float rx = radius*sin(dir);
                float ry = -radius*cos(dir);
-               result.pos = Point(pos.x+c*rx-s*ry-rx, pos.y+c*ry+s*rx-ry);
+               result.pos = Vector(pos.x+c*rx-s*ry-rx, pos.y+c*ry+s*rx-ry);
                result.dir = dir+a;
        }
        else
        {
-               result.pos = Point(pos.x+cos(dir)*d, pos.y+sin(dir)*d);
+               result.pos = Vector(pos.x+cos(dir)*d, pos.y+sin(dir)*d);
                result.dir = dir;
        }
 
@@ -120,7 +120,7 @@ void TrackPart::Loader::finish()
 
 void TrackPart::Loader::start(float x, float y, float d)
 {
-       obj.pos = Point(x, y);
+       obj.pos = Vector(x, y);
        obj.dir = d;
 }
 
index 0a07b4d0df857fabb90679e45f0582a05f4fb74d..42945845add5aa8d58d17ddd82f6c498f3d4f100 100644 (file)
@@ -26,7 +26,7 @@ public:
        };
 
 private:
-       Point pos;
+       Vector pos;
        float dir;
        float length;
        float radius;
index 9c4865f1ff3f655bd8578a98ae200ab46bc866d4..f285036f905b236c8ac894e6022d1961e195ca5f 100644 (file)
@@ -20,7 +20,7 @@ class TrackType
 public:
        struct Endpoint
        {
-               Point pos;
+               Vector pos;
                float dir;  // Direction outwards from the endpoint
                unsigned paths;
 
index 3fdc7a44c7a2722b7afa763dbf87aea182062a8f..2c31ba19f189467ad07233dc0ff600e87fe6643e 100644 (file)
@@ -293,17 +293,17 @@ void Vehicle::update_rods()
                        const Axle &axle = get_axle(i->type->pivot_index);
                        float c = cos(axle.angle);
                        float s = sin(axle.angle);
-                       const Point &pp = i->type->pivot_point;
-                       i->position = Point(axle.type->position+pp.x*c+pp.z*s, pp.y, axle.type->wheel_dia/2+pp.z*c-pp.x*s);
+                       const Vector &pp = i->type->pivot_point;
+                       i->position = Vector(axle.type->position+pp.x*c+pp.z*s, pp.y, axle.type->wheel_dia/2+pp.z*c-pp.x*s);
                }
                else if(i->type->pivot==VehicleType::Rod::ROD)
                {
                        const Rod &prod = get_rod(i->type->pivot_index);
                        float c = cos(prod.angle);
                        float s = sin(prod.angle);
-                       const Point &pos = prod.position;
-                       const Point &off = i->type->pivot_point;
-                       i->position = Point(pos.x+off.x*c-off.z*s, pos.y+off.y, pos.z+off.z*c+off.x*s);
+                       const Vector &pos = prod.position;
+                       const Vector &off = i->type->pivot_point;
+                       i->position = Vector(pos.x+off.x*c-off.z*s, pos.y+off.y, pos.z+off.z*c+off.x*s);
                }
 
                if(i->type->connect_index>=0)
@@ -346,8 +346,8 @@ void Vehicle::adjust_for_distance(TrackPosition &front, TrackPosition &back, flo
        int adjust_dir = 0;
        while(1)
        {
-               Point front_point = front.get_point().pos;
-               Point back_point = back.get_point().pos;
+               Vector front_point = front.get_point().pos;
+               Vector back_point = back.get_point().pos;
 
                float dx = front_point.x-back_point.x;
                float dy = front_point.y-back_point.y;
@@ -373,14 +373,14 @@ void Vehicle::adjust_for_distance(TrackPosition &front, TrackPosition &back, flo
        }
 }
 
-TrackPoint Vehicle::get_point(const Point &front, const Point &back, float ratio) const
+TrackPoint Vehicle::get_point(const Vector &front, const Vector &back, float ratio) const
 {
        float dx = front.x-back.x;
        float dy = front.y-back.y;
        float dz = front.z-back.z;
 
        TrackPoint tp;
-       tp.pos = Point(back.x+dx*ratio, back.y+dy*ratio, back.z+dz*ratio);
+       tp.pos = Vector(back.x+dx*ratio, back.y+dy*ratio, back.z+dz*ratio);
        tp.dir = atan2(dy, dx);
 
        return tp;
index 1f118cc579b15c76a90b9eb86c686e7f82d5c0a9..b9c36d95d1e42bdbd6b06b5bc655138ac8ab3fb2 100644 (file)
@@ -48,7 +48,7 @@ public:
        struct Rod
        {
                const VehicleType::Rod *type;
-               Point position;
+               Vector position;
                float angle;
 
                Rod(const VehicleType::Rod &);
@@ -72,7 +72,7 @@ private:
        Vehicle *next;
        Vehicle *prev;
        TrackPosition track_pos;
-       Point position;
+       Vector position;
        float direction;
        std::vector<Axle> axles;
        std::vector<Bogie> bogies;
@@ -99,7 +99,7 @@ public:
        Track *get_track() const { return track_pos.track; }
        unsigned get_entry() const { return track_pos.ep; }
        float get_offset() const { return track_pos.offs; }
-       const Point &get_position() const { return position; }
+       const Vector &get_position() const { return position; }
        float get_direction() const { return direction; }
        const Axle &get_axle(unsigned) const;
        const Bogie &get_bogie(unsigned) const;
@@ -116,7 +116,7 @@ private:
        void update_rods();
 
        void adjust_for_distance(TrackPosition &, TrackPosition &, float, float = 0.5) const;
-       TrackPoint get_point(const Point &, const Point &, float = 0.5) const;
+       TrackPoint get_point(const Vector &, const Vector &, float = 0.5) const;
        TrackPoint get_point(const TrackPosition &, float, float = 0.5) const;
 };
 
index 4f640193d025f433a86c81a2d5813c112200890d..7b355ac105230458f5a5856abfb7677d687cc1de 100644 (file)
@@ -232,8 +232,8 @@ void VehicleType::Rod::Loader::connect(const string &t, float px, float pz, floa
        if(i==tags.end())
                throw KeyError("Unknown rod tag", t);
        obj.connect_index = i->second;
-       obj.connect_point = Point(px/1000, 0, pz/1000);
-       obj.connect_offset = Point(ox/1000, 0, oz/1000);
+       obj.connect_point = Vector(px/1000, 0, pz/1000);
+       obj.connect_offset = Vector(ox/1000, 0, oz/1000);
 }
 
 void VehicleType::Rod::Loader::pivot_body()
@@ -265,7 +265,7 @@ void VehicleType::Rod::Loader::pivot_rod(const string &t)
 
 void VehicleType::Rod::Loader::position(float x, float y, float z)
 {
-       obj.pivot_point = Point(x/1000, y/1000, z/1000);
+       obj.pivot_point = Vector(x/1000, y/1000, z/1000);
 }
 
 void VehicleType::Rod::Loader::set_tag(const string &t)
index a12d3f4f1ea1b4cc513cad45ecbcbfe64cb9e586..97942af02c2381eec34e4fc5fb1fd5a11dd47379 100644 (file)
@@ -116,11 +116,11 @@ public:
                Anchor pivot;
                unsigned pivot_index;
                unsigned pivot_index2;
-               Point pivot_point;
+               Vector pivot_point;
                Limit limit;
                int connect_index;
-               Point connect_point;
-               Point connect_offset;
+               Vector connect_point;
+               Vector connect_offset;
                std::string object;
                bool mirror_object;