24 template <
class numeric_type>
30 line(numeric_type end1_x = 0, numeric_type end1_y = 0,
31 numeric_type end2_x = 0, numeric_type end2_y = 0);
64 template <
class numeric_type>
67 : _endpoint_1(p1), _endpoint_2(p2) {}
69 template <
class numeric_type>
72 : _endpoint_1(
point<numeric_type>(x1, y1)),
73 _endpoint_2(
point<numeric_type>(x2, y2))
76 template <
class numeric_type>
80 _endpoint_1.y() / 2.0 + _endpoint_2.y() / 2.0);
83 template <
class numeric_type>
90 template <
class numeric_type>
93 { _endpoint_1 += to_add; _endpoint_2 += to_add;
return *
this; }
95 template <
class numeric_type>
98 { _endpoint_1 -= to_subtract; _endpoint_2 -= to_subtract;
return *
this; }
100 template <
class numeric_type>
105 template <
class numeric_type>
110 to_return -= to_subtract;
114 template <
class numeric_type>
116 {
return _endpoint_1; }
118 template <
class numeric_type>
120 {
return _endpoint_2; }
122 template <
class numeric_type>
124 { _endpoint_1 = to_set; }
126 template <
class numeric_type>
128 { _endpoint_2 = to_set; }
Provides a dynamically resizable ASCII character string.
virtual void text_form(base_string &state_fill) const
Provides a text view of all the important info owned by this object.
Represents a geometric line segment.
line & operator+=(const point< numeric_type > &to_add)
void endpoint_1(const point< numeric_type > &to_set)
point< numeric_type > center() const
Returns the point at the center of the line segment.
void endpoint_2(const point< numeric_type > &to_set)
line operator+(const point< numeric_type > &to_add) const
line(numeric_type end1_x=0, numeric_type end1_y=0, numeric_type end2_x=0, numeric_type end2_y=0)
point< numeric_type > _endpoint_1
point< numeric_type > endpoint_2() const
line & operator-=(const point< numeric_type > &to_subtract)
Adds or subtracts a point from ‘this’ line.
point< numeric_type > _endpoint_2
line operator-(const point< numeric_type > &to_subtract) const
Returns this line with "to_add" added to it.
basis::astring text_form() const
returns a string form of the points defining the line.
line(const point< numeric_type > &endpoint1, const point< numeric_type > &endpoint2)
point< numeric_type > endpoint_1() const
Represents a geometric point.
Contains all of our objects for geometry and avoids name clashes.