ROME 2 Lab5

Embed: (wiki syntax)

« Back to documentation index

Point Class Reference

Point Class Reference

This class stores the coordinates of a point in two dimensions. More...

#include <Point.h>

Public Member Functions

 Point ()
 Creates a Point object.
 Point (float r, float alpha)
 Creates a Point object from given polar coordinates.
virtual ~Point ()
 Deletes this object.
float distance ()
 Calculates the distance of this point from the origin.
float distance (Point &point)
 Calculates the distance between this point and a given point.
float manhattanDistance ()
 Calculates the manhattan distance of this point from the origin.
float manhattanDistance (Point &point)
 Calculates the manhattan distance between this point and a given point.

Detailed Description

This class stores the coordinates of a point in two dimensions.

Definition at line 15 of file Point.h.


Constructor & Destructor Documentation

Point (  )

Creates a Point object.

Definition at line 15 of file Point.cpp.

Point ( float  r,
float  alpha 
)

Creates a Point object from given polar coordinates.

Parameters:
rthe radius of a point.
alphathe angle of a point.

Definition at line 28 of file Point.cpp.

~Point (  ) [virtual]

Deletes this object.

Definition at line 40 of file Point.cpp.


Member Function Documentation

float distance (  )

Calculates the distance of this point from the origin.

Definition at line 45 of file Point.cpp.

float distance ( Point point )

Calculates the distance between this point and a given point.

Parameters:
pointanother point to calculate the distance to.

Definition at line 54 of file Point.cpp.

float manhattanDistance (  )

Calculates the manhattan distance of this point from the origin.

This calculation is only an approximation, but a lot faster to compute.

Definition at line 63 of file Point.cpp.

float manhattanDistance ( Point point )

Calculates the manhattan distance between this point and a given point.

This calculation is only an approximation, but a lot faster to compute.

Parameters:
pointanother point to calculate the distance to.

Definition at line 73 of file Point.cpp.