liba 0.1.15
An algorithm library based on C/C++
Loading...
Searching...
No Matches
a_vector3 Struct Reference

instance structure for three-dimensional vector More...

#include <vector3.h>

Public Member Functions

void set (a_point3 const &p, a_point3 const &q)
 set a 3D vector as the difference from point p to point q.
a_real set_dir (a_real x_, a_real y_, a_real z_)
 set the components of a 3D vector and normalize it in place.
void val (a_real &x_, a_real &y_, a_real &z_) const
 get the cartesian coordinates of a 3D vector.
void set_val (a_real x_, a_real y_, a_real z_)
 set the cartesian coordinates of a 3D vector.
void cyl (a_real &rho, a_real &theta, a_real &z_) const
 get the cylindrical coordinates of a 3D vector.
void set_cyl (a_real rho, a_real theta, a_real z_)
 set the cylindrical coordinates of a 3D vector.
void sph (a_real &rho, a_real &theta, a_real &alpha) const
 get the spherical coordinates of a 3D vector.
void set_sph (a_real rho, a_real theta, a_real alpha)
 set the spherical coordinates of a 3D vector.
void add (a_vector3 const &rhs, a_vector3 &res) const
 add a 3D vector to a 3D vector.
void sub (a_vector3 const &rhs, a_vector3 &res) const
 subtract a 3D vector from a 3D vector.
void mul (a_real rhs, a_vector3 &res) const
 multiplie a 3D vector by a scalar.
void div (a_real rhs, a_vector3 &res) const
 divide a 3D vector by a scalar.
void neg (a_vector3 &res) const
 negate a 3D vector.
a_real unit ()
 normalize a 3D vector in-place to unit length.
a_real norm () const
 compute the magnitude of a 3D vector.
a_real norm2 () const
 compute the squared magnitude of a 3D vector.
a_real dot (a_vector3 const &rhs) const
 compute the dot product (scalar product) of two 3D vectors.
a_real dist (a_vector3 const &rhs) const
 compute the distance between two 3D vectors.
a_real dist2 (a_vector3 const &rhs) const
 compute the squared distance between two 3D vectors.
a_real angle (a_vector3 const &rhs) const
 compute the angle between two 3D vectors in radians.
a_bool isver (a_vector3 const &rhs) const
 check if two 3D vectors are orthogonal.
a_bool ispar (a_vector3 const &rhs) const
 check if two 3D vectors are parallel or anti-parallel.
void cross (a_vector3 const &rhs, a_vector3 &res) const
 compute the cross product (vector product) of two 3D vectors
void outer (a_vector3 const &rhs, a_real res[9]) const
 compute the outer product (tensor product) of two 3D vectors.
int ortho (a_vector3 &u, a_vector3 &v) const
 construct an orthonormal basis from a given 3D direction vector.
int proj (a_vector3 const &dir, a_vector3 &res) const
 project vector onto the direction of vector.
int perp (a_vector3 const &dir, a_vector3 &res) const
 project vector onto the plane perpendicular to normal vector.
int refl (a_vector3 const &dir, a_vector3 &res) const
 reflect vector across the plane perpendicular to normal vector.
int sym1 (a_vector3 const &dir, a_vector3 &res) const
 reflect vector across the line with direction vector.
void rot (a_vector3 const &dir, a_real angle, a_vector3 &res) const
 rotate a 3D vector around an arbitrary unit axis using Rodrigues' rotation formula.
void rot (a_vector3 const &dir, a_real sin, a_real cos, a_vector3 &res) const
 rotate a 3D vector around an arbitrary unit axis using Rodrigues' rotation formula.

Static Public Member Functions

static void rot2d (a_vector3 const &iu, a_vector3 const &iv, a_real angle, a_vector3 &ou, a_vector3 &ov)
 rotate a 2D basis in the plane spanned by two orthogonal vectors.

Data Fields

a_real x
a_real y
a_real z

Friends

a_vector3 operator^ (a_vector3 const &lhs, a_vector3 const &rhs)
 compute the cross product (vector product) of two 3D vectors
void operator+= (a_vector3 &lhs, a_vector3 const &rhs)
 add a 3D vector to a 3D vector.
a_vector3 operator+ (a_vector3 const &lhs, a_vector3 const &rhs)
 add a 3D vector to a 3D vector.
void operator-= (a_vector3 &lhs, a_vector3 const &rhs)
 subtract a 3D vector from a 3D vector.
a_vector3 operator- (a_vector3 const &lhs, a_vector3 const &rhs)
 subtract a 3D vector from a 3D vector.
a_real operator* (a_vector3 const &lhs, a_vector3 const &rhs)
 compute the dot product (scalar product) of two 3D vectors.
void operator*= (a_vector3 &lhs, a_real rhs)
 multiplie a 3D vector by a scalar.
a_vector3 operator* (a_real lhs, a_vector3 const &rhs)
 multiplie a 3D vector by a scalar.
a_vector3 operator* (a_vector3 const &lhs, a_real rhs)
 multiplie a 3D vector by a scalar.
void operator/= (a_vector3 &lhs, a_real rhs)
 divide a 3D vector by a scalar.
a_vector3 operator/ (a_vector3 const &lhs, a_real rhs)
 divide a 3D vector by a scalar.
a_vector3 operator+ (a_vector3 const &rhs)
a_vector3 operator- (a_vector3 const &rhs)
 negate a 3D vector.

Detailed Description

instance structure for three-dimensional vector

Member Function Documentation

◆ add()

void a_vector3::add ( a_vector3 const & rhs,
a_vector3 & res ) const
inline

add a 3D vector to a 3D vector.

See also
a_vector3_add

◆ angle()

a_real a_vector3::angle ( a_vector3 const & rhs) const
inline

compute the angle between two 3D vectors in radians.

See also
a_vector3_angle

◆ cross()

void a_vector3::cross ( a_vector3 const & rhs,
a_vector3 & res ) const
inline

compute the cross product (vector product) of two 3D vectors

See also
a_vector3_cross

◆ cyl()

void a_vector3::cyl ( a_real & rho,
a_real & theta,
a_real & z_ ) const
inline

get the cylindrical coordinates of a 3D vector.

See also
a_vector3_cyl

◆ dist()

a_real a_vector3::dist ( a_vector3 const & rhs) const
inline

compute the distance between two 3D vectors.

See also
a_vector3_dist

◆ dist2()

a_real a_vector3::dist2 ( a_vector3 const & rhs) const
inline

compute the squared distance between two 3D vectors.

See also
a_vector3_dist2

◆ div()

void a_vector3::div ( a_real rhs,
a_vector3 & res ) const
inline

divide a 3D vector by a scalar.

See also
a_vector3_div

◆ dot()

a_real a_vector3::dot ( a_vector3 const & rhs) const
inline

compute the dot product (scalar product) of two 3D vectors.

See also
a_vector3_dot

◆ ispar()

a_bool a_vector3::ispar ( a_vector3 const & rhs) const
inline

check if two 3D vectors are parallel or anti-parallel.

See also
a_vector3_ispar

◆ isver()

a_bool a_vector3::isver ( a_vector3 const & rhs) const
inline

check if two 3D vectors are orthogonal.

See also
a_vector3_isver

◆ mul()

void a_vector3::mul ( a_real rhs,
a_vector3 & res ) const
inline

multiplie a 3D vector by a scalar.

See also
a_vector3_mul

◆ neg()

void a_vector3::neg ( a_vector3 & res) const
inline

negate a 3D vector.

See also
a_vector3_neg

◆ norm()

a_real a_vector3::norm ( ) const
inline

compute the magnitude of a 3D vector.

See also
a_vector3_norm

◆ norm2()

a_real a_vector3::norm2 ( ) const
inline

compute the squared magnitude of a 3D vector.

See also
a_vector3_norm2

◆ ortho()

int a_vector3::ortho ( a_vector3 & u,
a_vector3 & v ) const
inline

construct an orthonormal basis from a given 3D direction vector.

See also
a_vector3_ortho

◆ outer()

void a_vector3::outer ( a_vector3 const & rhs,
a_real res[9] ) const
inline

compute the outer product (tensor product) of two 3D vectors.

See also
a_vector3_outer

◆ perp()

int a_vector3::perp ( a_vector3 const & dir,
a_vector3 & res ) const
inline

project vector onto the plane perpendicular to normal vector.

See also
a_vector3_perp

◆ proj()

int a_vector3::proj ( a_vector3 const & dir,
a_vector3 & res ) const
inline

project vector onto the direction of vector.

See also
a_vector3_proj

◆ refl()

int a_vector3::refl ( a_vector3 const & dir,
a_vector3 & res ) const
inline

reflect vector across the plane perpendicular to normal vector.

See also
a_vector3_refl

◆ rot() [1/2]

void a_vector3::rot ( a_vector3 const & dir,
a_real angle,
a_vector3 & res ) const
inline

rotate a 3D vector around an arbitrary unit axis using Rodrigues' rotation formula.

See also
a_vector3_rot

◆ rot() [2/2]

void a_vector3::rot ( a_vector3 const & dir,
a_real sin,
a_real cos,
a_vector3 & res ) const
inline

rotate a 3D vector around an arbitrary unit axis using Rodrigues' rotation formula.

See also
a_vector3_rot_

◆ rot2d()

void a_vector3::rot2d ( a_vector3 const & iu,
a_vector3 const & iv,
a_real angle,
a_vector3 & ou,
a_vector3 & ov )
inlinestatic

rotate a 2D basis in the plane spanned by two orthogonal vectors.

See also
a_vector3_rot2d

◆ set_cyl()

void a_vector3::set_cyl ( a_real rho,
a_real theta,
a_real z_ )
inline

set the cylindrical coordinates of a 3D vector.

See also
a_vector3_set_cyl

◆ set_dir()

a_real a_vector3::set_dir ( a_real x_,
a_real y_,
a_real z_ )
inline

set the components of a 3D vector and normalize it in place.

See also
a_vector3_set_dir

◆ set_sph()

void a_vector3::set_sph ( a_real rho,
a_real theta,
a_real alpha )
inline

set the spherical coordinates of a 3D vector.

See also
a_vector3_set_sph

◆ set_val()

void a_vector3::set_val ( a_real x_,
a_real y_,
a_real z_ )
inline

set the cartesian coordinates of a 3D vector.

See also
a_vector3_set_val

◆ sph()

void a_vector3::sph ( a_real & rho,
a_real & theta,
a_real & alpha ) const
inline

get the spherical coordinates of a 3D vector.

See also
a_vector3_sph

◆ sub()

void a_vector3::sub ( a_vector3 const & rhs,
a_vector3 & res ) const
inline

subtract a 3D vector from a 3D vector.

See also
a_vector3_sub

◆ sym1()

int a_vector3::sym1 ( a_vector3 const & dir,
a_vector3 & res ) const
inline

reflect vector across the line with direction vector.

See also
a_vector3_sym1

◆ unit()

a_real a_vector3::unit ( )
inline

normalize a 3D vector in-place to unit length.

See also
a_vector3_unit

◆ val()

void a_vector3::val ( a_real & x_,
a_real & y_,
a_real & z_ ) const
inline

get the cartesian coordinates of a 3D vector.

See also
a_vector3_val

◆ operator* [1/3]

a_vector3 operator* ( a_real lhs,
a_vector3 const & rhs )
friend

multiplie a 3D vector by a scalar.

See also
a_vector3_mul

◆ operator* [2/3]

a_vector3 operator* ( a_vector3 const & lhs,
a_real rhs )
friend

multiplie a 3D vector by a scalar.

See also
a_vector3_mul

◆ operator* [3/3]

a_real operator* ( a_vector3 const & lhs,
a_vector3 const & rhs )
friend

compute the dot product (scalar product) of two 3D vectors.

See also
a_vector3_dot

◆ operator*=

void operator*= ( a_vector3 & lhs,
a_real rhs )
friend

multiplie a 3D vector by a scalar.

See also
a_vector3_mul

◆ operator+

a_vector3 operator+ ( a_vector3 const & lhs,
a_vector3 const & rhs )
friend

add a 3D vector to a 3D vector.

See also
a_vector3_add

◆ operator+=

void operator+= ( a_vector3 & lhs,
a_vector3 const & rhs )
friend

add a 3D vector to a 3D vector.

See also
a_vector3_add

◆ operator- [1/2]

a_vector3 operator- ( a_vector3 const & lhs,
a_vector3 const & rhs )
friend

subtract a 3D vector from a 3D vector.

See also
a_vector3_sub

◆ operator- [2/2]

a_vector3 operator- ( a_vector3 const & rhs)
friend

negate a 3D vector.

See also
a_vector3_neg

◆ operator-=

void operator-= ( a_vector3 & lhs,
a_vector3 const & rhs )
friend

subtract a 3D vector from a 3D vector.

See also
a_vector3_sub

◆ operator/

a_vector3 operator/ ( a_vector3 const & lhs,
a_real rhs )
friend

divide a 3D vector by a scalar.

See also
a_vector3_div

◆ operator/=

void operator/= ( a_vector3 & lhs,
a_real rhs )
friend

divide a 3D vector by a scalar.

See also
a_vector3_div

◆ operator^

a_vector3 operator^ ( a_vector3 const & lhs,
a_vector3 const & rhs )
friend

compute the cross product (vector product) of two 3D vectors

See also
a_vector3_cross

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