Vector

class Vector

Vector in 3D space.

Public Functions

Vector()

Construct zero vector.

explicit Vector(double x, double y = 0., double z = 0.)

Construct vector with given coordinates.

explicit Vector(const Point &pt)

Construct vector from point.

double magnitude() const

Compute magnitude of the vector.

Returns:

MAgnitude of the vector

void normalize()

Normalize the vector.

Vector normalized() const

Return normalized vector.

Returns:

Normalized vector

void rotate(const Axis1 &axis, double angle)

Rotate vector around axis.

Parameters:
  • axis – Axis of rotation

  • angle – Angle of rotation

Vector rotated(const Axis1 &axis, double angle) const

Rotate vector around axis.

Parameters:
  • axis – Axis of rotation

  • angle – Angle of rotation

Returns:

Rotated vector

Public Members

double x

X-component.

double y

Y-component.

double z

Z-component.