#include <vec3.h>

Public Types | |
|
typedef af::tiny_plain < NumType, 3 > | base_type |
Public Member Functions | |
| vec3 () | |
| Default constructor. Elements are not initialized. | |
| vec3 (NumType const &e) | |
| All elements are initialized with e. | |
| vec3 (NumType const &e0, NumType const &e1, NumType const &e2) | |
| Constructor. | |
| vec3 (base_type const &a) | |
| Constructor. | |
| vec3 (const NumType *a) | |
| Constructor. | |
| bool | is_zero () const |
| Test if all elements are 0. | |
| NumType | min () const |
| Minimum of vector elements. | |
| NumType | max () const |
| Maximum of vector elements. | |
| void | each_update_min (vec3 const &other) |
| In-place minimum of this and other for each element. | |
| void | each_update_max (vec3 const &other) |
| In-place maximum of this and other for each element. | |
| NumType | sum () const |
| Sum of vector elements. | |
| NumType | product () const |
| Product of vector elements. | |
| vec3 | cross (vec3 const &other) const |
| Cross product. | |
| template<typename NumTypeRhs> | |
| vec3< typename af::binary_operator_traits < NumType, NumTypeRhs > ::arithmetic > | each_mul (vec3< NumTypeRhs > const &rhs) const |
| Element-wise multiplication. | |
| NumType | length_sq () const |
| Return the length squared of the vector. | |
| NumType | length () const |
| Return the length of the vector. | |
| vec3 | normalize () const |
| Return normalized vector. | |
| NumType | angle (vec3 const &other) const |
| Return angle (in radians) between this and other. | |
| vec3 | reflect (vec3 const &n) const |
| Return the reflection vector. | |
| vec3 | refract (vec3 const &n, NumType const &eta) const |
| Return the transmitted vector. | |
| vec3 | ortho (bool normalize=false) const |
| Returns a vector that is orthogonal to this. | |
| af::tiny< NumType, 3 > | as_tiny () const |
| Copies the vector to a tiny instance. | |
This class can be used to represent points, vectors, normals or even colors. The usual vector operations are available.
C++ version of the python vec3 class by Matthias Baas (baas@ira.uka.de). See http://cgkit.sourceforge.net/ for more information.
Return the reflection vector.
| n | is the surface normal which has to be of unit length. |
Return the transmitted vector.
| n | is the surface normal which has to be of unit length. | |
| eta | is the relative index of refraction. If the returned vector is zero then there is no transmitted light because of total internal reflection. |
| vec3< NumType > ortho | ( | bool | normalize = false |
) | const [inline] |
Returns a vector that is orthogonal to this.
If normalize is true, given the null vector (within floating-point precision) the result is (0,0,1).
Referenced by terminal_tetrahedral_XHn::initialise_more_in_context(), and scitbx::math::r3_rotation::vector_to_vector().
1.5.6