00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00027 #ifndef SHLIBPOINT_HPP
00028 #define SHLIBPOINT_HPP
00029
00030 #include "ShPoint.hpp"
00031 #include "ShVector.hpp"
00032 #include "ShLib.hpp"
00033
00034 namespace SH {
00035 SH_SHLIB_USUAL_OPERATIONS(ShPoint)
00036 SH_SHLIB_BINARY_RETTYPE_OPERATION(ShPoint, operator-, ShVector, N)
00037 SH_SHLIB_SPECIAL_RETTYPE_CONST_SCALAR_OP(ShPoint, operator-, ShVector, 1)
00038
00039 SH_SHLIB_LEFT_MATRIX_OPERATION(ShPoint, operator|, M)
00040
00041
00042
00043 template<ShBindingType B1, ShBindingType B2, typename T, bool S1>
00044 ShPoint<3, SH_TEMP, T, false> operator|(const ShMatrix<4, 4, B1, T>& m,
00045 const ShPoint<3, B2, T, S1>& v)
00046 {
00047 ShPoint<4, SH_TEMP, T, false> t;
00048 t(0,1,2) = v;
00049 t(3) = ShAttrib<1, SH_CONST, T>(1.0f);
00050 ShPoint<4, SH_TEMP, T, false> r = m | t;
00051 return r(0,1,2)/r(3);
00052 }
00053
00054 template<ShBindingType B1, ShBindingType B2, typename T, bool S1>
00055 ShPoint<2, SH_TEMP, T, false> operator|(const ShMatrix<3, 3, B1, T>& m,
00056 const ShPoint<2, B2, T, S1>& v)
00057 {
00058 ShPoint<3, SH_TEMP, T, false> t;
00059 t(0,1) = v;
00060 t(2) = ShAttrib<1, SH_CONST, T>(1.0f);
00061 ShPoint<3, SH_TEMP, T, false> r = m | t;
00062 return r(0,1)/r(2);
00063 }
00064
00065 template<ShBindingType B1, ShBindingType B2, typename T, bool S1>
00066 ShPoint<1, SH_TEMP, T, false> operator|(const ShMatrix<2, 2, B1, T>& m,
00067 const ShPoint<1, B2, T, S1>& v)
00068 {
00069 ShPoint<2, SH_TEMP, T, false> t;
00070 t(0) = v;
00071 t(1) = ShAttrib<1, SH_CONST, T>(1.0f);
00072 ShPoint<2, SH_TEMP, T, false> r = m | t;
00073 return r(0)/r(1);
00074 }
00075
00076 }
00077
00078 #endif