]> git.tdb.fi Git - r2c2.git/blobdiff - source/libr2c2/tracktype.h
Add utility functions to make endpoint path mask operations clearer
[r2c2.git] / source / libr2c2 / tracktype.h
index 1b1c78ce998de86b736d252774643bce2346bfba..dd2a7c4ddf29f83c67d8bed648382d449412db46 100644 (file)
@@ -18,6 +18,9 @@ public:
                unsigned paths;
 
                Endpoint(float, float, float, unsigned);
+
+               bool has_path(unsigned p) const { return paths&(1<<p); }
+               bool has_common_paths(const Endpoint &e) const { return paths&e.paths; }
        };
 
        class Loader: public Msp::DataFile::ObjectLoader<TrackType>
@@ -61,6 +64,7 @@ public:
        const std::vector<Endpoint> &get_endpoints() const { return endpoints; }
        const Endpoint &get_endpoint(unsigned) const;
        TrackPoint get_point(unsigned, unsigned, float) const;
+       TrackPoint get_nearest_point(const Vector &) const;
        bool collide_ray(const Vector &, const Vector &, float) const;
 
 private: