CMU462::Vector4D Class Reference

Defines 4D standard vectors. More...

`#include <vector4D.h>`

Inherited by CMU462::Quaternion.

## Public Member Functions

| Vector4D ()
| Constructor. More...
| Vector4D (double x, double y, double z, double w)
| Constructor. More...
| Vector4D (double x, double y, double z)
| Constructor. More...
| Vector4D (double c)
| Constructor. More...
| Vector4D (const Vector4D &v)
| Constructor. More...
| Vector4D (const Vector3D &v)
| Constructor. More...
| Vector4D (const Vector3D &v, double w)
| Constructor. More...
double | norm (void) const
| Returns Euclidean distance metric extended to 4 dimensions.
double | norm2 (void) const
| Returns Euclidean length squared.
Vector4D | unit (void) const
| Returns unit vector. More...
void | normalize (void)
| Divides by Euclidean length. More...
Vector3D | to3D ()
| Converts this vector to a 3D vector ignoring the w component.
Vector3D | projectTo3D ()
| Converts this vector to a 3D vector by dividing x, y, and z by w.

## Detailed Description

Defines 4D standard vectors.

## Constructor & Destructor Documentation

CMU462::Vector4D::Vector4D | ( |  | ) |

inline

Constructor.

Initializes tp vector (0,0,0, 0).

CMU462::Vector4D::Vector4D | ( | double | x,
|  | double | y,
|  | double | z,
|  | double | w
| ) |  |

inline

Constructor.

Initializes to vector (x,y,z,w).

CMU462::Vector4D::Vector4D | ( | double | x,
|  | double | y,
|  | double | z
| ) |  |

inline

Constructor.

Initializes to vector (x,y,z,0).

CMU462::Vector4D::Vector4D | ( | double | c | ) |

inline

Constructor.

Initializes to vector (c,c,c,c)

CMU462::Vector4D::Vector4D | ( | const Vector4D & | v | ) |

inline

Constructor.

Initializes from existing vector4D.

CMU462::Vector4D::Vector4D | ( | const Vector3D & | v | ) |

inline

Constructor.

Initializes from existing vector3D.

CMU462::Vector4D::Vector4D | ( | const Vector3D & | v,
|  | double | w
| ) |  |

inline

Constructor.

Initializes from existing vector3D and w value.

## Member Function Documentation

Vector4D CMU462::Vector4D::unit | ( | void |  | ) | const

inline

Returns unit vector.

(returns the normalized copy of this vector.)

void CMU462::Vector4D::normalize | ( | void |  | ) |

inline

Divides by Euclidean length.

This vector will be of unit length i.e. "normalized" afterwards.

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

- /Users/Sky/Dropbox/Projects/CMU462/private/p3/CMU462/include/CMU462/vector4D.h
- /Users/Sky/Dropbox/Projects/CMU462/private/p3/CMU462/src/vector4D.cpp