MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/Imath / testIsInfinite

Function testIsInfinite

src/ImathTest/testBox.cpp:781–834  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

779
780template <class T>
781void
782testIsInfinite (const char* type)
783{
784 cout << " isInfinite() for type " << type << endl;
785
786 //
787 // Infinite box.
788 //
789 {
790 IMATH_INTERNAL_NAMESPACE::Box<T> b;
791 b.makeInfinite ();
792 assert (b.isInfinite ());
793 }
794
795 //
796 // Non-empty, has-volume box.
797 // 2D: [(-2, -4), ( 8, 2) ]
798 // 3D: [(-2, -4, -6), (12, 8, 2) ]
799 // 4D: [(-2, -4, -6, -8), (16, 12, 8, 4) ]
800 //
801 {
802 IMATH_INTERNAL_NAMESPACE::Box<T> b0 (T (-1), T (1));
803 assert (!b0.isInfinite ());
804
805 T p0;
806 T p1;
807 for (unsigned int i = 0; i < T::dimensions (); i++)
808 {
809 int lo = 1 << (i + 1);
810 int hi = 1 << (T::dimensions () - i);
811 p0[i] = -static_cast<typename T::BaseType>(lo);
812 p1[i] = static_cast<typename T::BaseType>(hi);
813 }
814 IMATH_INTERNAL_NAMESPACE::Box<T> b1 (p0, p1);
815 assert (!b1.isInfinite ());
816 }
817
818 //
819 // Non-empty, no-volume box.
820 // Boxes are:
821 // 2D: [(0, 0), (0, 2) ]
822 // 3D: [(0, 0, 0), (0, 0, 2) ]
823 // 4D: [(0, 0, 0, 0), (0, 0, 0, 2)]
824 //
825 {
826 T min (0);
827 T max = min;
828 max[T::dimensions () - 1] = 2;
829
830 IMATH_INTERNAL_NAMESPACE::Box<T> b (min, max);
831
832 assert (!b.isInfinite ());
833 }
834}
835
836template <class T>
837void

Callers

nothing calls this directly

Calls 3

makeInfiniteMethod · 0.80
TClass · 0.50
dimensionsFunction · 0.50

Tested by

no test coverage detected