Thunderbots Project
Loading...
Searching...
No Matches
Segment Class Referencefinal

Public Member Functions

 Segment ()
 
 Segment (const Point &start, const Point &end)
 
void setStart (Point o)
 
const PointgetStart () const
 
void setEnd (Point o)
 
const PointgetEnd () const
 
double length () const
 
double lengthSquared () const
 
Segment reverse () const
 
Vector toVector () const
 
Point midPoint () const
 
bool operator== (const Segment &other) const
 

Constructor & Destructor Documentation

◆ Segment() [1/2]

Segment ( )

Creates a degenerate Segment at (0, 0)

◆ Segment() [2/2]

Segment ( const Point start,
const Point end 
)

Creates a Segment that starts and ends at the given points

Member Function Documentation

◆ getEnd()

const Point & getEnd ( ) const

Gets the end point of the segment

Returns
end point of segment

◆ getStart()

const Point & getStart ( ) const

Gets the start point of the segment

Returns
start point of segment

◆ length()

double length ( ) const

Gets the length of the segment

Returns
length of segment

◆ lengthSquared()

double lengthSquared ( ) const

Gets the squared length of the segment

Returns
squared length of segment

◆ midPoint()

Point midPoint ( ) const

Gets mid point of the Segment, halfway between the start and end points

Returns
mid point

◆ operator==()

bool operator== ( const Segment other) const

Compares with another segment for equality

Parameters
otherthe other segment
Returns
true if segment is equal to other, and false otherwise.

◆ reverse()

Segment reverse ( ) const

Creates a Segment that is reversed

Returns
reversed segment

◆ setEnd()

void setEnd ( Point  o)

Sets the end point of the segment to o

Parameters
onew end point of segment

◆ setStart()

void setStart ( Point  o)

Sets the start point of the segment to o

Parameters
onew start point of segment

◆ toVector()

Vector toVector ( ) const

Makes a Vector out of this Segment

Returns
vector representation of the segment

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