lineSegment2D.h
Go to the documentation of this file.00001
00015 #ifndef DLR_GEOMETRY_LINESEGMENT2D_H
00016 #define DLR_GEOMETRY_LINESEGMENT2D_H
00017
00018 #include <iostream>
00019 #include <dlrNumeric/vector2D.h>
00020
00021 namespace dlr {
00022
00023 namespace geometry {
00024
00028 class LineSegment2D {
00029 public:
00030
00035 LineSegment2D()
00036 : m_startPoint(0.0, 0.0), m_endPoint(1.0, 0.0) {}
00037
00038
00048 LineSegment2D(const Vector2D& startPoint,
00049 const Vector2D& endPoint)
00050 : m_startPoint(startPoint), m_endPoint(endPoint) {}
00051
00052
00059 LineSegment2D(const LineSegment2D& source)
00060 : m_startPoint(source.m_startPoint), m_endPoint(source.m_endPoint) {}
00061
00062
00066 ~LineSegment2D() {}
00067
00068
00077 LineSegment2D&
00078 operator=(const LineSegment2D& source);
00079
00080
00087 const Vector2D&
00088 getEndPoint() const {return m_endPoint;}
00089
00090
00097 const Vector2D&
00098 getVertex0() const {return m_startPoint;}
00099
00100
00107 const Vector2D&
00108 getVertex1() const {return m_endPoint;}
00109
00110
00117 const Vector2D&
00118 getStartPoint() const {return m_startPoint;}
00119
00120
00136 LineSegment2D&
00137 setValue(double startPointX, double startPointY,
00138 double endPointX, double endPointY) {
00139 m_startPoint.setValue(startPointX, startPointY);
00140 m_endPoint.setValue(endPointX, endPointY);
00141 return *this;
00142 }
00143
00144
00156 LineSegment2D&
00157 setValue(Vector2D const& startPoint, Vector2D const& endPoint) {
00158 m_startPoint = startPoint; m_endPoint = endPoint; return *this;
00159 }
00160
00161
00162 private:
00163
00164
00165
00166 Vector2D m_startPoint;
00167 Vector2D m_endPoint;
00168
00169 };
00170
00171
00172
00173
00174
00175 std::istream&
00176 operator>>(std::istream& stream, LineSegment2D& lineSegment);
00177
00178
00179 std::ostream&
00180 operator<<(std::ostream& stream, const LineSegment2D& lineSegment);
00181
00182
00183 }
00184
00185 }
00186
00187
00188
00189
00190 namespace dlr {
00191
00192 namespace geometry {
00193
00194
00195 }
00196
00197 }
00198
00199
00200 #endif