AngelCAD  1.5-00
Public Member Functions | List of all members
vec3d Class Reference

3d direction vector More...

#include <angelcad.h>

Public Member Functions

 vec3d (const pos3d@ p1, const pos3d@ p2)
 Construct direction vector as direction from p1 to p2. More...
 
 vec3d (const vec3d@ other)
 Construct direction vector from other vector. More...
 
 vec3d (double x, double y, double z)
 Create direction vector from x,y and z components. More...
 
double angle (const vec3d@ other) const
 angle between: double rad = v.angle(other); More...
 
double dot (const vec3d@ other) const
 dot product: double cp = v.dot(other); More...
 
double length () const
 length of vector More...
 
double x () const
 vector x component More...
 
double y () const
 vector y component More...
 
double z () const
 vector z component More...
 
vec3dcross (const vec3d@ other) const
 cross product: double cp = v.cross(other); More...
 
vec3dopAdd (vec3d@ v1)
 Add vector to vector, return new vector: vec3d@ v = v0 + v1. More...
 
vec3dopMul (double f1)
 Multiply vector with factor, return new vector: vec3d@ v = v0 * f1. More...
 
vec3dopMul_r (double f1)
 Multiply vector with factor, return new vector: vec3d@ v = f1 * v0. More...
 
vec3dopSub (vec3d@ v1)
 Subtract vector from vector, return new vector: vec3d@ v = v0 - v1. More...
 
void normalise ()
 normalise vector length More...
 

Detailed Description

3d direction vector

vec3d is a 3-dimensional vector offering useful operations such as dot and cross products.

Constructor & Destructor Documentation

◆ vec3d() [1/3]

vec3d::vec3d ( const pos3d p1,
const pos3d p2 
)

Construct direction vector as direction from p1 to p2.

Parameters
p1pos3d@
p2pos3d@

◆ vec3d() [2/3]

vec3d::vec3d ( const vec3d other)

Construct direction vector from other vector.

Parameters
othervec3d@

◆ vec3d() [3/3]

vec3d::vec3d ( double  x,
double  y,
double  z 
)

Create direction vector from x,y and z components.

Parameters
xdouble, vector x component
ydouble, vector y component
zdouble, vector z component

Member Function Documentation

◆ angle()

double vec3d::angle ( const vec3d other) const

angle between: double rad = v.angle(other);

Parameters
othervec3d@, vector to compute angle relative to this
Returns
double, angle value in radians

◆ cross()

vec3d@ vec3d::cross ( const vec3d other) const

cross product: double cp = v.cross(other);

Parameters
othervec3d@, vector to multiply with
Returns
vec3d@, cross product value

◆ dot()

double vec3d::dot ( const vec3d other) const

dot product: double cp = v.dot(other);

Parameters
othervec3d@, vector to multiply with
Returns
double, dot product value

◆ length()

double vec3d::length ( ) const

length of vector

Returns
double, length of vector

◆ normalise()

void vec3d::normalise ( )

normalise vector length

◆ opAdd()

vec3d@ vec3d::opAdd ( vec3d v1)

Add vector to vector, return new vector: vec3d@ v = v0 + v1.

Parameters
v1vec3d@
Returns
vec3d@

◆ opMul()

vec3d@ vec3d::opMul ( double  f1)

Multiply vector with factor, return new vector: vec3d@ v = v0 * f1.

Parameters
f1double
Returns
vec3d@

◆ opMul_r()

vec3d@ vec3d::opMul_r ( double  f1)

Multiply vector with factor, return new vector: vec3d@ v = f1 * v0.

Parameters
f1double
Returns
vec3d@

◆ opSub()

vec3d@ vec3d::opSub ( vec3d v1)

Subtract vector from vector, return new vector: vec3d@ v = v0 - v1.

Parameters
v1vec3d@
Returns
vec3d@

◆ x()

double vec3d::x ( ) const

vector x component

Returns
double, vector x component

◆ y()

double vec3d::y ( ) const

vector y component

Returns
double, vector y component

◆ z()

double vec3d::z ( ) const

vector z component

Returns
double, vector z component

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