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

#include <point.h>

Public Member Functions

 Point ()
 
 Point (double x, double y)
 
 Point (const Point &p)
 
 Point (const Vector &v)
 
double x () const
 
double y () const
 
void set (double x, double y)
 
void setX (double x)
 
void setY (double y)
 
double distanceFromOrigin () const
 
Vector toVector () const
 
Point rotate (const Angle &rot) const
 
Pointoperator= (const Point &other)
 

Detailed Description

A point in 2D space.

Constructor & Destructor Documentation

◆ Point() [1/4]

Point ( )
explicit

Creates a Point at the origin (0, 0).

◆ Point() [2/4]

Point ( double  x,
double  y 
)

Creates a Point at arbitrary coordinates.

Parameters
xthe x value of the Point
ythe y value of the Point

◆ Point() [3/4]

Point ( const Point p)

Creates a new Point that is a copy of the given Point

Parameters
thePoint to duplicate

◆ Point() [4/4]

Point ( const Vector v)
explicit

Creates a new Point from a Vector

Parameters
theVector to create a Point from

Member Function Documentation

◆ distanceFromOrigin()

double distanceFromOrigin ( ) const

Returns the distance between this Point and origin (0,0)

Returns
the distance

◆ operator=()

Point & operator= ( const Point other)

Assigns one Point to another

Parameters
otherthe Point whose value should be copied into this Point
Returns
this Point

◆ rotate()

Point rotate ( const Angle rot) const

Returns a new Point that is this Point rotated counterclockwise by an angle about the origin.

Parameters
rotthe angle to rotate the Point
Returns
the new Point rotated by rot

◆ set()

void set ( double  x,
double  y 
)

Sets the coordinates of this point to the new coordinates

Parameters
xthe new x coordinate
ythe new y coordinate

◆ setX()

void setX ( double  x)

Sets the x coordinate of this point

Parameters
xthe new x coordinate

◆ setY()

void setY ( double  y)

Sets the y coordinate of this point

Parameters
ythe new y coordinate

◆ toVector()

Vector toVector ( ) const

Returns a new Vector from this Point

Returns
A new vector from this Point

◆ x()

double x ( ) const

Returns the x coordinate of this Point

Returns
the x coordinate of this Point

◆ y()

double y ( ) const

Returns the y coordinate of this Point

Returns
the y coordinate of this Point

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