Rumba C++ SDK
ImathFrustum.h
Go to the documentation of this file.
1 //
3 // Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
4 // Digital Ltd. LLC
5 //
6 // All rights reserved.
7 //
8 // Redistribution and use in source and binary forms, with or without
9 // modification, are permitted provided that the following conditions are
10 // met:
11 // * Redistributions of source code must retain the above copyright
12 // notice, this list of conditions and the following disclaimer.
13 // * Redistributions in binary form must reproduce the above
14 // copyright notice, this list of conditions and the following disclaimer
15 // in the documentation and/or other materials provided with the
16 // distribution.
17 // * Neither the name of Industrial Light & Magic nor the names of
18 // its contributors may be used to endorse or promote products derived
19 // from this software without specific prior written permission.
20 //
21 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 //
34 
35 
36 
37 #ifndef INCLUDED_IMATHFRUSTUM_H
38 #define INCLUDED_IMATHFRUSTUM_H
39 
40 
41 #include "ImathVec.h"
42 #include "ImathPlane.h"
43 #include "ImathLine.h"
44 #include "ImathMatrix.h"
45 #include "ImathLimits.h"
46 #include "ImathFun.h"
47 #include "IexMathExc.h"
48 
49 #if defined _WIN32 || defined _WIN64
50  #ifdef near
51  #define _redef_near
52  #undef near
53  #endif
54  #ifdef far
55  #define _redef_far
56  #undef far
57  #endif
58 #endif
59 
60 namespace Imath {
61 
62 //
63 // template class Frustum<T>
64 //
65 // The frustum is always located with the eye point at the
66 // origin facing down -Z. This makes the Frustum class
67 // compatable with OpenGL (or anything that assumes a camera
68 // looks down -Z, hence with a right-handed coordinate system)
69 // but not with RenderMan which assumes the camera looks down
70 // +Z. Additional functions are provided for conversion from
71 // and from various camera coordinate spaces.
72 //
73 
74 
75 template<class T>
76 class Frustum
77 {
78  public:
79  Frustum();
80  Frustum(const Frustum &);
81  Frustum(T near, T far, T left, T right, T top, T bottom, bool ortho=false);
82  Frustum(T near, T far, T fovx, T fovy, T aspect);
83  virtual ~Frustum();
84 
85  //--------------------
86  // Assignment operator
87  //--------------------
88 
89  const Frustum &operator = (const Frustum &);
90 
91  //--------------------
92  // Operators: ==, !=
93  //--------------------
94 
95  bool operator == (const Frustum<T> &src) const;
96  bool operator != (const Frustum<T> &src) const;
97 
98  //--------------------------------------------------------
99  // Set functions change the entire state of the Frustum
100  //--------------------------------------------------------
101 
102  void set(T near, T far,
103  T left, T right,
104  T top, T bottom,
105  bool ortho=false);
106 
107  void set(T near, T far, T fovx, T fovy, T aspect);
108 
109  //------------------------------------------------------
110  // These functions modify an already valid frustum state
111  //------------------------------------------------------
112 
113  void modifyNearAndFar(T near, T far);
114  void setOrthographic(bool);
115 
116  //--------------
117  // Access
118  //--------------
119 
120  bool orthographic() const { return _orthographic; }
121  T near() const { return _near; }
122  T hither() const { return _near; }
123  T far() const { return _far; }
124  T yon() const { return _far; }
125  T left() const { return _left; }
126  T right() const { return _right; }
127  T bottom() const { return _bottom; }
128  T top() const { return _top; }
129 
130  //-----------------------------------------------------------------------
131  // Sets the planes in p to be the six bounding planes of the frustum, in
132  // the following order: top, right, bottom, left, near, far.
133  // Note that the planes have normals that point out of the frustum.
134  // The version of this routine that takes a matrix applies that matrix
135  // to transform the frustum before setting the planes.
136  //-----------------------------------------------------------------------
137 
138  void planes(Plane3<T> p[6]);
139  void planes(Plane3<T> p[6], const Matrix44<T> &M);
140 
141  //----------------------
142  // Derived Quantities
143  //----------------------
144 
145  T fovx() const;
146  T fovy() const;
147  T aspect() const;
149 
150  //-----------------------------------------------------------------------
151  // Takes a rectangle in the screen space (i.e., -1 <= left <= right <= 1
152  // and -1 <= bottom <= top <= 1) of this Frustum, and returns a new
153  // Frustum whose near clipping-plane window is that rectangle in local
154  // space.
155  //-----------------------------------------------------------------------
156 
157  Frustum<T> window(T left, T right, T top, T bottom) const;
158 
159  //----------------------------------------------------------
160  // Projection is in screen space / Conversion from Z-Buffer
161  //----------------------------------------------------------
162 
163  Line3<T> projectScreenToRay( const Vec2<T> & ) const;
164  Vec2<T> projectPointToScreen( const Vec3<T> & ) const;
165 
166  T ZToDepth(long zval, long min, long max) const;
167  T normalizedZToDepth(T zval) const;
168  long DepthToZ(T depth, long zmin, long zmax) const;
169 
170  T worldRadius(const Vec3<T> &p, T radius) const;
171  T screenRadius(const Vec3<T> &p, T radius) const;
172 
173 
174  protected:
175 
176  Vec2<T> screenToLocal( const Vec2<T> & ) const;
177  Vec2<T> localToScreen( const Vec2<T> & ) const;
178 
179  protected:
180  T _near;
181  T _far;
182  T _left;
184  T _top;
187 };
188 
189 
190 template<class T>
192 {
193  set(T (0.1),
194  T (1000.0),
195  T (-1.0),
196  T (1.0),
197  T (1.0),
198  T (-1.0),
199  false);
200 }
201 
202 template<class T>
203 inline Frustum<T>::Frustum(const Frustum &f)
204 {
205  *this = f;
206 }
207 
208 template<class T>
209 inline Frustum<T>::Frustum(T n, T f, T l, T r, T t, T b, bool o)
210 {
211  set(n,f,l,r,t,b,o);
212 }
213 
214 template<class T>
215 inline Frustum<T>::Frustum(T near, T far, T fovx, T fovy, T aspect)
216 {
217  set(near,far,fovx,fovy,aspect);
218 }
219 
220 template<class T>
222 {
223 }
224 
225 template<class T>
226 const Frustum<T> &
228 {
229  _near = f._near;
230  _far = f._far;
231  _left = f._left;
232  _right = f._right;
233  _top = f._top;
234  _bottom = f._bottom;
235  _orthographic = f._orthographic;
236 
237  return *this;
238 }
239 
240 template <class T>
241 bool
243 {
244  return
245  _near == src._near &&
246  _far == src._far &&
247  _left == src._left &&
248  _right == src._right &&
249  _top == src._top &&
250  _bottom == src._bottom &&
251  _orthographic == src._orthographic;
252 }
253 
254 template <class T>
255 inline bool
257 {
258  return !operator== (src);
259 }
260 
261 template<class T>
262 void Frustum<T>::set(T n, T f, T l, T r, T t, T b, bool o)
263 {
264  _near = n;
265  _far = f;
266  _left = l;
267  _right = r;
268  _bottom = b;
269  _top = t;
270  _orthographic = o;
271 }
272 
273 template<class T>
275 {
276  if ( _orthographic )
277  {
278  _near = n;
279  }
280  else
281  {
282  Line3<T> lowerLeft( Vec3<T>(0,0,0), Vec3<T>(_left,_bottom,-_near) );
283  Line3<T> upperRight( Vec3<T>(0,0,0), Vec3<T>(_right,_top,-_near) );
284  Plane3<T> nearPlane( Vec3<T>(0,0,-1), n );
285 
286  Vec3<T> ll,ur;
287  nearPlane.intersect(lowerLeft,ll);
288  nearPlane.intersect(upperRight,ur);
289 
290  _left = ll.x;
291  _right = ur.x;
292  _top = ur.y;
293  _bottom = ll.y;
294  _near = n;
295  _far = f;
296  }
297 
298  _far = f;
299 }
300 
301 template<class T>
303 {
304  _orthographic = ortho;
305 }
306 
307 template<class T>
308 void Frustum<T>::set(T near, T far, T fovx, T fovy, T aspect)
309 {
310  if (fovx != 0 && fovy != 0)
311  throw Iex::ArgExc ("fovx and fovy cannot both be non-zero.");
312 
313  if (fovx != 0)
314  {
315  _right = near * Math<T>::tan (fovx / 2);
316  _left = -_right;
317  _top = ((_right - _left) / aspect) / 2;
318  _bottom = -_top;
319  }
320  else
321  {
322  _top = near * Math<T>::tan (fovy / 2);
323  _bottom = -_top;
324  _right = (_top - _bottom) * aspect / 2;
325  _left = -_right;
326  }
327  _near = near;
328  _far = far;
329  _orthographic = false;
330 }
331 
332 template<class T>
334 {
335  return Math<T>::atan2(_right,_near) - Math<T>::atan2(_left,_near);
336 }
337 
338 template<class T>
340 {
341  return Math<T>::atan2(_top,_near) - Math<T>::atan2(_bottom,_near);
342 }
343 
344 template<class T>
346 {
347  T rightMinusLeft = _right-_left;
348  T topMinusBottom = _top-_bottom;
349 
350  if (abs(topMinusBottom) < 1 &&
351  abs(rightMinusLeft) > limits<T>::max() * abs(topMinusBottom))
352  {
353  throw Iex::DivzeroExc ("Bad viewing frustum: "
354  "aspect ratio cannot be computed.");
355  }
356 
357  return rightMinusLeft / topMinusBottom;
358 }
359 
360 template<class T>
362 {
363  T rightPlusLeft = _right+_left;
364  T rightMinusLeft = _right-_left;
365 
366  T topPlusBottom = _top+_bottom;
367  T topMinusBottom = _top-_bottom;
368 
369  T farPlusNear = _far+_near;
370  T farMinusNear = _far-_near;
371 
372  if ((abs(rightMinusLeft) < 1 &&
373  abs(rightPlusLeft) > limits<T>::max() * abs(rightMinusLeft)) ||
374  (abs(topMinusBottom) < 1 &&
375  abs(topPlusBottom) > limits<T>::max() * abs(topMinusBottom)) ||
376  (abs(farMinusNear) < 1 &&
377  abs(farPlusNear) > limits<T>::max() * abs(farMinusNear)))
378  {
379  throw Iex::DivzeroExc ("Bad viewing frustum: "
380  "projection matrix cannot be computed.");
381  }
382 
383  if ( _orthographic )
384  {
385  T tx = -rightPlusLeft / rightMinusLeft;
386  T ty = -topPlusBottom / topMinusBottom;
387  T tz = -farPlusNear / farMinusNear;
388 
389  if ((abs(rightMinusLeft) < 1 &&
390  2 > limits<T>::max() * abs(rightMinusLeft)) ||
391  (abs(topMinusBottom) < 1 &&
392  2 > limits<T>::max() * abs(topMinusBottom)) ||
393  (abs(farMinusNear) < 1 &&
394  2 > limits<T>::max() * abs(farMinusNear)))
395  {
396  throw Iex::DivzeroExc ("Bad viewing frustum: "
397  "projection matrix cannot be computed.");
398  }
399 
400  T A = 2 / rightMinusLeft;
401  T B = 2 / topMinusBottom;
402  T C = -2 / farMinusNear;
403 
404  return Matrix44<T>( A, 0, 0, 0,
405  0, B, 0, 0,
406  0, 0, C, 0,
407  tx, ty, tz, 1.f );
408  }
409  else
410  {
411  T A = rightPlusLeft / rightMinusLeft;
412  T B = topPlusBottom / topMinusBottom;
413  T C = -farPlusNear / farMinusNear;
414 
415  T farTimesNear = -2 * _far * _near;
416  if (abs(farMinusNear) < 1 &&
417  abs(farTimesNear) > limits<T>::max() * abs(farMinusNear))
418  {
419  throw Iex::DivzeroExc ("Bad viewing frustum: "
420  "projection matrix cannot be computed.");
421  }
422 
423  T D = farTimesNear / farMinusNear;
424 
425  T twoTimesNear = 2 * _near;
426 
427  if ((abs(rightMinusLeft) < 1 &&
428  abs(twoTimesNear) > limits<T>::max() * abs(rightMinusLeft)) ||
429  (abs(topMinusBottom) < 1 &&
430  abs(twoTimesNear) > limits<T>::max() * abs(topMinusBottom)))
431  {
432  throw Iex::DivzeroExc ("Bad viewing frustum: "
433  "projection matrix cannot be computed.");
434  }
435 
436  T E = twoTimesNear / rightMinusLeft;
437  T F = twoTimesNear / topMinusBottom;
438 
439  return Matrix44<T>( E, 0, 0, 0,
440  0, F, 0, 0,
441  A, B, C, -1,
442  0, 0, D, 0 );
443  }
444 }
445 
446 template<class T>
447 Frustum<T> Frustum<T>::window(T l, T r, T t, T b) const
448 {
449  // move it to 0->1 space
450 
451  Vec2<T> bl = screenToLocal( Vec2<T>(l,b) );
452  Vec2<T> tr = screenToLocal( Vec2<T>(r,t) );
453 
454  return Frustum<T>(_near, _far, bl.x, tr.x, tr.y, bl.y, _orthographic);
455 }
456 
457 
458 template<class T>
460 {
461  return Vec2<T>( _left + (_right-_left) * (1.f+s.x) / 2.f,
462  _bottom + (_top-_bottom) * (1.f+s.y) / 2.f );
463 }
464 
465 template<class T>
467 {
468  T leftPlusRight = _left - 2 * p.x + _right;
469  T leftMinusRight = _left-_right;
470  T bottomPlusTop = _bottom - 2 * p.y + _top;
471  T bottomMinusTop = _bottom-_top;
472 
473  if ((abs(leftMinusRight) < 1 &&
474  abs(leftPlusRight) > limits<T>::max() * abs(leftMinusRight)) ||
475  (abs(bottomMinusTop) < 1 &&
476  abs(bottomPlusTop) > limits<T>::max() * abs(bottomMinusTop)))
477  {
478  throw Iex::DivzeroExc
479  ("Bad viewing frustum: "
480  "local-to-screen transformation cannot be computed");
481  }
482 
483  return Vec2<T>( leftPlusRight / leftMinusRight,
484  bottomPlusTop / bottomMinusTop );
485 }
486 
487 template<class T>
489 {
490  Vec2<T> point = screenToLocal(p);
491  if (orthographic())
492  return Line3<T>( Vec3<T>(point.x,point.y, 0.0),
493  Vec3<T>(point.x,point.y,-_near));
494  else
495  return Line3<T>( Vec3<T>(0, 0, 0), Vec3<T>(point.x,point.y,-_near));
496 }
497 
498 template<class T>
500 {
501  if (orthographic() || point.z == 0)
502  return localToScreen( Vec2<T>( point.x, point.y ) );
503  else
504  return localToScreen( Vec2<T>( point.x * _near / -point.z,
505  point.y * _near / -point.z ) );
506 }
507 
508 template<class T>
509 T Frustum<T>::ZToDepth(long zval,long zmin,long zmax) const
510 {
511  int zdiff = zmax - zmin;
512 
513  if (zdiff == 0)
514  {
515  throw Iex::DivzeroExc
516  ("Bad call to Frustum::ZToDepth: zmax == zmin");
517  }
518 
519  if ( zval > zmax+1 ) zval -= zdiff;
520 
521  T fzval = (T(zval) - T(zmin)) / T(zdiff);
522  return normalizedZToDepth(fzval);
523 }
524 
525 template<class T>
527 {
528  T Zp = zval * 2.0 - 1;
529 
530  if ( _orthographic )
531  {
532  return -(Zp*(_far-_near) + (_far+_near))/2;
533  }
534  else
535  {
536  T farTimesNear = 2 * _far * _near;
537  T farMinusNear = Zp * (_far - _near) - _far - _near;
538 
539  if (abs(farMinusNear) < 1 &&
540  abs(farTimesNear) > limits<T>::max() * abs(farMinusNear))
541  {
542  throw Iex::DivzeroExc
543  ("Frustum::normalizedZToDepth cannot be computed. The "
544  "near and far clipping planes of the viewing frustum "
545  "may be too close to each other");
546  }
547 
548  return farTimesNear / farMinusNear;
549  }
550 }
551 
552 template<class T>
553 long Frustum<T>::DepthToZ(T depth,long zmin,long zmax) const
554 {
555  long zdiff = zmax - zmin;
556  T farMinusNear = _far-_near;
557 
558  if ( _orthographic )
559  {
560  T farPlusNear = 2*depth + _far + _near;
561 
562  if (abs(farMinusNear) < 1 &&
563  abs(farPlusNear) > limits<T>::max() * abs(farMinusNear))
564  {
565  throw Iex::DivzeroExc
566  ("Bad viewing frustum: near and far clipping planes "
567  "are too close to each other");
568  }
569 
570  T Zp = -farPlusNear/farMinusNear;
571  return long(0.5*(Zp+1)*zdiff) + zmin;
572  }
573  else
574  {
575  // Perspective
576 
577  T farTimesNear = 2*_far*_near;
578  if (abs(depth) < 1 &&
579  abs(farTimesNear) > limits<T>::max() * abs(depth))
580  {
581  throw Iex::DivzeroExc
582  ("Bad call to DepthToZ function: value of `depth' "
583  "is too small");
584  }
585 
586  T farPlusNear = farTimesNear/depth + _far + _near;
587  if (abs(farMinusNear) < 1 &&
588  abs(farPlusNear) > limits<T>::max() * abs(farMinusNear))
589  {
590  throw Iex::DivzeroExc
591  ("Bad viewing frustum: near and far clipping planes "
592  "are too close to each other");
593  }
594 
595  T Zp = farPlusNear/farMinusNear;
596  return long(0.5*(Zp+1)*zdiff) + zmin;
597  }
598 }
599 
600 template<class T>
601 T Frustum<T>::screenRadius(const Vec3<T> &p, T radius) const
602 {
603  // Derivation:
604  // Consider X-Z plane.
605  // X coord of projection of p = xp = p.x * (-_near / p.z)
606  // Let q be p + (radius, 0, 0).
607  // X coord of projection of q = xq = (p.x - radius) * (-_near / p.z)
608  // X coord of projection of segment from p to q = r = xp - xq
609  // = radius * (-_near / p.z)
610  // A similar analysis holds in the Y-Z plane.
611  // So r is the quantity we want to return.
612 
613  if (abs(p.z) > 1 || abs(-_near) < limits<T>::max() * abs(p.z))
614  {
615  return radius * (-_near / p.z);
616  }
617  else
618  {
619  throw Iex::DivzeroExc
620  ("Bad call to Frustum::screenRadius: the magnitude of `p' "
621  "is too small");
622  }
623 
624  return radius * (-_near / p.z);
625 }
626 
627 template<class T>
628 T Frustum<T>::worldRadius(const Vec3<T> &p, T radius) const
629 {
630  if (abs(-_near) > 1 || abs(p.z) < limits<T>::max() * abs(-_near))
631  {
632  return radius * (p.z / -_near);
633  }
634  else
635  {
636  throw Iex::DivzeroExc
637  ("Bad viewing frustum: the near clipping plane is too "
638  "close to zero");
639  }
640 }
641 
642 template<class T>
644 {
645  //
646  // Plane order: Top, Right, Bottom, Left, Near, Far.
647  // Normals point outwards.
648  //
649 
650  if (! _orthographic)
651  {
652  Vec3<T> a( _left, _bottom, -_near);
653  Vec3<T> b( _left, _top, -_near);
654  Vec3<T> c( _right, _top, -_near);
655  Vec3<T> d( _right, _bottom, -_near);
656  Vec3<T> o(0,0,0);
657 
658  p[0].set( o, c, b );
659  p[1].set( o, d, c );
660  p[2].set( o, a, d );
661  p[3].set( o, b, a );
662  }
663  else
664  {
665  p[0].set( Vec3<T>( 0, 1, 0), _top );
666  p[1].set( Vec3<T>( 1, 0, 0), _right );
667  p[2].set( Vec3<T>( 0,-1, 0),-_bottom );
668  p[3].set( Vec3<T>(-1, 0, 0),-_left );
669  }
670  p[4].set( Vec3<T>(0, 0, 1), -_near );
671  p[5].set( Vec3<T>(0, 0,-1), _far );
672 }
673 
674 
675 template<class T>
677 {
678  //
679  // Plane order: Top, Right, Bottom, Left, Near, Far.
680  // Normals point outwards.
681  //
682 
683  Vec3<T> a = Vec3<T>( _left, _bottom, -_near) * M;
684  Vec3<T> b = Vec3<T>( _left, _top, -_near) * M;
685  Vec3<T> c = Vec3<T>( _right, _top, -_near) * M;
686  Vec3<T> d = Vec3<T>( _right, _bottom, -_near) * M;
687  if (! _orthographic)
688  {
689  double s = _far / double(_near);
690  T farLeft = (T) (s * _left);
691  T farRight = (T) (s * _right);
692  T farTop = (T) (s * _top);
693  T farBottom = (T) (s * _bottom);
694  Vec3<T> e = Vec3<T>( farLeft, farBottom, -_far) * M;
695  Vec3<T> f = Vec3<T>( farLeft, farTop, -_far) * M;
696  Vec3<T> g = Vec3<T>( farRight, farTop, -_far) * M;
697  Vec3<T> o = Vec3<T>(0,0,0) * M;
698  p[0].set( o, c, b );
699  p[1].set( o, d, c );
700  p[2].set( o, a, d );
701  p[3].set( o, b, a );
702  p[4].set( a, d, c );
703  p[5].set( e, f, g );
704  }
705  else
706  {
707  Vec3<T> e = Vec3<T>( _left, _bottom, -_far) * M;
708  Vec3<T> f = Vec3<T>( _left, _top, -_far) * M;
709  Vec3<T> g = Vec3<T>( _right, _top, -_far) * M;
710  Vec3<T> h = Vec3<T>( _right, _bottom, -_far) * M;
711  p[0].set( c, g, f );
712  p[1].set( d, h, g );
713  p[2].set( a, e, h );
714  p[3].set( b, f, e );
715  p[4].set( a, d, c );
716  p[5].set( e, f, g );
717  }
718 }
719 
722 
723 
724 } // namespace Imath
725 
726 
727 #if defined _WIN32 || defined _WIN64
728  #ifdef _redef_near
729  #define near
730  #endif
731  #ifdef _redef_far
732  #define far
733  #endif
734 #endif
735 
736 #endif
Frustum< float > Frustumf
Definition: ImathFrustum.h:720
virtual ~Frustum()
Definition: ImathFrustum.h:221
void set(const Vec3< T > &normal, T distance)
Definition: ImathPlane.h:158
T x
Definition: ImathVec.h:76
T left() const
Definition: ImathFrustum.h:125
long DepthToZ(T depth, long zmin, long zmax) const
Definition: ImathFrustum.h:553
Vec2< T > projectPointToScreen(const Vec3< T > &) const
Definition: ImathFrustum.h:499
const Frustum & operator=(const Frustum &)
Definition: ImathFrustum.h:227
T bottom() const
Definition: ImathFrustum.h:127
T y
Definition: ImathVec.h:76
Definition: ImathFrame.h:42
static T tan(T x)
Definition: ImathMath.h:99
bool _orthographic
Definition: ImathFrustum.h:186
Definition: ImathFrame.h:43
Frustum()
Definition: ImathFrustum.h:191
Frustum< T > window(T left, T right, T top, T bottom) const
Definition: ImathFrustum.h:447
T normalizedZToDepth(T zval) const
Definition: ImathFrustum.h:526
Vec2< T > screenToLocal(const Vec2< T > &) const
Definition: ImathFrustum.h:459
T fovy() const
Definition: ImathFrustum.h:339
static T atan2(T x, T y)
Definition: ImathMath.h:96
T near() const
Definition: ImathFrustum.h:121
void planes(Plane3< T > p[6])
Definition: ImathFrustum.h:643
bool intersect(const Line3< T > &line, Vec3< T > &intersection) const
Definition: ImathPlane.h:186
void set(T near, T far, T left, T right, T top, T bottom, bool ortho=false)
Definition: ImathFrustum.h:262
Vec2< T > localToScreen(const Vec2< T > &) const
Definition: ImathFrustum.h:466
T abs(T a)
Definition: ImathFun.h:53
T _right
Definition: ImathFrustum.h:183
bool orthographic() const
Definition: ImathFrustum.h:120
Definition: ImathLimits.h:117
T x
Definition: ImathVec.h:274
T y
Definition: ImathVec.h:274
T hither() const
Definition: ImathFrustum.h:122
Line3< T > projectScreenToRay(const Vec2< T > &) const
Definition: ImathFrustum.h:488
Frustum< double > Frustumd
Definition: ImathFrustum.h:721
T yon() const
Definition: ImathFrustum.h:124
T z
Definition: ImathVec.h:274
T _left
Definition: ImathFrustum.h:182
Definition: ImathVec.h:61
Definition: ImathLine.h:54
T _near
Definition: ImathFrustum.h:180
T right() const
Definition: ImathFrustum.h:126
bool operator==(const C *str, const StringViewBase< C, STDS > &sv) noexcept
Definition: StringView.h:273
T _far
Definition: ImathFrustum.h:181
T ZToDepth(long zval, long min, long max) const
Definition: ImathFrustum.h:509
T _bottom
Definition: ImathFrustum.h:185
T screenRadius(const Vec3< T > &p, T radius) const
Definition: ImathFrustum.h:601
Matrix44< T > projectionMatrix() const
Definition: ImathFrustum.h:361
T top() const
Definition: ImathFrustum.h:128
bool operator!=(const Frustum< T > &src) const
Definition: ImathFrustum.h:256
static T max()
T fovx() const
Definition: ImathFrustum.h:333
void setOrthographic(bool)
Definition: ImathFrustum.h:302
T _top
Definition: ImathFrustum.h:184
Definition: ImathPlane.h:62
Definition: ImathBox.h:67
T worldRadius(const Vec3< T > &p, T radius) const
Definition: ImathFrustum.h:628
Definition: ImathFrustum.h:76
bool operator==(const Frustum< T > &src) const
Definition: ImathFrustum.h:242
void modifyNearAndFar(T near, T far)
Definition: ImathFrustum.h:274
T far() const
Definition: ImathFrustum.h:123
T aspect() const
Definition: ImathFrustum.h:345