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 SHLIBPOSITION_HPP
00028
#define SHLIBPOSITION_HPP
00029
00030
#include "ShPosition.hpp"
00031
#include "ShVector.hpp"
00032
#include "ShPoint.hpp"
00033
#include "ShLib.hpp"
00034
00035
namespace SH {
00036
00037 SH_SHLIB_USUAL_OPERATIONS_RETTYPE(ShPosition, ShPoint);
00038 SH_SHLIB_BINARY_RETTYPE_OPERATION(ShPosition,
operator-, ShVector, N);
00039 SH_SHLIB_SPECIAL_RETTYPE_CONST_SCALAR_OP(ShPosition,
operator-, ShVector, 1);
00040
00041 SH_SHLIB_LEFT_MATRIX_RETTYPE_OPERATION(ShPosition,
operator|, ShPoint, M);
00042
00043
00044
00045
template<ShBindingType B1, ShBindingType B2,
typename T,
bool S1>
00046 ShPoint<3, SH_TEMP, T, false>
operator|(
const ShMatrix<4, 4, B1, T>& m,
00047
const ShPosition<3, B2, T, S1>& v)
00048 {
00049 ShPoint<4, SH_TEMP, T, false> t;
00050 t(0,1,2) = v;
00051 t(3) = ShAttrib<1, SH_CONST, T>(1.0f);
00052 ShPoint<4, SH_TEMP, T, false> r = m | t;
00053
return r(0,1,2)/r(3);
00054 }
00055
00056
template<ShBindingType B1, ShBindingType B2,
typename T,
bool S1>
00057 ShPoint<2, SH_TEMP, T, false>
operator|(
const ShMatrix<3, 3, B1, T>& m,
00058
const ShPosition<2, B2, T, S1>& v)
00059 {
00060 ShPoint<3, SH_TEMP, T, false> t;
00061 t(0,1) = v;
00062 t(2) = ShAttrib<1, SH_CONST, T>(1.0f);
00063 ShPoint<3, SH_TEMP, T, false> r = m | t;
00064
return r(0,1)/r(2);
00065 }
00066
00067
template<ShBindingType B1, ShBindingType B2,
typename T,
bool S1>
00068 ShPosition<1, SH_TEMP, T, false>
operator|(
const ShMatrix<2, 2, B1, T>& m,
00069
const ShPosition<1, B2, T, S1>& v)
00070 {
00071 ShPoint<2, SH_TEMP, T, false> t;
00072 t(0) = v;
00073 t(1) = ShAttrib<1, SH_CONST, T>(1.0f);
00074 ShPoint<2, SH_TEMP, T, false> r = m | t;
00075
return r(0)/r(1);
00076 }
00077
00078 }
00079
00080
00081
#endif