20 #if !defined(__MITSUBA_CORE_FRAME_H_)
21 #define __MITSUBA_CORE_FRAME_H_
23 #include <mitsuba/mitsuba.h>
84 return s * v.x + t * v.y + n * v.z;
108 return 1.0f - v.z * v.z;
114 Float temp = sinTheta2(v);
117 return std::sqrt(temp);
123 Float temp = 1 - v.z*v.z;
126 return std::sqrt(temp) / v.z;
132 Float temp = 1 - v.z*v.z;
135 return temp / (v.z * v.z);
141 Float sinTheta = Frame::sinTheta(v);
142 if (sinTheta == 0.0f)
150 Float sinTheta = Frame::sinTheta(v);
151 if (sinTheta == 0.0f)
172 return frame.
s == s && frame.
t == t && frame.
n == n;
177 return !operator==(frame);
182 std::ostringstream oss;
183 oss <<
"Frame[" << std::endl
184 <<
" s = " << s.toString() <<
"," << std::endl
185 <<
" t = " << t.toString() <<
"," << std::endl
186 <<
" n = " << n.toString() << std::endl
static Float cosPhi2(const Vector &v)
Assuming that the given direction is in the local coordinate system, return the squared cosine of the...
Definition: frame.h:166
static Float cosTheta2(const Vector &v)
Assuming that the given direction is in the local coordinate system, return the squared cosine of the...
Definition: frame.h:89
Frame(Stream *stream)
Unserialize from a binary data stream.
Definition: frame.h:60
Three-dimensional normal data structure.
Definition: normal.h:39
Stores a three-dimensional orthonormal coordinate frame.
Definition: frame.h:37
static Float tanTheta(const Vector &v)
Assuming that the given direction is in the local coordinate system, return the tangent of the angle ...
Definition: frame.h:122
Normal n
Definition: frame.h:39
TVector3< Float > Vector
Definition: fwd.h:113
bool operator!=(const Frame &frame) const
Inequality test.
Definition: frame.h:176
static Float cosPhi(const Vector &v)
Assuming that the given direction is in the local coordinate system, return the cosine of the phi par...
Definition: frame.h:149
static Float sinPhi(const Vector &v)
Assuming that the given direction is in the local coordinate system, return the sine of the phi param...
Definition: frame.h:140
MTS_EXPORT_CORE void coordinateSystem(const Vector &a, Vector &b, Vector &c)
Complete the set {a} to an orthonormal base.
Vector s
Definition: frame.h:38
Frame()
Default constructor – performs no initialization!
Definition: frame.h:42
Vector t
Definition: frame.h:38
TVector2< Float > Vector2
Definition: fwd.h:106
Abstract seekable stream class.
Definition: stream.h:58
static Vector2 uv(const Vector &v)
Assuming that the given direction is in the local coordinate system, return the u and v coordinates o...
Definition: frame.h:101
Vector toWorld(const Vector &v) const
Convert from local coordinates to world coordinates.
Definition: frame.h:83
bool operator==(const Frame &frame) const
Equality test.
Definition: frame.h:171
static Float tanTheta2(const Vector &v)
Assuming that the given direction is in the local coordinate system, return the squared tangent of th...
Definition: frame.h:131
Frame(const Vector &s, const Vector &t, const Normal &n)
Given a normal and tangent vectors, construct a new coordinate frame.
Definition: frame.h:45
static Float sinPhi2(const Vector &v)
Assuming that the given direction is in the local coordinate system, return the squared sine of the p...
Definition: frame.h:159
Frame(const Vector &n)
Construct a new coordinate frame from a single vector.
Definition: frame.h:55
std::string toString() const
Return a string representation of this frame.
Definition: frame.h:181
static Float cosTheta(const Vector &v)
Assuming that the given direction is in the local coordinate system, return the cosine of the angle b...
Definition: frame.h:95
static Float sinTheta(const Vector &v)
Assuming that the given direction is in the local coordinate system, return the sine of the angle bet...
Definition: frame.h:113
T dot(const TQuaternion< T > &q1, const TQuaternion< T > &q2)
Definition: quat.h:348
void serialize(Stream *stream) const
Serialize to a binary data stream.
Definition: frame.h:67
static Float sinTheta2(const Vector &v)
Assuming that the given direction is in the local coordinate system, return the squared sine of the a...
Definition: frame.h:107
Frame(const Vector &x, const Vector &y, const Vector &z)
Construct a frame from the given orthonormal vectors.
Definition: frame.h:50
Vector toLocal(const Vector &v) const
Convert from world coordinates to local coordinates.
Definition: frame.h:74
Scalar clamp(Scalar value, Scalar min, Scalar max)
Generic clamping function.
Definition: math.h:51