RenderManAPI  24.0
RiTypesHelper.h
Go to the documentation of this file.
1 /*
2 # ------------------------------------------------------------------------------
3 #
4 # Copyright (c) 2020 Pixar. All rights reserved.
5 #
6 # The information in this file (the "Software") is provided for the exclusive
7 # use of the software licensees of Pixar ("Licensees"). Licensees have the
8 # right to incorporate the Software into other products for use by other
9 # authorized software licensees of Pixar, without fee. Except as expressly
10 # permitted herein, the Software may not be disclosed to third parties, copied
11 # or duplicated in any form, in whole or in part, without the prior written
12 # permission of Pixar.
13 #
14 # The copyright notices in the Software and this entire statement, including the
15 # above license grant, this restriction and the following disclaimer, must be
16 # included in all copies of the Software, in whole or in part, and all permitted
17 # derivative works of the Software, unless such copies or derivative works are
18 # solely in the form of machine-executable object code generated by a source
19 # language processor.
20 #
21 # PIXAR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
22 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL PIXAR BE
23 # LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
24 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
25 # OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
26 # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. IN NO CASE WILL
27 # PIXAR'S TOTAL LIABILITY FOR ALL DAMAGES ARISING OUT OF OR IN CONNECTION WITH
28 # THE USE OR PERFORMANCE OF THIS SOFTWARE EXCEED $50.
29 #
30 # Pixar
31 # 1200 Park Ave
32 # Emeryville CA 94608
33 #
34 # ------------------------------------------------------------------------------
35 */
36 
37 #ifndef RiTypesHelper_h
38 #define RiTypesHelper_h
39 
40 // This file is included via ri.h when using a C++ compiler.
41 // It represents a collection of classes that can be aliased
42 // atop the traditional "C" plain-ol-data representations for
43 // more programming expressivity without loss of performance or
44 // compactness.
45 //
46 // Here's an example programming idiom (for simple scalar case):
47 //
48 // RtPoint op = {1,2,3};
49 // RtPoint3 &np = reinterpret_cast<RtPoint3&>(op);
50 //
51 // Now the standard collection of operator-overriding tricks eagerly await
52 // your beck and call.
53 
54 #include <algorithm> // for swap
55 #include <cassert> // for assert
56 #include <cfloat> // for FLT_MIN
57 #include <cmath> // for fabsf, sqrt, exp
58 #include <cstring> // for memcpy, memcmp
59 #include <functional> // for hash
60 #include <iostream> // for operator<<, etc
61 #include <cstdint> // int32_t, etc.
62 
63 #include "RiEntrypoints.h"
64 #include "pxrcore/ustring/ustring.h"
65 #include "pxrcore/paramlist/types.h"
66 #include "pxrcore/paramlist/paramlist.h"
67 #include "pxrcore/paramlist/primvarlist.h"
68 
69 typedef pxrcore::Float3 RtFloat3;
70 static_assert(sizeof(RtFloat3) == sizeof(float[3]), "ensure compat with legacy c-layout");
71 typedef RtFloat3 RtPoint3;
74 typedef pxrcore::Matrix4x4 RtMatrix4x4;
75 
76 
77 // -------------------------------------------------------------------------
78 // RtFloat2 is the base class for RtPoint2, RtVector2, RtNormal2.
79 // All geometrically insensitive operations are implemented here and
80 // used by subclasses. We use subclassing to preserve and convey
81 // geometric-type-sensitive behavior.
82 class RtFloat2
83 {
84  public:
85  // allow direct member access
86  float x, y;
87 
88  inline RtFloat2() = default;
89  inline RtFloat2(float xx, float yy) : x(xx), y(yy) {}
90  explicit inline RtFloat2(float v) : x(v), y(v) {}
91  // construct from a float array
92  // nb: RtFloat2(0) is ambiguous (float and NULL)
93  explicit inline RtFloat2(const float *d) : x(d[0]), y(d[1]) {}
94 
95  // offer access as array (original RtPoint was float[3])
96  inline float& operator[] (int i)
97  {
98  assert(i >= 0 && i<2);
99  return (&x)[i];
100  }
101  inline const float& operator[] (int i) const
102  {
103  assert(i >= 0 && i<2);
104  return (&x)[i];
105  }
106 
107  // Equality comparison
108  inline int operator==(const RtFloat2 &rhs) const
109  {
110  return x == rhs.x && y == rhs.y;
111  }
112  inline int operator!=(const RtFloat2 &rhs) const
113  {
114  return x != rhs.x || y != rhs.y;
115  }
116 
117  // Lexicographical ordering
118  inline bool operator<(const RtFloat2 &rhs) const
119  {
120  return (x < rhs.x ? true :
121  x > rhs.x ? false :
122  y < rhs.y);
123  }
124 
125  // type cast Too dangerous as the compiler does them automatically
126  // and we can't make them explicit (not supported before C++ 11)
127  // use &x[0]
128  //inline operator const float *() const { return (float *) &x; }
129  //inline operator float *() { return (float *) &x; }
130 
131  // serialize
132  friend std::ostream& operator<<(std::ostream& o, const RtFloat2& v)
133  {
134  o << v.x << " " << v.y ;
135  return o;
136  }
137 
138  // Addition
139  inline RtFloat2 operator+(const RtFloat2 &rhs) const
140  {
141  return RtFloat2(x + rhs.x, y + rhs.y);
142  }
143  inline RtFloat2 &operator+=(const RtFloat2 &rhs)
144  {
145  x += rhs.x;
146  y += rhs.y;
147  return *this;
148  }
149  // Subtraction
150  inline RtFloat2 operator-(const RtFloat2 &rhs) const
151  {
152  return RtFloat2(x - rhs.x, y - rhs.y);
153  }
154  inline RtFloat2 &operator-=(const RtFloat2 &rhs)
155  {
156  x -= rhs.x;
157  y -= rhs.y;
158  return *this;
159  }
160 
161  // Multiplication operator
162  inline RtFloat2 operator*(const RtFloat2 &rhs) const
163  {
164  return RtFloat2(x * rhs.x, y * rhs.y);
165  }
166  inline RtFloat2 &operator*=(const RtFloat2 &rhs)
167  {
168  x *= rhs.x;
169  y *= rhs.y;
170  return *this;
171  }
172 
173  // Division operator
174  inline RtFloat2 operator/(const RtFloat2 &rhs) const
175  {
176  return RtFloat2(x / rhs.x, y / rhs.y);
177  }
178  inline RtFloat2 &operator/=(const RtFloat2 &rhs)
179  {
180  x /= rhs.x;
181  y /= rhs.y;
182  return *this;
183  }
184 
185  // Unary minus
186  inline RtFloat2 operator-() const { return RtFloat2(-x, -y); }
187 
188  // Scalar multiplication
189  inline RtFloat2 operator*(float rhs) const
190  {
191  return RtFloat2(x * rhs, y * rhs);
192  }
193  inline friend RtFloat2 operator*(float lhs, const RtFloat2 &rhs) {
194  return rhs * lhs;
195  }
196  inline RtFloat2 &operator*=(float rhs)
197  {
198  x *= rhs;
199  y *= rhs;
200  return *this;
201  }
202 
203  // Scalar division
204  inline RtFloat2 operator/(float rhs) const
205  {
206  float inv = 1.0f / rhs;
207  return operator*(inv);
208  }
209  inline RtFloat2 & operator/=(float rhs)
210  {
211  float inv = 1.0f / rhs;
212  return operator*=(inv);
213  }
214 
215  // Length
216  inline float LengthSq() const
217  {
218  return (x*x + y*y);
219  }
220  inline float Length() const
221  {
222  return std::sqrt(LengthSq());
223  }
224 
225  // Check that a vector has (approximately) unit length
226  inline bool IsUnitLength(float eps=0.005f) const
227  {
228  float len = Length();
229  return (1.0f-eps <= len && len <= 1.0f+eps);
230  }
231 
232  // Normalize vector in place, return length
233  inline float Normalize(float eps = FLT_MIN)
234  {
235  float len = LengthSq();
236  if (len > eps)
237  {
238  len = std::sqrt(len);
239  *this /= len;
240  }
241  else
242  x = y = 0.0f;
243  return len;
244  }
245  inline friend float Normalize(RtFloat2 &v)
246  {
247  return v.Normalize();
248  }
249 
250  // Return normalized copy of vector
251  inline RtFloat2 NormalizeCopy(const RtFloat2 &v) const
252  {
253  RtFloat2 copy = v;
254  copy.Normalize();
255  return copy;
256  }
257  inline friend RtFloat2 NormalizeCopy(const RtFloat2 &v)
258  {
259  RtFloat2 copy = v;
260  copy.Normalize();
261  return copy;
262  }
263 
264  inline void Negate()
265  {
266  x = -x;
267  y = -y;
268  }
269 
270  // Dot product
271  inline float Dot(const RtFloat2 &v2) const
272  {
273  return x * v2.x + y * v2.y;
274  }
275  inline friend float Dot(const RtFloat2 &v1, const RtFloat2 &v2)
276  {
277  return v1.Dot(v2);
278  }
279 
280  // Absolute value of dot product
281  inline float AbsDot(const RtFloat2 &v2) const
282  {
283  return std::abs(this->Dot(v2));
284  }
285  inline friend float AbsDot(const RtFloat2 &v1, const RtFloat2 &v2)
286  {
287  return v1.AbsDot(v2);
288  }
289 
290  // Cross product
291  inline float Cross(const RtFloat2 &v2) const
292  {
293  return x * v2.y - y * v2.x;
294  }
295  inline friend float Cross(const RtFloat2 &v1, const RtFloat2 &v2)
296  {
297  return v1.Cross(v2);
298  }
299 
300  inline float ChannelAvg() const
301  {
302  return (x + y) * .5f;
303  }
304 
305  inline float ChannelMin() const
306  {
307  return std::min(x, y);
308  }
309 
310  inline float ChannelMax() const
311  {
312  return std::max(x, y);
313  }
314 
315 };
316 
317 static_assert(sizeof(RtFloat2) == sizeof(float[2]), "ensure compat with legacy c-layout");
318 typedef RtFloat2 RtPoint2;
320 
321 typedef pxrcore::Float4 RtFloat4;
322 static_assert(sizeof(RtFloat4) == sizeof(float[4]), "ensure compat with legacy c-layout");
323 typedef RtFloat4 RtPoint4;
324 
325 // -------------------------------------------------------------------------
326 // RtBBox - an axis-aligned bounding box
327 class RtBBox {
328  public:
329  // allow direct member access
331 
332  inline RtBBox() {}
333  inline RtBBox(float minx, float miny, float minz,
334  float maxx, float maxy, float maxz)
335  {
336  min.x = minx; min.y = miny; min.z = minz;
337  max.x = maxx; max.y = maxy; max.z = maxz;
338  }
339  inline RtBBox(const RtPoint3 &_min, const RtPoint3 &_max)
340  {
341  min = _min;
342  max = _max;
343  }
344 
345  inline void Expand(const float expansion) {
346  // Expand proportional to size near origin (i.e., interval
347  // contains zero) and proportional to distance from origin
348  // when farther away. Numerically, this guarantees expansion
349  // no matter where it is.
350  float d;
351  d = expansion * (fabsf(min.x) + fabsf(max.x));
352  min.x -= d;
353  max.x += d;
354 
355  d = expansion * (fabsf(min.y) + fabsf(max.y));
356  min.y -= d;
357  max.y += d;
358 
359  d = expansion * (fabsf(min.z) + fabsf(max.z));
360  min.z -= d;
361  max.z += d;
362  }
363 
364  // Volume of bounding box
365  inline float Volume() const
366  {
367  return ((max.x - min.x) *
368  (max.y - min.y) *
369  (max.z - min.z));
370  }
371 
372  // Surface area of bounding box
373  inline float SurfaceArea() const
374  {
375  RtVector3 diff(max - min);
376  return 2.0f * (diff.x * diff.y + diff.x * diff.z + diff.y * diff.z);
377  }
378 
379  // Length of the diagonal of the bounding box
380  inline float Diagonal() const
381  {
382  return RtVector3(max - min).Length();
383  }
384 
385  // Square of the length of the diagonal of the bounding box
386  inline float DiagonalSq() const
387  {
388  return RtVector3(max - min).LengthSq();
389  }
390 
391  inline RtPoint3 Center() const
392  {
393  return 0.5f * RtPoint3(min + max);
394  }
395 
396  // Make the bounding box contain point pt
397  inline void Expand(const RtPoint3 &pt)
398  {
399  if (pt.x < min.x) min.x = pt.x;
400  if (pt.y < min.y) min.y = pt.y;
401  if (pt.z < min.z) min.z = pt.z;
402  if (pt.x > max.x) max.x = pt.x;
403  if (pt.y > max.y) max.y = pt.y;
404  if (pt.z > max.z) max.z = pt.z;
405  }
406 
407  // this = this union bbox
408  inline void Union(const RtBBox &bbox)
409  {
410  if (bbox.min.x < min.x) min.x = bbox.min.x;
411  if (bbox.min.y < min.y) min.y = bbox.min.y;
412  if (bbox.min.z < min.z) min.z = bbox.min.z;
413  if (bbox.max.x > max.x) max.x = bbox.max.x;
414  if (bbox.max.y > max.y) max.y = bbox.max.y;
415  if (bbox.max.z > max.z) max.z = bbox.max.z;
416  }
417 
418  // this = this intersect bbox
419  inline void Intersect(const RtBBox &bbox)
420  {
421  if (bbox.min.x > min.x) min.x = bbox.min.x;
422  if (bbox.min.y > min.y) min.y = bbox.min.y;
423  if (bbox.min.z > min.z) min.z = bbox.min.z;
424  if (bbox.max.x < max.x) max.x = bbox.max.x;
425  if (bbox.max.y < max.y) max.y = bbox.max.y;
426  if (bbox.max.z < max.z) max.z = bbox.max.z;
427  }
428 
429  // Does this bounding box contain point pt?
430  inline bool Contains(const RtPoint3 &pt) const
431  {
432  bool contains =
433  (min.x < pt.x && pt.x < max.x &&
434  min.y < pt.y && pt.y < max.y &&
435  min.z < pt.z && pt.z < max.z);
436  return contains;
437  }
438 
439  // Is point pt entirely outside this bounding box?
440  // (Note: a point on the surface is neither contained nor outside.)
441  inline bool Outside(const RtPoint3 &pt) const
442  {
443  return (pt.x < min.x || max.x < pt.x ||
444  pt.y < min.y || max.y < pt.y ||
445  pt.z < min.z || max.z < pt.z);
446  }
447 
448  // Does this bounding box entirely enclose another bounding box?
449  inline bool Encloses(const RtBBox &bbox) const
450  {
451  return (bbox.min.x >= min.x && bbox.min.y >= min.y && bbox.min.z >= min.z &&
452  bbox.max.x <= max.x && bbox.max.y <= max.y && bbox.max.z <= max.z);
453  }
454 
455  // Does this bounding box overlap another bounding box?
456  inline bool Overlaps(const RtBBox &bbox) const
457  {
458  return !(max.x <= bbox.min.x || bbox.max.x <= min.x ||
459  max.y <= bbox.min.y || bbox.max.y <= min.y ||
460  max.z <= bbox.min.z || bbox.max.z <= min.z);
461  }
462 
463  // Is this bounding box intersected by the ray defined by origin
464  // org and inverse direction invdir between 0 and tmax? If yes,
465  // dist0 and dist1 contain the intersection points
466  inline bool Intersects(const RtPoint3 &org, const RtVector3 &invdir,
467  float tmax, float *dist0, float *dist1) const
468  {
469  float tmin = 0.0f;
470  float t0, t1;
471 
472  // Compute slab intersection intervals for x component
473  if (invdir.x < 0.0f) {
474  t0 = (max.x - org.x) * invdir.x;
475  t1 = (min.x - org.x) * invdir.x;
476  } else {
477  t0 = (min.x - org.x) * invdir.x;
478  t1 = (max.x - org.x) * invdir.x;
479  }
480  // At this point, t0 and t1 is +/-inf if ray->dir.x is +/-0.
481  // t0 or t1 is NaN if bbox-org is 0 and invdirx is inf (since
482  // inf*0 is NaN by convention)
483  if (t0 > tmin) tmin = t0;
484  if (t1 < tmax) tmax = t1;
485  if (tmin > tmax)
486  return false; // slab interval is empty
487 
488  // Compute slab intersection intervals for y component
489  if (invdir.y < 0.0f) {
490  t0 = (max.y - org.y) * invdir.y;
491  t1 = (min.y - org.y) * invdir.y;
492  } else {
493  t0 = (min.y - org.y) * invdir.y;
494  t1 = (max.y - org.y) * invdir.y;
495  }
496  if (t0 > tmin) tmin = t0;
497  if (t1 < tmax) tmax = t1;
498  if (tmin > tmax)
499  return false; // slab interval is empty
500 
501  // Compute slab intersection intervals for z component
502  if (invdir.z < 0.0f) {
503  t0 = (max.z - org.z) * invdir.z;
504  t1 = (min.z - org.z) * invdir.z;
505  } else {
506  t0 = (min.z - org.z) * invdir.z;
507  t1 = (max.z - org.z) * invdir.z;
508  }
509  if (t0 > tmin) tmin = t0;
510  if (t1 < tmax) tmax = t1;
511  if (tmin > tmax)
512  return false; // slab interval is empty
513 
514  *dist0 = tmin;
515  *dist1 = tmax;
516  return true;
517  }
518 };
519 
520 typedef pxrcore::ColorRGB RtColorRGB;
521 static_assert(sizeof(RtColorRGB) == sizeof(float[3]), "ensure compat with legacy c-layout");
522 
523 // -------------------------------------------------------------------------
524 // A simple reference counted pointer class.
525 //
526 // To use, the templated type should be a class/struct that implements the
527 // following public methods:
528 //
529 // void IncRef() // increment the reference count
530 // void DecRef() // decrement the reference count, deleting object when zero
531 // int GetRefCnt() // returns the current reference count
532 //
533 // Use about the same way that you would a boost::shared_ptr<T> class, except
534 // that the reference count is stored and modified within the templated type
535 // (tbb::atomic or similar would be recommended for multi-threaded usage).
536 //
537 // Portability note: When implementing DecRef() in your templated class, keep
538 // in mind that it is important on Windows that the call to new/delete or
539 // malloc/free of the reference-counted object happens in the same .dll / .exe.
540 //
541 // Note: We would just use boost or tr1 reference-counted pointers instead of
542 // providing this utility class, except that we don't want to introduce a
543 // dependency on boost or tr1 here for a few different reasons.
544 //
545 template<typename T>
547 {
548  public:
549 
550  // Default constructor; sets the pointer value to zero.
551  RixRefCntPtr() : m_ptr(0)
552  {
553  }
554 
555  // Construct from a direct pointer; increments the reference count.
556  RixRefCntPtr(T *ptr) : m_ptr(ptr)
557  {
558  if (m_ptr)
559  m_ptr->IncRef();
560  }
561 
562  // Copy constructor; increments the reference count.
564  {
565  m_ptr = that.m_ptr;
566  if (m_ptr)
567  m_ptr->IncRef();
568  }
569 
570  // Destructor; decrements the reference count, deleting if now unused.
572  {
573  if (m_ptr)
574  m_ptr->DecRef();
575  }
576 
577  // Assignment operator; increment the rhs count, decrement the lhs count.
579  {
580  if (that.m_ptr != m_ptr)
581  {
582  if (that.m_ptr)
583  that.m_ptr->IncRef();
584 
585  if (m_ptr)
586  m_ptr->DecRef();
587 
588  m_ptr = that.m_ptr;
589  }
590 
591  return *this;
592  }
593 
594  // Assignment operator; increment the rhs count, decrement the lhs count.
596  {
597  if (m_ptr != ptr)
598  {
599  if (ptr)
600  ptr->IncRef();
601 
602  if (m_ptr)
603  m_ptr->DecRef();
604 
605  m_ptr = ptr;
606  }
607 
608  return *this;
609  }
610 
611  // Equality test; check if pointers are the same.
612  bool operator== (RixRefCntPtr<T> const &that) const
613  {
614  return m_ptr == that.m_ptr;
615  }
616 
617  // Equality test; check if pointers are the same.
618  bool operator== (T const *ptr) const
619  {
620  return m_ptr == ptr;
621  }
622 
623  // Inequality test; check if the pointers are different.
624  bool operator!= (RixRefCntPtr<T> const &that) const
625  {
626  return m_ptr != that.m_ptr;
627  }
628 
629  // Inequality test; check if the pointers are different.
630  bool operator!= (T const *ptr) const
631  {
632  return m_ptr != ptr;
633  }
634 
635  // Comparison operator; comparison based on memory address.
636  bool operator< (RixRefCntPtr<T> const &that) const
637  {
638  return m_ptr < that.m_ptr;
639  }
640 
641  // Comparison operator; comparison based on memory address.
642  bool operator< (T const *ptr) const
643  {
644  return m_ptr < ptr;
645  }
646 
647  // Boolean conversion operator; true when pointer is non-null.
648  operator bool () const { return m_ptr != NULL; }
649 
650  // Indirection operator; return the pointer value by reference.
651  T& operator* () { return *m_ptr; }
652  T const& operator* () const { return *m_ptr; }
653 
654  // Dereference operator; return the pointer value.
655  T* operator-> () { return m_ptr; }
656  T const* operator-> () const { return m_ptr; }
657 
658  // Returns the pointer value.
659  T* GetPtr() { return m_ptr; }
660  const T* GetPtr() const { return m_ptr; }
661 
662  // Set the pointer value without modifying the reference count.
663  void SetPtr(T *ptr) { m_ptr = ptr; }
664 
665  // Returns the current reference count.
666  int GetRefCnt() const { return m_ptr ? m_ptr->GetRefCnt() : 0; }
667 
668  private:
669 
670  // The pointer value.
671  T *m_ptr;
672 };
673 
674 /*
675 namespace RixConstants
676 {
677  static const RtMatrix4x4 k_identityMatrix();
678  static const RtMatrix4x4 k_zeroMatrix(RtVector3(0.f), 0.f);
679 }
680 */
681 
682 typedef pxrcore::UString RtUString;
683 #define US_NULL RtUString()
684 
685 typedef pxrcore::DataType RtDataType;
686 typedef pxrcore::DetailType RtDetailType;
687 typedef pxrcore::ParamList RtParamList;
688 typedef pxrcore::PrimVarList RtPrimVarList;
689 
690 #endif
RtFloat2(const float *d)
Definition: RiTypesHelper.h:93
RtFloat2 & operator*=(float rhs)
Definition: RiTypesHelper.h:196
RixRefCntPtr(T *ptr)
Definition: RiTypesHelper.h:556
int operator!=(const RtFloat2 &rhs) const
Definition: RiTypesHelper.h:112
float Dot(const RtFloat2 &v2) const
Definition: RiTypesHelper.h:271
~RixRefCntPtr()
Definition: RiTypesHelper.h:571
RtFloat2 & operator/=(const RtFloat2 &rhs)
Definition: RiTypesHelper.h:178
friend float Cross(const RtFloat2 &v1, const RtFloat2 &v2)
Definition: RiTypesHelper.h:295
pxrcore::Float4 RtFloat4
Definition: RiTypesHelper.h:321
float x
Definition: RiTypesHelper.h:86
float AbsDot(const RtFloat2 &v2) const
Definition: RiTypesHelper.h:281
friend float Dot(const RtFloat2 &v1, const RtFloat2 &v2)
Definition: RiTypesHelper.h:275
void Union(const RtBBox &bbox)
Definition: RiTypesHelper.h:408
bool operator==(RixRefCntPtr< T > const &that) const
Definition: RiTypesHelper.h:612
pxrcore::ColorRGB RtColorRGB
Definition: RiTypesHelper.h:520
RtFloat2 NormalizeCopy(const RtFloat2 &v) const
Definition: RiTypesHelper.h:251
friend RtFloat2 operator*(float lhs, const RtFloat2 &rhs)
Definition: RiTypesHelper.h:193
pxrcore::ParamList RtParamList
Definition: RiTypesHelper.h:687
T & operator*()
Definition: RiTypesHelper.h:651
RtFloat3 RtPoint3
Definition: RiTypesHelper.h:70
void Negate()
Definition: RiTypesHelper.h:264
bool operator<(const RtFloat2 &rhs) const
Definition: RiTypesHelper.h:118
RixRefCntPtr()
Definition: RiTypesHelper.h:551
float LengthSq() const
Definition: RiTypesHelper.h:216
bool IsUnitLength(float eps=0.005f) const
Definition: RiTypesHelper.h:226
bool Intersects(const RtPoint3 &org, const RtVector3 &invdir, float tmax, float *dist0, float *dist1) const
Definition: RiTypesHelper.h:466
float ChannelAvg() const
Definition: RiTypesHelper.h:300
RixRefCntPtr< T > & operator=(RixRefCntPtr< T > const &that)
Definition: RiTypesHelper.h:578
RtFloat2 operator/(const RtFloat2 &rhs) const
Definition: RiTypesHelper.h:174
RtFloat2 & operator/=(float rhs)
Definition: RiTypesHelper.h:209
float ChannelMax() const
Definition: RiTypesHelper.h:310
RtPoint3 min
Definition: RiTypesHelper.h:330
RtFloat2 operator-() const
Definition: RiTypesHelper.h:186
float Volume() const
Definition: RiTypesHelper.h:365
Definition: RiTypesHelper.h:82
pxrcore::DataType RtDataType
Definition: RiTypesHelper.h:685
bool Encloses(const RtBBox &bbox) const
Definition: RiTypesHelper.h:449
float Cross(const RtFloat2 &v2) const
Definition: RiTypesHelper.h:291
pxrcore::DetailType RtDetailType
Definition: RiTypesHelper.h:686
bool Contains(const RtPoint3 &pt) const
Definition: RiTypesHelper.h:430
bool operator<(RixRefCntPtr< T > const &that) const
Definition: RiTypesHelper.h:636
RtFloat2 operator*(float rhs) const
Definition: RiTypesHelper.h:189
RtBBox(const RtPoint3 &_min, const RtPoint3 &_max)
Definition: RiTypesHelper.h:339
bool Outside(const RtPoint3 &pt) const
Definition: RiTypesHelper.h:441
pxrcore::Float3 RtFloat3
Definition: RiTypesHelper.h:69
RtFloat2 & operator+=(const RtFloat2 &rhs)
Definition: RiTypesHelper.h:143
RtPoint3 max
Definition: RiTypesHelper.h:330
Definition: RiTypesHelper.h:327
pxrcore::PrimVarList RtPrimVarList
Definition: RiTypesHelper.h:688
int operator==(const RtFloat2 &rhs) const
Definition: RiTypesHelper.h:108
float Length() const
Definition: RiTypesHelper.h:220
int GetRefCnt() const
Definition: RiTypesHelper.h:666
RtFloat3 RtNormal3
Definition: RiTypesHelper.h:73
RtFloat2 operator/(float rhs) const
Definition: RiTypesHelper.h:204
Definition: RiTypesHelper.h:546
RtBBox(float minx, float miny, float minz, float maxx, float maxy, float maxz)
Definition: RiTypesHelper.h:333
bool Overlaps(const RtBBox &bbox) const
Definition: RiTypesHelper.h:456
friend float Normalize(RtFloat2 &v)
Definition: RiTypesHelper.h:245
RtFloat2 RtVector2
Definition: RiTypesHelper.h:319
RtBBox()
Definition: RiTypesHelper.h:332
float & operator[](int i)
Definition: RiTypesHelper.h:96
T * GetPtr()
Definition: RiTypesHelper.h:659
void SetPtr(T *ptr)
Definition: RiTypesHelper.h:663
T * operator->()
Definition: RiTypesHelper.h:655
float DiagonalSq() const
Definition: RiTypesHelper.h:386
float y
Definition: RiTypesHelper.h:86
const T * GetPtr() const
Definition: RiTypesHelper.h:660
float Normalize(float eps=FLT_MIN)
Definition: RiTypesHelper.h:233
void Expand(const float expansion)
Definition: RiTypesHelper.h:345
void Intersect(const RtBBox &bbox)
Definition: RiTypesHelper.h:419
RtFloat2 operator*(const RtFloat2 &rhs) const
Definition: RiTypesHelper.h:162
RtFloat4 RtPoint4
Definition: RiTypesHelper.h:322
RtFloat2 & operator-=(const RtFloat2 &rhs)
Definition: RiTypesHelper.h:154
RtFloat2(float v)
Definition: RiTypesHelper.h:90
bool operator!=(RixRefCntPtr< T > const &that) const
Definition: RiTypesHelper.h:624
pxrcore::Matrix4x4 RtMatrix4x4
Definition: RiTypesHelper.h:74
RtFloat2 operator-(const RtFloat2 &rhs) const
Definition: RiTypesHelper.h:150
friend RtFloat2 NormalizeCopy(const RtFloat2 &v)
Definition: RiTypesHelper.h:257
RtFloat2 & operator*=(const RtFloat2 &rhs)
Definition: RiTypesHelper.h:166
float ChannelMin() const
Definition: RiTypesHelper.h:305
void Expand(const RtPoint3 &pt)
Definition: RiTypesHelper.h:397
pxrcore::UString RtUString
Definition: RiTypesHelper.h:682
RixRefCntPtr(RixRefCntPtr const &that)
Definition: RiTypesHelper.h:563
friend std::ostream & operator<<(std::ostream &o, const RtFloat2 &v)
Definition: RiTypesHelper.h:132
float Diagonal() const
Definition: RiTypesHelper.h:380
RtFloat2()=default
RtFloat2(float xx, float yy)
Definition: RiTypesHelper.h:89
float SurfaceArea() const
Definition: RiTypesHelper.h:373
RtFloat3 RtVector3
Definition: RiTypesHelper.h:72
RtFloat2 operator+(const RtFloat2 &rhs) const
Definition: RiTypesHelper.h:139
RtFloat2 RtPoint2
Definition: RiTypesHelper.h:317
RtPoint3 Center() const
Definition: RiTypesHelper.h:391
friend float AbsDot(const RtFloat2 &v1, const RtFloat2 &v2)
Definition: RiTypesHelper.h:285