X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibr2c2%2Ftrack.h;h=3ae5d602295dcd1fdcbf074b8d47880e8d5e45c8;hb=3051264c306adc12b6028061a3257f523c211f81;hp=82365a5ab02127ed5a0742e567bae153bf546cbd;hpb=949b13aae247fa53579ec1cda9142ccc8755acde;p=r2c2.git diff --git a/source/libr2c2/track.h b/source/libr2c2/track.h index 82365a5..3ae5d60 100644 --- a/source/libr2c2/track.h +++ b/source/libr2c2/track.h @@ -1,17 +1,10 @@ -/* $Id$ - -This file is part of R²C² -Copyright © 2006-2010 Mikkosoft Productions, Mikko Rasa -Distributed under the GPL -*/ - #ifndef LIBR2C2_TRACK_H_ #define LIBR2C2_TRACK_H_ #include #include #include -#include +#include #include "geometry.h" namespace R2C2 { @@ -23,7 +16,7 @@ class TrackType; class Track: public sigc::trackable { public: - class Loader: public Msp::DataFile::BasicLoader + class Loader: public Msp::DataFile::ObjectLoader { public: Loader(Track &); @@ -40,7 +33,7 @@ private: Layout &layout; const TrackType &type; Block *block; - Point pos; + Vector pos; float rot; float slope; bool flex; @@ -60,11 +53,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,16 +71,19 @@ 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 &get_links() const { return links; } Track *get_link(unsigned) const; TrackPoint get_point(unsigned, unsigned, float) const; TrackPoint get_point(unsigned, float) const; + TrackPoint get_nearest_point(const Vector &) const; + + bool collide_ray(const Vector &, const Vector &); void save(std::list &) const; private: