40 explicit FXVec4d(FXdouble d):x(d),y(d),z(d),w(d){}
49 FXVec4d(
const FXdouble v[]):x(v[0]),y(v[1]),z(v[2]),w(v[3]){}
52 FXVec4d(FXdouble xx,FXdouble yy,FXdouble zz,FXdouble ww):x(xx),y(yy),z(zz),w(ww){}
58 const FXdouble&
operator[](FXint i)
const {
return (&x)[i];}
67 FXVec4d&
set(FXdouble d){x=d;y=d;z=d;w=d;
return *
this;}
70 FXVec4d&
set(FXdouble xx,FXdouble yy,FXdouble zz,FXdouble ww){x=xx;y=yy;z=zz;w=ww;
return *
this;}
76 FXVec4d&
set(
const FXdouble v[]){x=v[0];y=v[1];z=v[2];w=v[3];
return *
this;}
80 FXVec4d& operator/=(FXdouble n){
return set(x/n,y/n,z/n,w/n); }
84 FXVec4d& operator-=(
const FXVec4d& v){
return set(x-v.x,y-v.y,z-v.z,w-v.w); }
85 FXVec4d& operator%=(
const FXVec4d& v){
return set(x*v.x,y*v.y,z*v.z,w*v.w); }
86 FXVec4d& operator/=(
const FXVec4d& v){
return set(x/v.x,y/v.y,z/v.z,w/v.w); }
89 operator FXdouble*(){
return &x;}
90 operator const FXdouble*()
const {
return &x;}
91 operator FXVec3d&(){
return *
reinterpret_cast<FXVec3d*
>(
this);}
92 operator const FXVec3d&()
const {
return *
reinterpret_cast<const FXVec3d*
>(
this);}
95 FXbool
operator!()
const {
return x==0.0 && y==0.0 && z==0.0 && w==0.0; }
102 FXdouble
length2()
const {
return w*w+z*z+y*y+x*x; }
103 FXdouble length()
const {
return Math::sqrt(length2()); }
106 FXdouble distance(
const FXVec3d& p)
const;
109 FXbool crosses(
const FXVec3d& a,
const FXVec3d& b)
const;
117 static inline FXdouble operator*(
const FXVec4d& a,
const FXVec4d& b){
return a.x*b.x+a.y*b.y+a.z*b.z+a.w*b.w; }
120 static inline FXVec4d operator*(
const FXVec4d& a,FXdouble n){
return FXVec4d(a.x*n,a.y*n,a.z*n,a.w*n);}
121 static inline FXVec4d operator*(FXdouble n,
const FXVec4d& a){
return FXVec4d(n*a.x,n*a.y,n*a.z,n*a.w);}
122 static inline FXVec4d operator/(
const FXVec4d& a,FXdouble n){
return FXVec4d(a.x/n,a.y/n,a.z/n,a.w/n);}
123 static inline FXVec4d operator/(FXdouble n,
const FXVec4d& a){
return FXVec4d(n/a.x,n/a.y,n/a.z,n/a.w);}
126 static inline FXVec4d operator+(
const FXVec4d& a,
const FXVec4d& b){
return FXVec4d(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w); }
127 static inline FXVec4d operator-(
const FXVec4d& a,
const FXVec4d& b){
return FXVec4d(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w); }
130 static inline FXVec4d operator%(
const FXVec4d& a,
const FXVec4d& b){
return FXVec4d(a.x*b.x,a.y*b.y,a.z*b.z,a.w*b.w); }
131 static inline FXVec4d operator/(
const FXVec4d& a,
const FXVec4d& b){
return FXVec4d(a.x/b.x,a.y/b.y,a.z/b.z,a.w/b.w); }
134 static inline FXbool operator==(
const FXVec4d& a,FXdouble n){
return a.x==n && a.y==n && a.z==n && a.w==n;}
135 static inline FXbool operator!=(
const FXVec4d& a,FXdouble n){
return a.x!=n || a.y!=n || a.z!=n || a.w!=n;}
136 static inline FXbool operator==(FXdouble n,
const FXVec4d& a){
return n==a.x && n==a.y && n==a.z && n==a.w;}
137 static inline FXbool operator!=(FXdouble n,
const FXVec4d& a){
return n!=a.x || n!=a.y || n!=a.z || n!=a.w;}
140 static inline FXbool operator==(
const FXVec4d& a,
const FXVec4d& b){
return a.x==b.x && a.y==b.y && a.z==b.z && a.w==b.w; }
141 static inline FXbool operator!=(
const FXVec4d& a,
const FXVec4d& b){
return a.x!=b.x || a.y!=b.y || a.z!=b.z || a.w!=b.w; }
144 static inline FXbool operator<(
const FXVec4d& a,FXdouble n){
return a.x<n && a.y<n && a.z<n && a.w<n;}
145 static inline FXbool operator<=(
const FXVec4d& a,FXdouble n){
return a.x<=n && a.y<=n && a.z<=n && a.w<=n;}
146 static inline FXbool operator>(
const FXVec4d& a,FXdouble n){
return a.x>n && a.y>n && a.z>n && a.w>n;}
147 static inline FXbool operator>=(
const FXVec4d& a,FXdouble n){
return a.x>=n && a.y>=n && a.z>=n && a.w>=n;}
150 static inline FXbool operator<(FXdouble n,
const FXVec4d& a){
return n<a.x && n<a.y && n<a.z && n<a.w;}
151 static inline FXbool operator<=(FXdouble n,
const FXVec4d& a){
return n<=a.x && n<=a.y && n<=a.z && n<=a.w;}
152 static inline FXbool operator>(FXdouble n,
const FXVec4d& a){
return n>a.x && n>a.y && n>a.z && n>a.w;}
153 static inline FXbool operator>=(FXdouble n,
const FXVec4d& a){
return n>=a.x && n>=a.y && n>=a.z && n>=a.w;}
156 static inline FXbool operator<(
const FXVec4d& a,
const FXVec4d& b){
return a.x<b.x && a.y<b.y && a.z<b.z && a.w<b.w; }
157 static inline FXbool operator<=(
const FXVec4d& a,
const FXVec4d& b){
return a.x<=b.x && a.y<=b.y && a.z<=b.z && a.w<=b.w; }
158 static inline FXbool operator>(
const FXVec4d& a,
const FXVec4d& b){
return a.x>b.x && a.y>b.y && a.z>b.z && a.w>b.w; }
159 static inline FXbool operator>=(
const FXVec4d& a,
const FXVec4d& b){
return a.x>=b.x && a.y>=b.y && a.z>=b.z && a.w>=b.w; }
162 static inline FXVec4d lo(
const FXVec4d& a,
const FXVec4d& b){
return FXVec4d(Math::fmin(a.x,b.x),Math::fmin(a.y,b.y),Math::fmin(a.z,b.z),Math::fmin(a.w,b.w));}
163 static inline FXVec4d lo(
const FXVec4d& a,FXdouble n){
return FXVec4d(Math::fmin(a.x,n),Math::fmin(a.y,n),Math::fmin(a.z,n),Math::fmin(a.w,n));}
164 static inline FXVec4d lo(FXdouble n,
const FXVec4d& b){
return FXVec4d(Math::fmin(n,b.x),Math::fmin(n,b.y),Math::fmin(n,b.z),Math::fmin(n,b.w));}
167 static inline FXVec4d hi(
const FXVec4d& a,
const FXVec4d& b){
return FXVec4d(Math::fmax(a.x,b.x),Math::fmax(a.y,b.y),Math::fmax(a.z,b.z),Math::fmax(a.w,b.w));}
168 static inline FXVec4d hi(
const FXVec4d& a,FXdouble n){
return FXVec4d(Math::fmax(a.x,n),Math::fmax(a.y,n),Math::fmax(a.z,n),Math::fmax(a.w,n));}
169 static inline FXVec4d hi(FXdouble n,
const FXVec4d& b){
return FXVec4d(Math::fmax(n,b.x),Math::fmax(n,b.y),Math::fmax(n,b.z),Math::fmax(n,b.w));}
172 static inline FXVec4d clamp(FXdouble lower,
const FXVec4d& x,FXdouble upper){
return hi(lo(x,upper),lower);}
175 static inline FXVec4d clamp(
const FXVec4d& x,FXdouble limit){
return hi(lo(x,limit),-limit);}
178 static inline FXVec4d clamp(
const FXVec4d& lower,
const FXVec4d& x,
const FXVec4d& upper){
return hi(lo(x,upper),lower);}
181 static inline FXVec4d clamp(
const FXVec4d& x,
const FXVec4d& limit){
return hi(lo(x,limit),-limit);}
184 static inline FXVec4d abs(
const FXVec4d& a){
return FXVec4d(Math::fabs(a.x),Math::fabs(a.y),Math::fabs(a.z),Math::fabs(a.w));}
187 static inline FXdouble max(
const FXVec4d& a){
return Math::fmax(Math::fmax(a.x,a.y),Math::fmax(a.z,a.w)); }
190 static inline FXdouble min(
const FXVec4d& a){
return Math::fmin(Math::fmin(a.x,a.y),Math::fmin(a.z,a.w)); }
193 static inline FXVec4d lerp(
const FXVec4d& u,
const FXVec4d& v,FXdouble f){
return (v-u)*f+u;}
196 extern FXAPI FXVec4d plane(
const FXVec4d& vec);
199 extern FXAPI FXVec4d plane(
const FXVec3d& vec,FXdouble dist);
202 extern FXAPI FXVec4d plane(
const FXVec3d& vec,
const FXVec3d& p);
205 extern FXAPI FXVec4d plane(
const FXVec3d& a,
const FXVec3d& b,
const FXVec3d& c);
208 extern FXAPI FXColor colorFromVec4d(
const FXVec4d& vec);
211 extern FXAPI FXVec4d colorToVec4d(FXColor clr);
214 extern FXAPI FXVec4d normalize(
const FXVec4d& v);
217 extern FXAPI FXStream& operator<<(FXStream& store,
const FXVec4d& v);
220 extern FXAPI FXStream& operator>>(FXStream& store,FXVec4d& v);
FXdouble & operator[](FXint i)
Return a non-const reference to the ith element.
Definition: FXVec4d.h:55
FXVec4d(const FXVec3d &v, FXdouble s=0.0)
Construct with 3-vector.
Definition: FXVec4d.h:43
FXVec4d & operator=(const FXVec4d &v)
Assignment.
Definition: FXVec4d.h:61
FXVec4d(FXdouble xx, FXdouble yy, FXdouble zz, FXdouble ww)
Initialize with components.
Definition: FXVec4d.h:52
Double-precision 3-element vector.
Definition: FXVec3d.h:28
FXVec4d(const FXVec4d &v)
Initialize from another vector.
Definition: FXVec4d.h:46
FXdouble length2() const
Length and square of length.
Definition: FXVec4d.h:102
FXVec4d & operator*=(FXdouble n)
Assigning operators.
Definition: FXVec4d.h:79
FXbool operator!() const
Test if zero.
Definition: FXVec4d.h:95
FXVec4d operator+() const
Unary.
Definition: FXVec4d.h:98
~FXVec4d()
Destructor.
Definition: FXVec4d.h:112
Definition: FX4Splitter.h:28
FXVec4d & operator+=(const FXVec4d &v)
Element-wise assigning operators.
Definition: FXVec4d.h:83
Double-precision 4-element vector.
Definition: FXVec4d.h:28
FXVec4d(FXdouble d)
Initialize all components the same.
Definition: FXVec4d.h:40
FXVec4d & operator=(const FXdouble v[])
Assignment from array of doubles.
Definition: FXVec4d.h:64
FXVec4d(const FXdouble v[])
Initialize from array of doubles.
Definition: FXVec4d.h:49
const FXdouble & operator[](FXint i) const
Return a const reference to the ith element.
Definition: FXVec4d.h:58
FXVec4d()
Default constructor; value is not initialized.
Definition: FXVec4d.h:37