Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Line.hpp

    rf932b7 r69baa4  
    1616class Vector;
    1717class Plane;
     18class LinePoint;
    1819
    1920class Line : public Space
    2021{
     22  friend bool operator==(const Line&,const Line&);
     23  friend class LinePoint;
    2124public:
    2225  Line(const Vector &_origin, const Vector &_direction);
    2326  Line(const Line& _src);
    2427  virtual ~Line();
     28
     29  Line &operator=(const Line& rhs);
    2530
    2631  virtual double distance(const Vector &point) const;
     
    3540
    3641  Vector rotateVector(const Vector &rhs, double alpha) const;
     42  Line rotateLine(const Line &rhs, double alpha) const;
     43  Plane rotatePlane(const Plane &rhs, double alpha) const;
    3744
    3845  Plane getOrthogonalPlane(const Vector &origin) const;
    3946
    4047  std::vector<Vector> getSphereIntersections() const;
     48
     49  LinePoint getLinePoint(const Vector&) const;
     50  LinePoint posEndpoint() const;
     51  LinePoint negEndpoint() const;
     52
     53
    4154
    4255private:
     
    4558};
    4659
     60bool operator==(const Line&,const Line&);
     61
    4762/**
    4863 * Named constructor to make a line through two points
     
    5065Line makeLineThrough(const Vector &x1, const Vector &x2);
    5166
     67/**
     68 * Class for representing points on a line
     69 * These objects allow comparison of points on the same line as well as specifying the
     70 * infinite "endpoints" of a line.
     71 */
     72class LinePoint{
     73  friend class Line;
     74  friend bool operator==(const LinePoint&, const LinePoint&);
     75  friend bool operator<(const LinePoint&, const LinePoint&);
     76public:
     77  LinePoint(const LinePoint&);
     78  LinePoint& operator=(const LinePoint&);
     79  Vector getPoint() const;
     80  Line getLine() const;
     81  bool isInfinite() const;
     82  bool isPosInfinity() const;
     83  bool isNegInfinity() const;
     84
     85private:
     86  LinePoint(const Line&,double);
     87  Line line;
     88  double param;
     89};
     90
     91bool operator==(const LinePoint&, const LinePoint&);
     92bool operator<(const LinePoint&, const LinePoint&);
     93
     94inline bool operator!= (const LinePoint& x, const LinePoint& y) { return !(x==y); }
     95inline bool operator>  (const LinePoint& x, const LinePoint& y) { return y<x; }
     96inline bool operator<= (const LinePoint& x, const LinePoint& y) { return !(y<x); }
     97inline bool operator>= (const LinePoint& x, const LinePoint& y) { return !(x<y); }
     98
     99
    52100#endif /* LINE_HPP_ */
Note: See TracChangeset for help on using the changeset viewer.