feisty meow concerns codebase  2.140
geometric::line< numeric_type > Class Template Reference

Represents a geometric line segment. More...

#include <line.h>

Public Member Functions

 line (const point< numeric_type > &endpoint1, const point< numeric_type > &endpoint2)
 
 line (numeric_type end1_x=0, numeric_type end1_y=0, numeric_type end2_x=0, numeric_type end2_y=0)
 
point< numeric_type > center () const
 Returns the point at the center of the line segment. More...
 
line operator+ (const point< numeric_type > &to_add) const
 
line operator- (const point< numeric_type > &to_subtract) const
 Returns this line with "to_add" added to it. More...
 
lineoperator+= (const point< numeric_type > &to_add)
 
lineoperator-= (const point< numeric_type > &to_subtract)
 Adds or subtracts a point from ‘this’ line. More...
 
point< numeric_type > endpoint_1 () const
 
point< numeric_type > endpoint_2 () const
 
void endpoint_1 (const point< numeric_type > &to_set)
 
void endpoint_2 (const point< numeric_type > &to_set)
 
basis::astring text_form () const
 returns a string form of the points defining the line. More...
 

Protected Attributes

point< numeric_type > _endpoint_1
 
point< numeric_type > _endpoint_2
 

Detailed Description

template<class numeric_type>
class geometric::line< numeric_type >

Represents a geometric line segment.

Definition at line 25 of file line.h.

Constructor & Destructor Documentation

◆ line() [1/2]

template<class numeric_type >
geometric::line< numeric_type >::line ( const point< numeric_type > &  endpoint1,
const point< numeric_type > &  endpoint2 
)

Definition at line 65 of file line.h.

◆ line() [2/2]

template<class numeric_type >
geometric::line< numeric_type >::line ( numeric_type  end1_x = 0,
numeric_type  end1_y = 0,
numeric_type  end2_x = 0,
numeric_type  end2_y = 0 
)

Definition at line 70 of file line.h.

Member Function Documentation

◆ center()

template<class numeric_type >
point< numeric_type > geometric::line< numeric_type >::center

Returns the point at the center of the line segment.

Definition at line 77 of file line.h.

◆ endpoint_1() [1/2]

template<class numeric_type >
point< numeric_type > geometric::line< numeric_type >::endpoint_1

Definition at line 115 of file line.h.

◆ endpoint_1() [2/2]

template<class numeric_type >
void geometric::line< numeric_type >::endpoint_1 ( const point< numeric_type > &  to_set)

Definition at line 123 of file line.h.

◆ endpoint_2() [1/2]

template<class numeric_type >
point< numeric_type > geometric::line< numeric_type >::endpoint_2

Definition at line 119 of file line.h.

◆ endpoint_2() [2/2]

template<class numeric_type >
void geometric::line< numeric_type >::endpoint_2 ( const point< numeric_type > &  to_set)

Definition at line 127 of file line.h.

◆ operator+()

template<class numeric_type >
line< numeric_type > geometric::line< numeric_type >::operator+ ( const point< numeric_type > &  to_add) const

Definition at line 101 of file line.h.

◆ operator+=()

template<class numeric_type >
line< numeric_type > & geometric::line< numeric_type >::operator+= ( const point< numeric_type > &  to_add)

Definition at line 91 of file line.h.

◆ operator-()

template<class numeric_type >
line< numeric_type > geometric::line< numeric_type >::operator- ( const point< numeric_type > &  to_subtract) const

Returns this line with "to_add" added to it.

This returns a line that is the result of adding or subtracting a point to the endpoints of this line.

Definition at line 106 of file line.h.

◆ operator-=()

template<class numeric_type >
line< numeric_type > & geometric::line< numeric_type >::operator-= ( const point< numeric_type > &  to_subtract)

Adds or subtracts a point from ‘this’ line.

Definition at line 96 of file line.h.

◆ text_form()

template<class numeric_type >
basis::astring geometric::line< numeric_type >::text_form

returns a string form of the points defining the line.

Definition at line 84 of file line.h.

References basis::astring::text_form().

Member Data Documentation

◆ _endpoint_1

template<class numeric_type >
point<numeric_type> geometric::line< numeric_type >::_endpoint_1
protected

Definition at line 56 of file line.h.

◆ _endpoint_2

template<class numeric_type >
point<numeric_type> geometric::line< numeric_type >::_endpoint_2
protected

Definition at line 57 of file line.h.


The documentation for this class was generated from the following file: