![]() |
CS488 PA1
|
#include <Vector.h>
Public Member Functions | |
| Vector (int size) | |
| Vector (int size, char orientation) | |
| Vector (const Vector &original) | |
| ~Vector () | |
| double | get (int i) const |
| char | getOrientation () const |
| int | getSize () const |
| void | set (int i, double value) |
| void | setValues (double value) |
Static Public Attributes | |
| static const char | COLUMN = 'C' |
| static const char | ROW = 'R' |
Private Member Functions | |
| void | allocateMemory () |
| void | deallocateMemory () |
| void | setSize (int size, char orientation) |
Private Attributes | |
| char | orientation |
| double * | values |
| int | size |
The Vector class is an encapsulation of both n-dimensional points and n-dimensional directions.
|
explicit |
| Vector::Vector | ( | int | size, |
| char | orientation | ||
| ) |
Construct a column or row vector of given size.
Example of use:
| size | The size of the Vector |
| orientation | The orientation (either COLUMN or ROW) |
| Vector::Vector | ( | const Vector & | original | ) |
| Vector::~Vector | ( | ) |
Destructor.
|
private |
Allocate memory for this Vector.
|
private |
Deallocate the memory used by this Vector.
| double Vector::get | ( | int | i | ) | const |
Get a particular element of this Vector.
| i | The index of the element |
| char Vector::getOrientation | ( | ) | const |
Get the orientation of this Vector.
| int Vector::getSize | ( | ) | const |
| void Vector::set | ( | int | i, |
| double | value | ||
| ) |
Set a particular element of this Vector.
| i | The index of the element to assign |
| value | The value to assign |
|
private |
Set the size (and orientation) of this Vector. Note: This method should only be called by constructors.
| size | The size (default is 1); |
| orientation | The orientation (default is COLUMN) |
| void Vector::setValues | ( | double | value | ) |
Set all the elements of this Vector to a given value.
| value | The value |
|
static |
A constant that denotes a column Vector.
|
private |
The orientation (either ROW or COLUMN) of this Vector.
|
static |
A constant that denotes a row Vector.
|
private |
The number of elements in this Vector (which are numbered from 0 to size-1).
|
private |
A pointer to the (0-based) array of values in this Vector.
1.8.13