liba 0.1.15
An algorithm library based on C/C++
Loading...
Searching...
No Matches
vector3.h File Reference

three-dimensional vector More...

#include "a.h"
#include "math.h"
Include dependency graph for vector3.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  a_vector3
 instance structure for three-dimensional vector More...

Macros

#define A_VECTOR3_C(x, y, z)
#define a_vector3_c(x)
#define a_vector3_(_, x)

Typedefs

typedef struct a_vector3 a_vector3
typedef struct a_vector3 a::vector3

Functions

a_real a_vector3_set_dir (a_vector3 *ctx, a_real x, a_real y, a_real z)
 set the components of a 3D vector and normalize it in place.
void a_vector3_val (a_vector3 const *ctx, a_real *x, a_real *y, a_real *z)
 get the cartesian coordinates of a 3D vector.
void a_vector3_set_val (a_vector3 *ctx, a_real x, a_real y, a_real z)
 set the cartesian coordinates of a 3D vector.
void a_vector3_cyl (a_vector3 const *ctx, a_real *rho, a_real *theta, a_real *z)
 get the cylindrical coordinates of a 3D vector.
void a_vector3_set_cyl (a_vector3 *ctx, a_real rho, a_real theta, a_real z)
 set the cylindrical coordinates of a 3D vector.
void a_vector3_sph (a_vector3 const *ctx, a_real *rho, a_real *theta, a_real *alpha)
 get the spherical coordinates of a 3D vector.
void a_vector3_set_sph (a_vector3 *ctx, a_real rho, a_real theta, a_real alpha)
 set the spherical coordinates of a 3D vector.
void a_vector3_add (a_vector3 const *lhs, a_vector3 const *rhs, a_vector3 *res)
 add a 3D vector to a 3D vector.
void a_vector3_sub (a_vector3 const *lhs, a_vector3 const *rhs, a_vector3 *res)
 subtract a 3D vector from a 3D vector.
void a_vector3_mul (a_vector3 const *lhs, a_real rhs, a_vector3 *res)
 multiplie a 3D vector by a scalar.
void a_vector3_div (a_vector3 const *lhs, a_real rhs, a_vector3 *res)
 divide a 3D vector by a scalar.
void a_vector3_neg (a_vector3 const *ctx, a_vector3 *res)
 negate a 3D vector.
a_real a_vector3_unit (a_vector3 *ctx)
 normalize a 3D vector in-place to unit length.
a_real a_vector3_norm (a_vector3 const *ctx)
 compute the magnitude of a 3D vector.
a_real a_vector3_norm2 (a_vector3 const *ctx)
 compute the squared magnitude of a 3D vector.
a_real a_vector3_dot (a_vector3 const *lhs, a_vector3 const *rhs)
 compute the dot product (scalar product) of two 3D vectors.
a_real a_vector3_dist (a_vector3 const *lhs, a_vector3 const *rhs)
 compute the distance between two 3D vectors.
a_real a_vector3_dist2 (a_vector3 const *lhs, a_vector3 const *rhs)
 compute the squared distance between two 3D vectors.
a_real a_vector3_angle (a_vector3 const *lhs, a_vector3 const *rhs)
 compute the angle between two 3D vectors in radians.
a_bool a_vector3_isver (a_vector3 const *lhs, a_vector3 const *rhs)
 check if two 3D vectors are orthogonal.
a_bool a_vector3_ispar (a_vector3 const *lhs, a_vector3 const *rhs)
 check if two 3D vectors are parallel or anti-parallel.
void a_vector3_cross (a_vector3 const *lhs, a_vector3 const *rhs, a_vector3 *res)
 compute the cross product (vector product) of two 3D vectors
void a_vector3_outer (a_vector3 const *lhs, a_vector3 const *rhs, a_real res[9])
 compute the outer product (tensor product) of two 3D vectors.
int a_vector3_ortho (a_vector3 const *ctx, a_vector3 *u, a_vector3 *v)
 construct an orthonormal basis from a given 3D direction vector.
int a_vector3_proj (a_vector3 const *ctx, a_vector3 const *dir, a_vector3 *res)
 project vector onto the direction of vector.
int a_vector3_perp (a_vector3 const *ctx, a_vector3 const *dir, a_vector3 *res)
 project vector onto the plane perpendicular to normal vector.
int a_vector3_refl (a_vector3 const *ctx, a_vector3 const *dir, a_vector3 *res)
 reflect vector across the plane perpendicular to normal vector.
int a_vector3_sym1 (a_vector3 const *ctx, a_vector3 const *dir, a_vector3 *res)
 reflect vector across the line with direction vector.
void a_vector3_rot_ (a_vector3 const *ctx, a_vector3 const *dir, a_real sin, a_real cos, a_vector3 *res)
 rotate a 3D vector around an arbitrary unit axis using Rodrigues' rotation formula.
void a_vector3_rot (a_vector3 const *ctx, a_vector3 const *dir, a_real angle, a_vector3 *res)
 rotate a 3D vector around an arbitrary unit axis using Rodrigues' rotation formula.
void a_vector3_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.

Detailed Description

three-dimensional vector