Advanced Strategic Command
Public Member Functions | List of all members
Vector2D Class Reference

A Vector2D is a line (without a defined start point) in a 2 dimensional space and is deccribed by its x- and y component. More...

#include <weatherarea.h>

Public Member Functions

 Vector2D ()
 Default constructor. More...
 
 Vector2D (int x, int y)
 Constructor for creating a new vector. More...
 
 ~Vector2D ()
 Destructor. More...
 
int getXComponent () const
 Retrieves the xComponent of the Vector. More...
 
int getYComponent () const
 Retrieves the yComponent of the Vector. More...
 
double getLength () const
 Calculates the length of the vector (Pythagoras) More...
 
bool isZeroVector () const
 Checks if the vector is the zero-vector. More...
 

Detailed Description

A Vector2D is a line (without a defined start point) in a 2 dimensional space and is deccribed by its x- and y component.

Author
Kevin Hirschmann

Definition at line 33 of file weatherarea.h.

Constructor & Destructor Documentation

Vector2D::Vector2D ( )

Default constructor.

Definition at line 30 of file weatherarea.cpp.

Vector2D::Vector2D ( int  x,
int  y 
)

Constructor for creating a new vector.

Parameters
xThe xComponent
yThe yComponent

Definition at line 32 of file weatherarea.cpp.

Vector2D::~Vector2D ( )

Destructor.

Definition at line 34 of file weatherarea.cpp.

Member Function Documentation

double Vector2D::getLength ( ) const

Calculates the length of the vector (Pythagoras)

Returns
The length of the Vector

Definition at line 43 of file weatherarea.cpp.

int Vector2D::getXComponent ( ) const

Retrieves the xComponent of the Vector.

Returns
the xComponent

Definition at line 36 of file weatherarea.cpp.

Referenced by WeatherField::move(), and WeatherArea::write().

int Vector2D::getYComponent ( ) const

Retrieves the yComponent of the Vector.

Returns
the yComponent

Definition at line 40 of file weatherarea.cpp.

Referenced by WeatherField::move(), and WeatherArea::write().

bool Vector2D::isZeroVector ( ) const

Checks if the vector is the zero-vector.

Returns
true if x- and yComponent == 0; flase otherwise

Definition at line 47 of file weatherarea.cpp.

Referenced by WeatherArea::update().


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