23 #ifndef _TLP_VECTORCAST_H 24 #define _TLP_VECTORCAST_H 27 #include <tulip/Vector.h> 29 #define TEMPLATEVECTORCAST template <typename Obj, unsigned int SIZE, typename TYPE> 31 #define VECTORCAST tlp::VectorCast<Obj, SIZE, TYPE> 47 class TLP_SCOPE VectorCast :
public Vector<Obj, SIZE> {
50 inline explicit VectorCast(
const tlp::Vector<float, 3> &v) : Vector<Obj, SIZE>(v) {}
52 inline TYPE &operator*=(
const Obj obj) {
53 return (TYPE &)this->Vector<Obj, SIZE>::operator*=(obj);
55 inline TYPE &operator*=(
const Vector<Obj, SIZE> &vec) {
56 return (TYPE &)this->Vector<Obj, SIZE>::operator*=(vec);
58 inline TYPE &operator/=(
const Obj obj) {
59 return (TYPE &)this->Vector<Obj, SIZE>::operator/=(obj);
61 inline TYPE &operator/=(
const Vector<Obj, SIZE> &vec) {
62 return (TYPE &)this->Vector<Obj, SIZE>::operator/=(vec);
64 inline TYPE &operator+=(
const Obj obj) {
65 return (TYPE &)this->Vector<Obj, SIZE>::operator+=(obj);
67 inline TYPE &operator+=(
const Vector<Obj, SIZE> &vec) {
68 return (TYPE &)this->Vector<Obj, SIZE>::operator+=(vec);
70 inline TYPE &operator-=(
const Obj obj) {
71 return (TYPE &)this->Vector<Obj, SIZE>::operator-=(obj);
73 inline TYPE &operator-=(
const Vector<Obj, SIZE> &vec) {
74 return (TYPE &)this->Vector<Obj, SIZE>::operator-=(vec);
76 inline TYPE &operator^=(
const Vector<Obj, SIZE> &vec) {
77 return (TYPE &)this->Vector<Obj, SIZE>::operator^=(vec);
79 inline TYPE &fill(
const Obj obj) {
80 return (TYPE &)this->Vector<Obj, SIZE>::fill(obj);
83 inline TYPE operator*(
const Vector<Obj, SIZE> &v)
const {
84 return VECTORCAST(*
this) *= v;
86 inline TYPE operator*(
const Obj v)
const {
87 return VECTORCAST(*
this) *= v;
89 inline TYPE operator+(
const Vector<Obj, SIZE> &v)
const {
90 return VECTORCAST(*
this) += v;
92 inline TYPE operator+(
const Obj v)
const {
93 return VECTORCAST(*
this) += v;
95 inline TYPE operator-(
const Vector<Obj, SIZE> &v)
const {
96 return VECTORCAST(*
this) -= v;
98 inline TYPE operator-(
const Obj v)
const {
99 return VECTORCAST(*
this) -= v;
101 inline TYPE operator/(
const Vector<Obj, SIZE> &v)
const {
102 return VECTORCAST(*
this) /= v;
104 inline TYPE operator/(
const Obj v)
const {
105 return VECTORCAST(*
this) /= v;
107 inline TYPE operator^(
const Vector<Obj, SIZE> &v)
const {
108 return VECTORCAST(*
this) ^= v;