CSCI 3081 - Drone Delivery System
Public Member Functions | List of all members
csci3081::Vector2D Class Reference

This is the Vector2D class. More...

#include <vector.h>

Inheritance diagram for csci3081::Vector2D:
Inheritance graph

Public Member Functions

 Vector2D ()
 Constructor. This sets up an instance of Vector2D with zero coordinates.
 
 Vector2D (std::vector< float > arg)
 Constructor. This sets up an instance of Vector2D with 2 coordinates as arguments. More...
 
 Vector2D (float x_, float z_)
 Constructor. This sets up an instance of Vector3D with 3 coordinates as arguments. More...
 
 Vector2D (const Vector2D &)
 Copy Constructor. This creates a new instance of Vector2D that has the same content as the Vector2D argument. More...
 
Vector2D operator+ (const Vector2D &)
 overloading operator + to do addition between Vector2D instances More...
 
Vector2D operator- (const Vector2D &)
 overloading operator - to do addition between Vector2D instances More...
 
Vector2D operator* (float)
 overloading operator * to do multiply a Vector2D instance to a float More...
 
Vector2D operator/ (float)
 overloading operator / to do division a Vector2D instance to a float More...
 
Vector2Doperator= (const Vector2D &)
 overloading operator = to copy one Vector2D to another More...
 
Vector2D Normalize ()
 This function normalizes a Vector2D instance.
 
void Print ()
 Function to print the coordinate of a vector instance. More...
 
- Public Member Functions inherited from csci3081::Vector
void SetX (float x_)
 This function uses to set x coordinator of a vector instance.
 
void SetZ (float z_)
 This function uses to set z coordinator of a vector instance.
 
float GetX () const
 This function uses to get x coordinator of a vector instance.
 
float GetZ () const
 This function uses to get z coordinator of a vector instance.
 
float GetY () const
 This function uses to get y coordinator of a vector instance.
 
float Magnitude ()
 This function returns the magitude of a vector instance.
 
bool operator== (const Vector &)
 Convert vector distance to std::vector<float> instances. More...
 

Additional Inherited Members

- Protected Attributes inherited from csci3081::Vector
float x
 
float y
 
float z
 Coordinates of a vector.
 

Detailed Description

This is the Vector2D class.

This class instantiates a Vector2D object and with basic overload math expression that can be done with Vector in 2D

Constructor & Destructor Documentation

◆ Vector2D() [1/3]

csci3081::Vector2D::Vector2D ( std::vector< float >  arg)

Constructor. This sets up an instance of Vector2D with 2 coordinates as arguments.

Parameters
[in]argstd::vector<float> that stores coordinates

◆ Vector2D() [2/3]

csci3081::Vector2D::Vector2D ( float  x_,
float  z_ 
)

Constructor. This sets up an instance of Vector3D with 3 coordinates as arguments.

Parameters
[in]x_float, x-coordinate
[in]z_float, z-coordinate

◆ Vector2D() [3/3]

csci3081::Vector2D::Vector2D ( const Vector2D copy)

Copy Constructor. This creates a new instance of Vector2D that has the same content as the Vector2D argument.

Parameters
[in]copyVector2D instance that wants to be copied

Member Function Documentation

◆ operator*()

Vector2D csci3081::Vector2D::operator* ( float  other)

overloading operator * to do multiply a Vector2D instance to a float

Parameters
otherfloat factor that want to multiply the Vector2D with

◆ operator+()

Vector2D csci3081::Vector2D::operator+ ( const Vector2D other)

overloading operator + to do addition between Vector2D instances

Parameters
otherthe right hand side Vector2D of the addition

◆ operator-()

Vector2D csci3081::Vector2D::operator- ( const Vector2D other)

overloading operator - to do addition between Vector2D instances

Parameters
otherthe right hand side Vector2D of the subtraction

◆ operator/()

Vector2D csci3081::Vector2D::operator/ ( float  other)

overloading operator / to do division a Vector2D instance to a float

Parameters
otherfloat factor that want to divide the Vector2D with

◆ operator=()

Vector2D & csci3081::Vector2D::operator= ( const Vector2D cpy)

overloading operator = to copy one Vector2D to another

Parameters
cpythe Vector2D object that wants to copy

◆ Print()

void csci3081::Vector2D::Print ( )
virtual

Function to print the coordinate of a vector instance.

Implements csci3081::Vector.


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