19 #if !defined(__NORI_FRAME_H)
20 #define __NORI_FRAME_H
22 #include <nori/vector.h>
42 : s(s), t(t), n(n) { }
46 : s(x), t(y), n(z) { }
50 coordinateSystem(n, s, t);
56 v.dot(s), v.dot(t), v.dot(n)
62 return s * v.x() + t * v.y() + n * v.z();
77 return std::sqrt(temp);
83 float temp = 1 - v.z()*v.z();
86 return std::sqrt(temp) / v.z();
92 return 1.0f - v.z() * v.z();
101 return clamp(v.y() /
sinTheta, -1.0f, 1.0f);
110 return clamp(v.x() /
sinTheta, -1.0f, 1.0f);
117 return clamp(v.y() * v.y() /
sinTheta2(v), 0.0f, 1.0f);
124 return clamp(v.x() * v.x() /
sinTheta2(v), 0.0f, 1.0f);
129 return frame.s == s && frame.t == t && frame.n == n;
Stores a three-dimensional orthonormal coordinate frame.
static float cosPhi2(const Vector3f &v)
Assuming that the given direction is in the local coordinate system, return the squared cosine of the...
Frame(const Vector3f &x, const Vector3f &y, const Vector3f &z)
Construct a frame from the given orthonormal vectors.
static float sinTheta(const Vector3f &v)
Assuming that the given direction is in the local coordinate system, return the sine of the angle bet...
Frame(const Vector3f &s, const Vector3f &t, const Normal3f &n)
Given a normal and tangent vectors, construct a new coordinate frame.
static float cosPhi(const Vector3f &v)
Assuming that the given direction is in the local coordinate system, return the cosine of the phi par...
Vector3f toWorld(const Vector3f &v) const
Convert from local coordinates to world coordinates.
static float sinPhi(const Vector3f &v)
Assuming that the given direction is in the local coordinate system, return the sine of the phi param...
static float tanTheta(const Vector3f &v)
Assuming that the given direction is in the local coordinate system, return the tangent of the angle ...
std::string toString() const
Return a human-readable string summary of this frame.
static float cosTheta(const Vector3f &v)
Assuming that the given direction is in the local coordinate system, return the cosine of the angle b...
bool operator==(const Frame &frame) const
Equality test.
Frame()
Default constructor – performs no initialization!
Frame(const Vector3f &n)
Construct a new coordinate frame from a single vector.
static float sinTheta2(const Vector3f &v)
Assuming that the given direction is in the local coordinate system, return the squared sine of the a...
bool operator!=(const Frame &frame) const
Inequality test.
static float sinPhi2(const Vector3f &v)
Assuming that the given direction is in the local coordinate system, return the squared sine of the p...
Vector3f toLocal(const Vector3f &v) const
Convert from world coordinates to local coordinates.
3-dimensional surface normal representation
std::string toString() const
Return a human-readable string summary.
std::string toString() const
Return a human-readable string summary.