Lines Matching refs:T
61 template <class T> class Vec2;
62 template <class T> class Vec3;
63 template <class T> class Vec4;
68 template <class T> class Vec2
76 T x, y;
78 T & operator [] (int i);
79 const T & operator [] (int i) const;
87 explicit Vec2 (T a); // (a a)
88 Vec2 (T a, T b); // (a b)
117 T * getValue ();
118 const T * getValue () const;
150 bool equalWithAbsError (const Vec2<T> &v, T e) const;
151 bool equalWithRelError (const Vec2<T> &v, T e) const;
157 T dot (const Vec2 &v) const;
158 T operator ^ (const Vec2 &v) const;
166 T cross (const Vec2 &v) const;
167 T operator % (const Vec2 &v) const;
199 const Vec2 & operator *= (T a);
201 Vec2 operator * (T a) const;
209 const Vec2 & operator /= (T a);
211 Vec2 operator / (T a) const;
223 T length () const;
224 T length2 () const;
230 Vec2<T> normalized () const; // does not modify *this
231 Vec2<T> normalizedExc () const throw (Iex::MathExc);
232 Vec2<T> normalizedNonNull () const;
246 static T baseTypeMin() {return limits<T>::min();} in baseTypeMin()
247 static T baseTypeMax() {return limits<T>::max();} in baseTypeMax()
248 static T baseTypeSmallest() {return limits<T>::smallest();} in baseTypeSmallest()
249 static T baseTypeEpsilon() {return limits<T>::epsilon();} in baseTypeEpsilon()
258 typedef T BaseType;
262 T lengthTiny () const;
266 template <class T> class Vec3
274 T x, y, z;
276 T & operator [] (int i);
277 const T & operator [] (int i) const;
285 explicit Vec3 (T a); // (a a a)
286 Vec3 (T a, T b, T c); // (a b c)
330 T * getValue();
331 const T * getValue() const;
362 bool equalWithAbsError (const Vec3<T> &v, T e) const;
363 bool equalWithRelError (const Vec3<T> &v, T e) const;
369 T dot (const Vec3 &v) const;
370 T operator ^ (const Vec3 &v) const;
411 const Vec3 & operator *= (T a);
413 Vec3 operator * (T a) const;
421 const Vec3 & operator /= (T a);
423 Vec3 operator / (T a) const;
435 T length () const;
436 T length2 () const;
442 Vec3<T> normalized () const; // does not modify *this
443 Vec3<T> normalizedExc () const throw (Iex::MathExc);
444 Vec3<T> normalizedNonNull () const;
458 static T baseTypeMin() {return limits<T>::min();} in baseTypeMin()
459 static T baseTypeMax() {return limits<T>::max();} in baseTypeMax()
460 static T baseTypeSmallest() {return limits<T>::smallest();} in baseTypeSmallest()
461 static T baseTypeEpsilon() {return limits<T>::epsilon();} in baseTypeEpsilon()
470 typedef T BaseType;
474 T lengthTiny () const;
479 template <class T> class Vec4
487 T x, y, z, w;
489 T & operator [] (int i);
490 const T & operator [] (int i) const;
498 explicit Vec4 (T a); // (a a a a)
499 Vec4 (T a, T b, T c, T d); // (a b c d)
548 bool equalWithAbsError (const Vec4<T> &v, T e) const;
549 bool equalWithRelError (const Vec4<T> &v, T e) const;
556 T dot (const Vec4 &v) const;
557 T operator ^ (const Vec4 &v) const;
593 const Vec4 & operator *= (T a);
595 Vec4 operator * (T a) const;
603 const Vec4 & operator /= (T a);
605 Vec4 operator / (T a) const;
617 T length () const;
618 T length2 () const;
624 Vec4<T> normalized () const; // does not modify *this
625 Vec4<T> normalizedExc () const throw (Iex::MathExc);
626 Vec4<T> normalizedNonNull () const;
640 static T baseTypeMin() {return limits<T>::min();} in baseTypeMin()
641 static T baseTypeMax() {return limits<T>::max();} in baseTypeMax()
642 static T baseTypeSmallest() {return limits<T>::smallest();} in baseTypeSmallest()
643 static T baseTypeEpsilon() {return limits<T>::epsilon();} in baseTypeEpsilon()
652 typedef T BaseType;
656 T lengthTiny () const;
664 template <class T>
665 std::ostream & operator << (std::ostream &s, const Vec2<T> &v);
667 template <class T>
668 std::ostream & operator << (std::ostream &s, const Vec3<T> &v);
670 template <class T>
671 std::ostream & operator << (std::ostream &s, const Vec4<T> &v);
677 template <class T> Vec2<T> operator * (T a, const Vec2<T> &v);
678 template <class T> Vec3<T> operator * (T a, const Vec3<T> &v);
679 template <class T> Vec4<T> operator * (T a, const Vec4<T> &v);
851 template <class T>
852 inline T &
853 Vec2<T>::operator [] (int i)
858 template <class T>
859 inline const T &
860 Vec2<T>::operator [] (int i) const
865 template <class T>
867 Vec2<T>::Vec2 () in Vec2()
872 template <class T>
874 Vec2<T>::Vec2 (T a) in Vec2()
879 template <class T>
881 Vec2<T>::Vec2 (T a, T b) in Vec2()
887 template <class T>
889 Vec2<T>::Vec2 (const Vec2 &v) in Vec2()
895 template <class T>
898 Vec2<T>::Vec2 (const Vec2<S> &v) in Vec2()
900 x = T (v.x); in Vec2()
901 y = T (v.y); in Vec2()
904 template <class T>
905 inline const Vec2<T> &
906 Vec2<T>::operator = (const Vec2 &v)
913 template <class T>
916 Vec2<T>::setValue (S a, S b) in setValue()
918 x = T (a); in setValue()
919 y = T (b); in setValue()
922 template <class T>
925 Vec2<T>::setValue (const Vec2<S> &v) in setValue()
927 x = T (v.x); in setValue()
928 y = T (v.y); in setValue()
931 template <class T>
934 Vec2<T>::getValue (S &a, S &b) const in getValue()
940 template <class T>
943 Vec2<T>::getValue (Vec2<S> &v) const in getValue()
949 template <class T>
950 inline T *
951 Vec2<T>::getValue() in getValue()
953 return (T *) &x; in getValue()
956 template <class T>
957 inline const T *
958 Vec2<T>::getValue() const in getValue()
960 return (const T *) &x; in getValue()
963 template <class T>
966 Vec2<T>::operator == (const Vec2<S> &v) const
971 template <class T>
974 Vec2<T>::operator != (const Vec2<S> &v) const
979 template <class T>
981 Vec2<T>::equalWithAbsError (const Vec2<T> &v, T e) const in equalWithAbsError()
990 template <class T>
992 Vec2<T>::equalWithRelError (const Vec2<T> &v, T e) const in equalWithRelError()
1001 template <class T>
1002 inline T
1003 Vec2<T>::dot (const Vec2 &v) const in dot()
1008 template <class T>
1009 inline T
1010 Vec2<T>::operator ^ (const Vec2 &v) const
1015 template <class T>
1016 inline T
1017 Vec2<T>::cross (const Vec2 &v) const in cross()
1023 template <class T>
1024 inline T
1025 Vec2<T>::operator % (const Vec2 &v) const
1030 template <class T>
1031 inline const Vec2<T> &
1032 Vec2<T>::operator += (const Vec2 &v)
1039 template <class T>
1040 inline Vec2<T>
1041 Vec2<T>::operator + (const Vec2 &v) const
1046 template <class T>
1047 inline const Vec2<T> &
1048 Vec2<T>::operator -= (const Vec2 &v)
1055 template <class T>
1056 inline Vec2<T>
1057 Vec2<T>::operator - (const Vec2 &v) const
1062 template <class T>
1063 inline Vec2<T>
1064 Vec2<T>::operator - () const
1069 template <class T>
1070 inline const Vec2<T> &
1071 Vec2<T>::negate () in negate()
1078 template <class T>
1079 inline const Vec2<T> &
1080 Vec2<T>::operator *= (const Vec2 &v)
1087 template <class T>
1088 inline const Vec2<T> &
1089 Vec2<T>::operator *= (T a)
1096 template <class T>
1097 inline Vec2<T>
1098 Vec2<T>::operator * (const Vec2 &v) const
1103 template <class T>
1104 inline Vec2<T>
1105 Vec2<T>::operator * (T a) const
1110 template <class T>
1111 inline const Vec2<T> &
1112 Vec2<T>::operator /= (const Vec2 &v)
1119 template <class T>
1120 inline const Vec2<T> &
1121 Vec2<T>::operator /= (T a)
1128 template <class T>
1129 inline Vec2<T>
1130 Vec2<T>::operator / (const Vec2 &v) const
1135 template <class T>
1136 inline Vec2<T>
1137 Vec2<T>::operator / (T a) const
1142 template <class T>
1143 T
1144 Vec2<T>::lengthTiny () const in lengthTiny()
1146 T absX = (x >= T (0))? x: -x; in lengthTiny()
1147 T absY = (y >= T (0))? y: -y; in lengthTiny()
1149 T max = absX; in lengthTiny()
1154 if (max == T (0)) in lengthTiny()
1155 return T (0); in lengthTiny()
1166 return max * Math<T>::sqrt (absX * absX + absY * absY); in lengthTiny()
1169 template <class T>
1170 inline T
1171 Vec2<T>::length () const in length()
1173 T length2 = dot (*this); in length()
1175 if (length2 < T (2) * limits<T>::smallest()) in length()
1178 return Math<T>::sqrt (length2); in length()
1181 template <class T>
1182 inline T
1183 Vec2<T>::length2 () const in length2()
1188 template <class T>
1189 const Vec2<T> &
1190 Vec2<T>::normalize () in normalize()
1192 T l = length(); in normalize()
1194 if (l != T (0)) in normalize()
1209 template <class T>
1210 const Vec2<T> &
1211 Vec2<T>::normalizeExc () throw (Iex::MathExc) in normalizeExc()
1213 T l = length(); in normalizeExc()
1215 if (l == T (0)) in normalizeExc()
1223 template <class T>
1225 const Vec2<T> &
1226 Vec2<T>::normalizeNonNull () in normalizeNonNull()
1228 T l = length(); in normalizeNonNull()
1234 template <class T>
1235 Vec2<T>
1236 Vec2<T>::normalized () const in normalized()
1238 T l = length(); in normalized()
1240 if (l == T (0)) in normalized()
1241 return Vec2 (T (0)); in normalized()
1246 template <class T>
1247 Vec2<T>
1248 Vec2<T>::normalizedExc () const throw (Iex::MathExc) in normalizedExc()
1250 T l = length(); in normalizedExc()
1252 if (l == T (0)) in normalizedExc()
1258 template <class T>
1260 Vec2<T>
1261 Vec2<T>::normalizedNonNull () const in normalizedNonNull()
1263 T l = length(); in normalizedNonNull()
1272 template <class T>
1273 inline T &
1274 Vec3<T>::operator [] (int i)
1279 template <class T>
1280 inline const T &
1281 Vec3<T>::operator [] (int i) const
1286 template <class T>
1288 Vec3<T>::Vec3 () in Vec3()
1293 template <class T>
1295 Vec3<T>::Vec3 (T a) in Vec3()
1300 template <class T>
1302 Vec3<T>::Vec3 (T a, T b, T c) in Vec3()
1309 template <class T>
1311 Vec3<T>::Vec3 (const Vec3 &v) in Vec3()
1318 template <class T>
1321 Vec3<T>::Vec3 (const Vec3<S> &v) in Vec3()
1323 x = T (v.x); in Vec3()
1324 y = T (v.y); in Vec3()
1325 z = T (v.z); in Vec3()
1328 template <class T>
1329 inline const Vec3<T> &
1330 Vec3<T>::operator = (const Vec3 &v)
1338 template <class T>
1341 Vec3<T>::Vec3 (const Vec4<S> &v) in Vec3()
1343 x = T (v.x / v.w); in Vec3()
1344 y = T (v.y / v.w); in Vec3()
1345 z = T (v.z / v.w); in Vec3()
1348 template <class T>
1350 Vec3<T>::Vec3 (const Vec4<S> &v, InfException) in Vec3()
1352 T vx = T (v.x); in Vec3()
1353 T vy = T (v.y); in Vec3()
1354 T vz = T (v.z); in Vec3()
1355 T vw = T (v.w); in Vec3()
1357 T absW = (vw >= T (0))? vw: -vw; in Vec3()
1361 T m = baseTypeMax() * absW; in Vec3()
1372 template <class T>
1375 Vec3<T>::setValue (S a, S b, S c) in setValue()
1377 x = T (a); in setValue()
1378 y = T (b); in setValue()
1379 z = T (c); in setValue()
1382 template <class T>
1385 Vec3<T>::setValue (const Vec3<S> &v) in setValue()
1387 x = T (v.x); in setValue()
1388 y = T (v.y); in setValue()
1389 z = T (v.z); in setValue()
1392 template <class T>
1395 Vec3<T>::getValue (S &a, S &b, S &c) const in getValue()
1402 template <class T>
1405 Vec3<T>::getValue (Vec3<S> &v) const in getValue()
1412 template <class T>
1413 inline T *
1414 Vec3<T>::getValue() in getValue()
1416 return (T *) &x; in getValue()
1419 template <class T>
1420 inline const T *
1421 Vec3<T>::getValue() const in getValue()
1423 return (const T *) &x; in getValue()
1426 template <class T>
1429 Vec3<T>::operator == (const Vec3<S> &v) const
1434 template <class T>
1437 Vec3<T>::operator != (const Vec3<S> &v) const
1442 template <class T>
1444 Vec3<T>::equalWithAbsError (const Vec3<T> &v, T e) const in equalWithAbsError()
1453 template <class T>
1455 Vec3<T>::equalWithRelError (const Vec3<T> &v, T e) const in equalWithRelError()
1464 template <class T>
1465 inline T
1466 Vec3<T>::dot (const Vec3 &v) const in dot()
1471 template <class T>
1472 inline T
1473 Vec3<T>::operator ^ (const Vec3 &v) const
1478 template <class T>
1479 inline Vec3<T>
1480 Vec3<T>::cross (const Vec3 &v) const in cross()
1487 template <class T>
1488 inline const Vec3<T> &
1489 Vec3<T>::operator %= (const Vec3 &v)
1491 T a = y * v.z - z * v.y;
1492 T b = z * v.x - x * v.z;
1493 T c = x * v.y - y * v.x;
1500 template <class T>
1501 inline Vec3<T>
1502 Vec3<T>::operator % (const Vec3 &v) const
1509 template <class T>
1510 inline const Vec3<T> &
1511 Vec3<T>::operator += (const Vec3 &v)
1519 template <class T>
1520 inline Vec3<T>
1521 Vec3<T>::operator + (const Vec3 &v) const
1526 template <class T>
1527 inline const Vec3<T> &
1528 Vec3<T>::operator -= (const Vec3 &v)
1536 template <class T>
1537 inline Vec3<T>
1538 Vec3<T>::operator - (const Vec3 &v) const
1543 template <class T>
1544 inline Vec3<T>
1545 Vec3<T>::operator - () const
1550 template <class T>
1551 inline const Vec3<T> &
1552 Vec3<T>::negate () in negate()
1560 template <class T>
1561 inline const Vec3<T> &
1562 Vec3<T>::operator *= (const Vec3 &v)
1570 template <class T>
1571 inline const Vec3<T> &
1572 Vec3<T>::operator *= (T a)
1580 template <class T>
1581 inline Vec3<T>
1582 Vec3<T>::operator * (const Vec3 &v) const
1587 template <class T>
1588 inline Vec3<T>
1589 Vec3<T>::operator * (T a) const
1594 template <class T>
1595 inline const Vec3<T> &
1596 Vec3<T>::operator /= (const Vec3 &v)
1604 template <class T>
1605 inline const Vec3<T> &
1606 Vec3<T>::operator /= (T a)
1614 template <class T>
1615 inline Vec3<T>
1616 Vec3<T>::operator / (const Vec3 &v) const
1621 template <class T>
1622 inline Vec3<T>
1623 Vec3<T>::operator / (T a) const
1628 template <class T>
1629 T
1630 Vec3<T>::lengthTiny () const in lengthTiny()
1632 T absX = (x >= T (0))? x: -x; in lengthTiny()
1633 T absY = (y >= T (0))? y: -y; in lengthTiny()
1634 T absZ = (z >= T (0))? z: -z; in lengthTiny()
1636 T max = absX; in lengthTiny()
1644 if (max == T (0)) in lengthTiny()
1645 return T (0); in lengthTiny()
1657 return max * Math<T>::sqrt (absX * absX + absY * absY + absZ * absZ); in lengthTiny()
1660 template <class T>
1661 inline T
1662 Vec3<T>::length () const in length()
1664 T length2 = dot (*this); in length()
1666 if (length2 < T (2) * limits<T>::smallest()) in length()
1669 return Math<T>::sqrt (length2); in length()
1672 template <class T>
1673 inline T
1674 Vec3<T>::length2 () const in length2()
1679 template <class T>
1680 const Vec3<T> &
1681 Vec3<T>::normalize () in normalize()
1683 T l = length(); in normalize()
1685 if (l != T (0)) in normalize()
1701 template <class T>
1702 const Vec3<T> &
1703 Vec3<T>::normalizeExc () throw (Iex::MathExc) in normalizeExc()
1705 T l = length(); in normalizeExc()
1707 if (l == T (0)) in normalizeExc()
1716 template <class T>
1718 const Vec3<T> &
1719 Vec3<T>::normalizeNonNull () in normalizeNonNull()
1721 T l = length(); in normalizeNonNull()
1728 template <class T>
1729 Vec3<T>
1730 Vec3<T>::normalized () const in normalized()
1732 T l = length(); in normalized()
1734 if (l == T (0)) in normalized()
1735 return Vec3 (T (0)); in normalized()
1740 template <class T>
1741 Vec3<T>
1742 Vec3<T>::normalizedExc () const throw (Iex::MathExc) in normalizedExc()
1744 T l = length(); in normalizedExc()
1746 if (l == T (0)) in normalizedExc()
1752 template <class T>
1754 Vec3<T>
1755 Vec3<T>::normalizedNonNull () const in normalizedNonNull()
1757 T l = length(); in normalizedNonNull()
1766 template <class T>
1767 inline T &
1768 Vec4<T>::operator [] (int i)
1773 template <class T>
1774 inline const T &
1775 Vec4<T>::operator [] (int i) const
1780 template <class T>
1782 Vec4<T>::Vec4 () in Vec4()
1787 template <class T>
1789 Vec4<T>::Vec4 (T a) in Vec4()
1794 template <class T>
1796 Vec4<T>::Vec4 (T a, T b, T c, T d) in Vec4()
1804 template <class T>
1806 Vec4<T>::Vec4 (const Vec4 &v) in Vec4()
1814 template <class T>
1817 Vec4<T>::Vec4 (const Vec4<S> &v) in Vec4()
1819 x = T (v.x); in Vec4()
1820 y = T (v.y); in Vec4()
1821 z = T (v.z); in Vec4()
1822 w = T (v.w); in Vec4()
1825 template <class T>
1826 inline const Vec4<T> &
1827 Vec4<T>::operator = (const Vec4 &v)
1836 template <class T>
1839 Vec4<T>::Vec4 (const Vec3<S> &v) in Vec4()
1841 x = T (v.x); in Vec4()
1842 y = T (v.y); in Vec4()
1843 z = T (v.z); in Vec4()
1844 w = T (1); in Vec4()
1847 template <class T>
1850 Vec4<T>::operator == (const Vec4<S> &v) const
1855 template <class T>
1858 Vec4<T>::operator != (const Vec4<S> &v) const
1863 template <class T>
1865 Vec4<T>::equalWithAbsError (const Vec4<T> &v, T e) const in equalWithAbsError()
1874 template <class T>
1876 Vec4<T>::equalWithRelError (const Vec4<T> &v, T e) const in equalWithRelError()
1885 template <class T>
1886 inline T
1887 Vec4<T>::dot (const Vec4 &v) const in dot()
1892 template <class T>
1893 inline T
1894 Vec4<T>::operator ^ (const Vec4 &v) const
1900 template <class T>
1901 inline const Vec4<T> &
1902 Vec4<T>::operator += (const Vec4 &v)
1911 template <class T>
1912 inline Vec4<T>
1913 Vec4<T>::operator + (const Vec4 &v) const
1918 template <class T>
1919 inline const Vec4<T> &
1920 Vec4<T>::operator -= (const Vec4 &v)
1929 template <class T>
1930 inline Vec4<T>
1931 Vec4<T>::operator - (const Vec4 &v) const
1936 template <class T>
1937 inline Vec4<T>
1938 Vec4<T>::operator - () const
1943 template <class T>
1944 inline const Vec4<T> &
1945 Vec4<T>::negate () in negate()
1954 template <class T>
1955 inline const Vec4<T> &
1956 Vec4<T>::operator *= (const Vec4 &v)
1965 template <class T>
1966 inline const Vec4<T> &
1967 Vec4<T>::operator *= (T a)
1976 template <class T>
1977 inline Vec4<T>
1978 Vec4<T>::operator * (const Vec4 &v) const
1983 template <class T>
1984 inline Vec4<T>
1985 Vec4<T>::operator * (T a) const
1990 template <class T>
1991 inline const Vec4<T> &
1992 Vec4<T>::operator /= (const Vec4 &v)
2001 template <class T>
2002 inline const Vec4<T> &
2003 Vec4<T>::operator /= (T a)
2012 template <class T>
2013 inline Vec4<T>
2014 Vec4<T>::operator / (const Vec4 &v) const
2019 template <class T>
2020 inline Vec4<T>
2021 Vec4<T>::operator / (T a) const
2026 template <class T>
2027 T
2028 Vec4<T>::lengthTiny () const in lengthTiny()
2030 T absX = (x >= T (0))? x: -x; in lengthTiny()
2031 T absY = (y >= T (0))? y: -y; in lengthTiny()
2032 T absZ = (z >= T (0))? z: -z; in lengthTiny()
2033 T absW = (w >= T (0))? w: -w; in lengthTiny()
2035 T max = absX; in lengthTiny()
2046 if (max == T (0)) in lengthTiny()
2047 return T (0); in lengthTiny()
2061 Math<T>::sqrt (absX * absX + absY * absY + absZ * absZ + absW * absW); in lengthTiny()
2064 template <class T>
2065 inline T
2066 Vec4<T>::length () const in length()
2068 T length2 = dot (*this); in length()
2070 if (length2 < T (2) * limits<T>::smallest()) in length()
2073 return Math<T>::sqrt (length2); in length()
2076 template <class T>
2077 inline T
2078 Vec4<T>::length2 () const in length2()
2083 template <class T>
2084 const Vec4<T> &
2085 Vec4<T>::normalize () in normalize()
2087 T l = length(); in normalize()
2089 if (l != T (0)) in normalize()
2106 template <class T>
2107 const Vec4<T> &
2108 Vec4<T>::normalizeExc () throw (Iex::MathExc) in normalizeExc()
2110 T l = length(); in normalizeExc()
2112 if (l == T (0)) in normalizeExc()
2122 template <class T>
2124 const Vec4<T> &
2125 Vec4<T>::normalizeNonNull () in normalizeNonNull()
2127 T l = length(); in normalizeNonNull()
2135 template <class T>
2136 Vec4<T>
2137 Vec4<T>::normalized () const in normalized()
2139 T l = length(); in normalized()
2141 if (l == T (0)) in normalized()
2142 return Vec4 (T (0)); in normalized()
2147 template <class T>
2148 Vec4<T>
2149 Vec4<T>::normalizedExc () const throw (Iex::MathExc) in normalizedExc()
2151 T l = length(); in normalizedExc()
2153 if (l == T (0)) in normalizedExc()
2159 template <class T>
2161 Vec4<T>
2162 Vec4<T>::normalizedNonNull () const in normalizedNonNull()
2164 T l = length(); in normalizedNonNull()
2172 template <class T>
2174 operator << (std::ostream &s, const Vec2<T> &v)
2179 template <class T>
2181 operator << (std::ostream &s, const Vec3<T> &v)
2186 template <class T>
2188 operator << (std::ostream &s, const Vec4<T> &v)
2198 template <class T>
2199 inline Vec2<T>
2200 operator * (T a, const Vec2<T> &v)
2202 return Vec2<T> (a * v.x, a * v.y);
2205 template <class T>
2206 inline Vec3<T>
2207 operator * (T a, const Vec3<T> &v)
2209 return Vec3<T> (a * v.x, a * v.y, a * v.z);
2212 template <class T>
2213 inline Vec4<T>
2214 operator * (T a, const Vec4<T> &v)
2216 return Vec4<T> (a * v.x, a * v.y, a * v.z, a * v.w);