DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StraightLineFrom2Points.ih
1 
30 
31 #include <cstdlib>
33 
35 // IMPLEMENTATION of inline methods.
37 
39 // ----------------------- Standard services ------------------------------
40 
41 template <typename TPoint>
42 inline
44 {
45 }
46 
47 template <typename TPoint>
48 inline
50 {
51 }
52 
53 template <typename TPoint>
54 inline
55 void
57  const Point& aFirstPoint,
58  const Point& aSecondPoint)
59 {
60  myP = aFirstPoint;
61  myQ = aSecondPoint;
62 }
63 
64 
65 template <typename TPoint>
66 inline
68  const Point& aFirstPoint,
69  const Point& aSecondPoint):
70  myP(aFirstPoint),
71  myQ(aSecondPoint)
72 {
73 }
74 
75 
76 template <typename TPoint>
77 inline
79  const StraightLineFrom2Points & other):
80  myP(other.myP),
81  myQ(other.myQ)
82 {
83 }
84 
85 
86 template <typename TPoint>
87 inline
90  const StraightLineFrom2Points & other)
91 {
92  myP = other.myP;
93  myQ = other.myQ;
94  return *this;
95 }
96 
97 
98 
99 template <typename TPoint>
100 inline
103 {
104  Vector pq = myQ - myP;
105  Vector pr = aP - myP;
106  //computation of det(pq, pr)
107  //(= twice the parallelogram area)
108  return ((pq.at(0) * pr.at(1)) - (pq.at(1) * pr.at(0)));
109 }
110 
111 
113 // Interface - public :
114 
115 template <typename TPoint>
116 inline
117 std::string
119 {
120  return "StraightLineFrom2Points";
121 }
122 
123 template <typename TPoint>
124 inline
125 void
127 {
128  out << "[StraightLineFrom2Points] passing through:\n";
129  out << myP << myQ;
130 }
131 
132 template <typename TPoint>
133 inline
134 bool
136 {
137  return true;
138 }
139 
140