source: trunk/src/PixelMap/Line.hh @ 1441

Last change on this file since 1441 was 1294, checked in by MatthewWhiting, 11 years ago

Forgot to add the Line class to the previous commit.

File size: 849 bytes
Line 
1#ifndef DUCHAMP_LINE_H
2#define DUCHAMP_LINE_H
3
4#include <iostream>
5#include <duchamp/PixelMap/Voxel.hh>
6
7namespace PixelInfo
8{
9
10    class Line
11    {
12    public:
13        Line(){};
14        Line(Voxel start, Voxel end);
15        Line(int x0, int y0, int x1, int y1);
16        Line(const Line& other);
17        Line& operator= (const Line& other);
18        friend std::ostream &operator<<(std::ostream &theStream, Line &theLine);
19        virtual ~Line(){};
20
21        Voxel start(){return itsStart;};
22        Voxel end(){return itsEnd;};
23        bool has(Voxel &vox){return ( (itsStart==vox) || (itsEnd==vox) );};
24
25        bool operator==(const Line &other){return (itsStart==other.itsStart) && (itsEnd==other.itsEnd);};
26
27        int x0(){return itsStart.getX();};
28        int y0(){return itsStart.getY();};
29        int x1(){return itsEnd.getX();};
30        int y1(){return itsEnd.getY();};
31
32    protected:
33        Voxel itsStart;
34        Voxel itsEnd;
35    };
36
37
38}
39
40#endif //LINE
Note: See TracBrowser for help on using the repository browser.