#include <vec2.h>

Public Types | |
|
typedef af::tiny_plain < NumType, 2 > | base_type |
Public Member Functions | |
| vec2 () | |
| Default constructor. Elements are not initialized. | |
| vec2 (NumType const &e) | |
| All elements are initialized with e. | |
| vec2 (NumType const &e0, NumType const &e1) | |
| Constructor. | |
| vec2 (base_type const &a) | |
| Constructor. | |
| vec2 (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 (vec2 const &other) |
| In-place minimum of this and other for each element. | |
| void | each_update_max (vec2 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. | |
| NumType | length_sq () const |
| Return the length squared of the vector. | |
| NumType | length () const |
| Return the length of the vector. | |
| vec2 | normalize () const |
| Return normalized vector. | |
| NumType | angle (vec2 const &other) const |
| Return angle (in radians) between this and other. | |
| vec2 | reflect (vec2 const &n) const |
| Return the reflection vector. | |
| vec2 | refract (vec2 const &n, NumType const &eta) const |
| Return the transmitted vector. | |
| vec2 | ortho () const |
| Returns an orthogonal vector. | |
| af::tiny< NumType, 2 > | as_tiny () const |
| Copies the vector to a tiny instance. | |
This class can be used to represent points, vectors, normals. The usual vector operations are available.
A 2D adaptation of the scitbx::vec3 class Future: Unify this with vec3 class using dimensionality as a template argument.
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. |
| vec2 ortho | ( | ) | const [inline] |
Returns an orthogonal vector.
Returns a vector that is orthogonal to this.
1.5.6