Antiprism 0.23
Classes | Functions

base/vec3d.h File Reference

Vector for 3D geometry. More...

#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include "const.h"
#include "rand_gen.h"
#include "math_utils.h"
Include dependency graph for vec3d.h:
This graph shows which files directly or indirectly include this file:

Classes

class  vec3d
 Vector with 3 components. More...

Functions

vec3d operator+ (vec3d v1, vec3d v2)
 Add two vectors.
vec3d operator- (vec3d v1, vec3d v2)
 Subtract one vector from another.
vec3d operator- (vec3d v)
 The negative of a vector.
vec3d operator* (vec3d v, double n)
 Multiply a vector by a scalar.
vec3d operator* (double n, vec3d v)
 Multiply a vector by a scalar.
vec3d operator/ (vec3d v, double n)
 Divide a vector by a scalar.
vec3d vcross (const vec3d &v1, const vec3d &v2)
 The cross product (vector product)
double vdot (const vec3d &v1, const vec3d &v2)
 The dot product (scalar product)
double vtriple (vec3d v1, vec3d v2, vec3d v3)
 The triple product.

Detailed Description

Vector for 3D geometry.

A vector class with common vector operations.


Function Documentation

vec3d operator* ( vec3d  v,
double  n 
) [inline]

Multiply a vector by a scalar.

Parameters:
vthe vector
nthe scalar
Returns:
The resulting vector (n * v).
vec3d operator* ( double  n,
vec3d  v 
) [inline]

Multiply a vector by a scalar.

Parameters:
nthe scalar
vthe vector
Returns:
The resulting vector (n * v).
vec3d operator+ ( vec3d  v1,
vec3d  v2 
) [inline]

Add two vectors.

Parameters:
v1a vector
v2a vector to add
Returns:
The resulting vector (v1 + v2).
vec3d operator- ( vec3d  v1,
vec3d  v2 
) [inline]

Subtract one vector from another.

Parameters:
v1a vector
v2a vector to subtract
Returns:
The resulting vector (v1 - v2).
vec3d operator- ( vec3d  v) [inline]

The negative of a vector.

Parameters:
va vector
Returns:
The negative of the vector (-v).
vec3d operator/ ( vec3d  v,
double  n 
) [inline]

Divide a vector by a scalar.

Parameters:
vthe vector
nthe scalar
Returns:
The resulting vector (1/n * v).
vec3d vcross ( const vec3d v1,
const vec3d v2 
) [inline]

The cross product (vector product)

Parameters:
v1the first vector
v2the second vector
Returns:
The cross product (v1 x v2).
double vdot ( const vec3d v1,
const vec3d v2 
) [inline]

The dot product (scalar product)

Parameters:
v1the first vector
v2the second vector
Returns:
The dot product (v1 . v2).
double vtriple ( vec3d  v1,
vec3d  v2,
vec3d  v3 
) [inline]

The triple product.

Parameters:
v1the first vector
v2the second vector
v3the third vector
Returns:
The dot product (v1 . (v2 x v3).