1#ifndef _BBM_VEC_TRANSFORM_H_
2#define _BBM_VEC_TRANSFORM_H_
44 inline vec3d<T>
reflect(
const vec3d<T>& v,
const vec3d<T>& normal) {
return normal * dot(normal, v) * 2.0 - v; }
62 inline constexpr vec3d<T>
cross(
const vec3d<T>& a,
const vec3d<T>& b)
64 return vec3d<T>( a[1]*b[2] - a[2]*b[1],
65 a[2]*b[0] - a[0]*b[2],
66 a[0]*b[1] - a[1]*b[0] );
77 vec3d<T>
halfway(
const vec3d<T>& a,
const vec3d<T>& b)
79 return bbm::normalize(a + b);
T & phi(vec2d< T > &v)
Definition: spherical.h:39
vec2d< T > convert(const vec3d< T > &v)
Definition: spherical.h:53
T & theta(vec2d< T > &v)
Definition: spherical.h:23
constexpr decltype(auto) y(bbm::vec3d< T > &v)
Definition: vec.h:23
constexpr decltype(auto) z(bbm::vec3d< T > &v)
Definition: vec.h:26
constexpr decltype(auto) x(bbm::vec3d< T > &v)
Definition: vec.h:20
Definition: aggregatebsdf.h:29
mat3d< std::decay_t< T > > rotationY(const vec2d< T > &cossin)
Rotation around the Y-axis.
Definition: transform.h:47
vec2d< T > perp(const vec2d< T > &v)
Returns the lefthand (clockwise) perpendicular vector of a 2D vector.
Definition: vec_transform.h:23
mat3d< std::decay_t< T > > rotationZ(const vec2d< T > &cossin)
Rotation around the Z-axis.
Definition: transform.h:74
vec3d< T > halfway(const vec3d< T > &a, const vec3d< T > &b)
Halfway vector (3D)
Definition: vec_transform.h:77
vec3d< T > difference(const vec3d< T > &a, const vec3d< T > &b)
Difference vector.
Definition: vec_transform.h:106
std::pair< vec3d< T >, vec3d< T > > convertFromHalfwayDifference(const vec3d< T > &half, const vec3d< T > &diff)
Convert from Halfway-Difference to Canonical parameterization.
Definition: vec_transform.h:118
vec2d< T > cperp(const vec2d< T > &v)
Returns the righthand (counterclockwise) perpendicular vector of a 2D vector.
Definition: vec_transform.h:34
std::pair< vec3d< T >, vec3d< T > > convertToHalfwayDifference(const vec3d< T > &a, const vec3d< T > &b)
Convert fro Canonical to the Halfway-Difference parameterization.
Definition: vec_transform.h:91
constexpr vec3d< T > cross(const vec3d< T > &a, const vec3d< T > &b)
Cross product of two 3D vectors.
Definition: vec_transform.h:62
vec3d< T > reflect(const vec3d< T > &v, const vec3d< T > &normal)
Reflects a 3D vector.
Definition: vec_transform.h:44
Methods for handling spherical coordinates.