31 data[0] = arg.
data[0];
32 data[1] = arg.
data[1];
33 data[2] = arg.
data[2];
36IMETHOD Vector::Vector(
double x,
double y,
double z)
38 data[0]=
x;data[1]=
y;data[2]=
z;
43 data[0]=xyz[0];data[1]=xyz[1];data[2]=xyz[2];
48 data[0]=xyz[0];data[1]=xyz[1];data[2]=xyz[2];
51IMETHOD void Vector::GetValue(
double* xyz)
const
53 xyz[0]=data[0];xyz[1]=data[1];xyz[2]=data[2];
59 data[0] = arg.
data[0];
60 data[1] = arg.
data[1];
61 data[2] = arg.
data[2];
68 tmp.data[0] = lhs.data[0]+
rhs.data[0];
69 tmp.data[1] = lhs.data[1]+
rhs.data[1];
70 tmp.data[2] = lhs.data[2]+
rhs.data[2];
77 tmp.data[0] = lhs.data[0]-
rhs.data[0];
78 tmp.data[1] = lhs.data[1]-
rhs.data[1];
79 tmp.data[2] = lhs.data[2]-
rhs.data[2];
83IMETHOD double Vector::x()
const {
return data[0]; }
84IMETHOD double Vector::y()
const {
return data[1]; }
85IMETHOD double Vector::z()
const {
return data[2]; }
87IMETHOD void Vector::x(
double _x ) { data[0] = _x; }
88IMETHOD void Vector::y(
double _y ) { data[1] = _y; }
89IMETHOD void Vector::z(
double _z ) { data[2] = _z; }
94 tmp.data[0] = lhs.data[0]*
rhs;
95 tmp.data[1] = lhs.data[1]*
rhs;
96 tmp.data[2] = lhs.data[2]*
rhs;
103 tmp.data[0] = lhs*
rhs.data[0];
104 tmp.data[1] = lhs*
rhs.data[1];
105 tmp.data[2] = lhs*
rhs.data[2];
112 tmp.data[0] = lhs.data[0]/
rhs;
113 tmp.data[1] = lhs.data[1]/
rhs;
114 tmp.data[2] = lhs.data[2]/
rhs;
122 tmp.data[0] = lhs.data[1]*
rhs.data[2]-lhs.data[2]*
rhs.data[1];
123 tmp.data[1] = lhs.data[2]*
rhs.data[0]-lhs.data[0]*
rhs.data[2];
124 tmp.data[2] = lhs.data[0]*
rhs.data[1]-lhs.data[1]*
rhs.data[0];
131 data[0]+=arg.
data[0];
132 data[1]+=arg.
data[1];
133 data[2]+=arg.
data[2];
140 data[0]-=arg.
data[0];
141 data[1]-=arg.
data[1];
142 data[2]-=arg.
data[2];
159double Vector::operator()(
int index)
const {
164double& Vector::operator () (
int index)
173 return (
l<
eps) ? Vector(0.0,0.0,0.0) : a/
l;
207 return Wrench(Vector::Zero(),Vector::Zero());
211void Wrench::ReverseSign()
213 torque.ReverseSign();
223 return Wrench(this->force,
224 this->torque+this->force*v_base_AB
243double& Wrench::operator()(
int i)
252double Wrench::operator()(
int i)
const
264 return Wrench(lhs.force*
rhs,lhs.torque*
rhs);
269 return Wrench(lhs*
rhs.force,lhs*
rhs.torque);
274 return Wrench(lhs.force/
rhs,lhs.torque/
rhs);
280 return Wrench(lhs.force+
rhs.force,lhs.torque+
rhs.torque);
285 return Wrench(lhs.force-
rhs.force,lhs.torque-
rhs.torque);
291 return Wrench(-arg.force,-arg.torque);
312 return Twist(Vector::Zero(),Vector::Zero());
316void Twist::ReverseSign()
329 return Twist(this->vel+this->
rot*v_base_AB,this->
rot);
346double& Twist::operator()(
int i)
355double Twist::operator()(
int i)
const
367 return Twist(lhs.vel*
rhs,lhs.rot*
rhs);
372 return Twist(lhs*
rhs.vel,lhs*
rhs.rot);
377 return Twist(lhs.vel/
rhs,lhs.rot/
rhs);
383 return Twist(lhs.vel+
rhs.vel,lhs.rot+
rhs.rot);
388 return Twist(lhs.vel-
rhs.vel,lhs.rot-
rhs.rot);
394 return Twist(-arg.vel,-arg.rot);
405 M = Rotation::Identity();
428 return M.Inverse(arg-p);
433 return Frame(
M.Inverse(),-
M.Inverse(p));
461 tmp.data[0]=-arg.data[0];
462 tmp.data[1]=-arg.data[1];
463 tmp.data[2]=-arg.data[2];
508 double Xy,
double Yy,
double Zy,
509 double Xz,
double Yz,
double Zz)
511 data[0] = Xx;data[1]=Yx;data[2]=Zx;
512 data[3] = Xy;data[4]=Yy;data[5]=Zy;
513 data[6] = Xz;data[7]=Yz;data[8]=Zz;
519 data[0] = x.data[0];data[3] = x.data[1];data[6] = x.data[2];
520 data[1] = y.data[0];data[4] = y.data[1];data[7] = y.data[2];
521 data[2] =
z.data[0];data[5] =
z.data[1];data[8] =
z.data[2];
533 data[0]*
v.data[0] + data[1]*
v.data[1] + data[2]*
v.data[2],
534 data[3]*
v.data[0] + data[4]*
v.data[1] + data[5]*
v.data[2],
535 data[6]*
v.data[0] + data[7]*
v.data[1] + data[8]*
v.data[2]
545 return Twist((*
this)*arg.vel,(*
this)*arg.rot);
553 return Wrench((*
this)*arg.force,(*
this)*arg.torque);
562 double cs =
cos(angle);
563 double sn =
sin(angle);
565 x1 = cs* (*this)(0,1) + sn* (*
this)(0,2);
566 x2 = cs* (*this)(1,1) + sn* (*
this)(1,2);
567 x3 = cs* (*this)(2,1) + sn* (*
this)(2,2);
568 (*this)(0,2) = -sn* (*
this)(0,1) + cs* (*
this)(0,2);
569 (*this)(1,2) = -sn* (*
this)(1,1) + cs* (*
this)(1,2);
570 (*this)(2,2) = -sn* (*
this)(2,1) + cs* (*
this)(2,2);
578 double cs =
cos(angle);
579 double sn =
sin(angle);
581 x1 = cs* (*this)(0,0) - sn* (*
this)(0,2);
582 x2 = cs* (*this)(1,0) - sn* (*
this)(1,2);
583 x3 = cs* (*this)(2,0) - sn* (*
this)(2,2);
584 (*this)(0,2) = sn* (*
this)(0,0) + cs* (*
this)(0,2);
585 (*this)(1,2) = sn* (*
this)(1,0) + cs* (*
this)(1,2);
586 (*this)(2,2) = sn* (*
this)(2,0) + cs* (*
this)(2,2);
594 double cs =
cos(angle);
595 double sn =
sin(angle);
597 x1 = cs* (*this)(0,0) + sn* (*
this)(0,1);
598 x2 = cs* (*this)(1,0) + sn* (*
this)(1,1);
599 x3 = cs* (*this)(2,0) + sn* (*
this)(2,1);
600 (*this)(0,1) = -sn* (*
this)(0,0) + cs* (*
this)(0,1);
601 (*this)(1,1) = -sn* (*
this)(1,0) + cs* (*
this)(1,1);
602 (*this)(2,1) = -sn* (*
this)(2,0) + cs* (*
this)(2,1);
610 double cs=
cos(angle);
611 double sn=
sin(angle);
612 return Rotation(1,0,0,0,cs,-sn,0,sn,cs);
615 double cs=
cos(angle);
616 double sn=
sin(angle);
617 return Rotation(cs,0,sn,0,1,0,-sn,0,cs);
620 double cs=
cos(angle);
621 double sn=
sin(angle);
622 return Rotation(cs,-sn,0,sn,cs,0,0,0,1);
630 double n = t_this.
rot.
Norm()/samplefrequency;
632 p +=
M*(t_this.
vel/samplefrequency);
636 t_this.
vel/samplefrequency
650 data[0]*
v.data[0] + data[3]*
v.data[1] + data[6]*
v.data[2],
651 data[1]*
v.data[0] + data[4]*
v.data[1] + data[7]*
v.data[2],
652 data[2]*
v.data[0] + data[5]*
v.data[1] + data[8]*
v.data[2]
658 data[0] = *oglmat++; data[3] = *oglmat++; data[6] = *oglmat++; oglmat++;
659 data[1] = *oglmat++; data[4] = *oglmat++; data[7] = *oglmat++; oglmat++;
660 data[2] = *oglmat++; data[5] = *oglmat++; data[8] = *oglmat;
666 *oglmat++ = (
float)data[0]; *oglmat++ = (
float)data[3]; *oglmat++ = (
float)data[6]; *oglmat++ = 0.f;
667 *oglmat++ = (
float)data[1]; *oglmat++ = (
float)data[4]; *oglmat++ = (
float)data[7]; *oglmat++ = 0.f;
668 *oglmat++ = (
float)data[2]; *oglmat++ = (
float)data[5]; *oglmat++ = (
float)data[8]; *oglmat++ = 0.f;
669 *oglmat++ = 0.f; *oglmat++ = 0.f; *oglmat++ = 0.f; *oglmat = 1.f;
675 tmp = data[1];data[1]=data[3];data[3]=tmp;
676 tmp = data[2];data[2]=data[6];data[6]=tmp;
677 tmp = data[5];data[5]=data[7];data[7]=tmp;
727 p.
data[0] = oglmat[12];
728 p.
data[1] = oglmat[13];
729 p.
data[2] = oglmat[14];
746tmp_XY = F_someframe_XY*(tmp_XY);
760 data[0] = arg.data[0];
761 data[1] = arg.data[1];
771 data[0]=
xy[0];data[1]=
xy[1];
776 data[0]=
xy[0];data[1]=
xy[1];
781 data[0] = arg.data[0];
782 data[1] = arg.data[1];
788 xy[0]=data[0];
xy[1]=data[1];
793 return Vector2(lhs.data[0]+
rhs.data[0],lhs.data[1]+
rhs.data[1]);
798 return Vector2(lhs.data[0]-
rhs.data[0],lhs.data[1]-
rhs.data[1]);
803 return Vector2(lhs.data[0]*
rhs,lhs.data[1]*
rhs);
808 return Vector2(lhs*
rhs.data[0],lhs*
rhs.data[1]);
813 return Vector2(lhs.data[0]/
rhs,lhs.data[1]/
rhs);
818 data[0]+=arg.data[0];
819 data[1]+=arg.data[1];
825 data[0]-=arg.data[0];
826 data[1]-=arg.data[1];
853 return Vector2(-arg.data[0],-arg.data[1]);
893 return Vector2(
v.data[0]*c-
v.data[1]*s,
v.data[0]*s+
v.data[1]*c);
907 return Rotation2(lhs.c*
rhs.c-lhs.s*
rhs.s,lhs.s*
rhs.c+lhs.c*
rhs.s);
919 return Vector2(
v.data[0]*c+
v.data[1]*s,-
v.data[0]*s+
v.data[1]*c);
933 c=
cos(angle);s=
sin(angle);
968 return Frame2(lhs.M*
rhs.M,lhs.M*
rhs.p+lhs.p);
1049 return rhs(0)*lhs(0)+
rhs(1)*lhs(1)+
rhs(2)*lhs(2);
1069 return (
Equal(a.data[0],
b.data[0],
eps)&&
1091 return (
Equal(a.data[0],
b.data[0],
eps)&&
1148 Vector rotvec = axis_a_b;
1149 double angle = rotvec.Normalize(1E-10);
1150 double ct =
::cos(angle);
1151 double st =
::sin(angle);
1154 ct + vt*rotvec(0)*rotvec(0),
1155 -rotvec(2)*st + vt*rotvec(0)*rotvec(1),
1156 rotvec(1)*st + vt*rotvec(0)*rotvec(2),
1157 rotvec(2)*st + vt*rotvec(1)*rotvec(0),
1158 ct + vt*rotvec(1)*rotvec(1),
1159 -rotvec(0)*st + vt*rotvec(1)*rotvec(2),
1160 -rotvec(1)*st + vt*rotvec(2)*rotvec(0),
1161 rotvec(0)*st + vt*rotvec(2)*rotvec(1),
1162 ct + vt*rotvec(2)*rotvec(2)
1202IMETHOD Vector
diff(
const Rotation& R_a_b1,
const Rotation& R_a_b2,
double dt) {
1203 Rotation R_b1_b2(R_a_b1.Inverse()*R_a_b2);
1204 return R_a_b1 * R_b1_b2.GetRot() / dt;
1208 diff(F_a_b1.p,F_a_b2.p,dt),
1209 diff(F_a_b1.M,F_a_b2.M,dt)
1213 return Twist(
diff(a.vel,
b.vel,dt),
diff(a.rot,
b.rot,dt));
1218 diff(a.force,
b.force,dt),
1219 diff(a.torque,
b.torque,dt)
1229 return a*
Rot(a.Inverse(da)*dt);
1241 return Wrench(
addDelta(a.force,da.force,dt),
addDelta(a.torque,da.torque,dt));
1347 return (a.p ==
b.p &&
1360 return (a.data[0]==
b.data[0]&&
1361 a.data[1]==
b.data[1]&&
1362 a.data[2]==
b.data[2] );
1374 return (a.rot==
b.rot &&
1387 return (a.force==
b.force &&
1388 a.torque==
b.torque );
ATTR_WARN_UNUSED_RESULT const BMLoop * l
ATTR_WARN_UNUSED_RESULT const BMVert * v
SIMD_FORCE_INLINE const btScalar & z() const
Return the z value.
double operator()(int i, int j)
friend Frame2 operator*(const Frame2 &lhs, const Frame2 &rhs)
Frame2 & operator=(const Frame2 &arg)
Rotation2 M
Orientation of the Frame.
Vector2 p
origine of the Frame
represents a frame transformation in 3D space (rotation + translation)
Rotation M
Orientation of the Frame.
void setValue(float *oglmat)
void Integrate(const Twist &t_this, double frequency)
void getValue(float *oglmat) const
Vector p
origine of the Frame
Frame Inverse() const
Gives back inverse transformation of a Frame.
double operator()(int i, int j)
double GetRot() const
Gets the angle (in radians)
double operator()(int i, int j) const
Access to elements 0..1,0..1, bounds are checked when NDEBUG is not set.
static Rotation2 Rot(double angle)
The Rot... static functions give the value of the appropriate rotation matrix bac.
Rotation2()
Default constructor does NOT initialise to Zero().
static Rotation2 Identity()
friend Rotation2 operator*(const Rotation2 &lhs, const Rotation2 &rhs)
Rotation2 Inverse() const
void SetRot(double angle)
The SetRot.. functions set the value of *this to the appropriate rotation matrix.
Rotation2 & operator=(const Rotation2 &arg)
represents rotations in 3 dimensional space.
void DoRotZ(double angle)
Rotation Inverse() const
Gives back the inverse rotation matrix of *this.
Rotation & operator=(const Rotation &arg)
static Rotation EulerZYX(double Alfa, double Beta, double Gamma)
friend Rotation operator*(const Rotation &lhs, const Rotation &rhs)
static Rotation Identity()
Gives back an identity rotaton matrix.
static Rotation RotX(double angle)
The Rot... static functions give the value of the appropriate rotation matrix back.
void setValue(float *oglmat)
static Rotation Rot(const Vector &rotaxis, double angle)
void DoRotX(double angle)
static Rotation RotY(double angle)
The Rot... static functions give the value of the appropriate rotation matrix back.
void getValue(float *oglmat) const
void SetInverse()
Sets the value of *this to its inverse.
static Rotation RotZ(double angle)
The Rot... static functions give the value of the appropriate rotation matrix back.
double & operator()(int i, int j)
Access to elements 0..2,0..2, bounds are checked when NDEBUG is not set.
void DoRotY(double angle)
represents both translational and rotational velocities.
Vector rot
The rotational velocity of that point.
Vector vel
The velocity of that point.
void Set3DZX(const Vector &v)
projects v in its ZX plane, and sets *this to these values
Vector2 & operator=(const Vector2 &arg)
void GetValue(double *xy) const
store vector components in array
void Set3DXY(const Vector &v)
projects v in its XY plane, and sets *this to these values
Vector2()
Does not initialise to Zero().
Vector2 & operator+=(const Vector2 &arg)
void Set3DYZ(const Vector &v)
projects v in its YZ plane, and sets *this to these values
Vector2 & operator-=(const Vector2 &arg)
double operator()(int index) const
Access to elements, range checked when NDEBUG is not set, from 0..1.
void Set3DPlane(const Frame &F_someframe_XY, const Vector &v_someframe)
A concrete implementation of a 3 dimensional vector class.
void Set2DPlane(const Frame &F_someframe_XY, const Vector2 &v_XY)
a 3D vector where the 2D vector v_XY is put in the XY plane of the frame F_someframe_XY.
void ReverseSign()
Reverses the sign of the Vector object itself.
void Set2DZX(const Vector2 &v)
a 3D vector where the 2D vector v is put in the ZX plane
void Set2DXY(const Vector2 &v)
a 3D vector where the 2D vector v is put in the XY plane
void Set2DYZ(const Vector2 &v)
a 3D vector where the 2D vector v is put in the YZ plane
represents both translational and rotational acceleration.
Vector force
Force that is applied at the origin of the current ref frame.
Vector torque
Torque that is applied at the origin of the current ref frame.
local_group_size(16, 16) .push_constant(Type b
additional_info("compositor_sum_squared_difference_float_shared") .push_constant(Type output_img float dot(value.rgb, luminance_coefficients)") .define("LOAD(value)"
local_group_size(16, 16) .push_constant(Type rhs
draw_view in_light_buf[] float
Vector operator/(const Vector &lhs, double rhs)
IMETHOD Vector operator-(const Vector &lhs, const Vector &rhs)
IMETHOD Vector operator+(const Vector &lhs, const Vector &rhs)
Vector operator*(const Vector &lhs, double rhs)
IMETHOD Vector Normalize(const Vector &a, double eps)
IMETHOD Rotation Rot(const Vector &axis_a_b)
ccl_device_inline bool operator!=(const float2 a, const float2 b)
IMETHOD Vector diff(const Vector &a, const Vector &b, double dt=1)
INLINE Rall1d< T, V, S > sin(const Rall1d< T, V, S > &arg)
bool operator==(const Rotation &a, const Rotation &b)
INLINE Rall1d< T, V, S > atan2(const Rall1d< T, V, S > &y, const Rall1d< T, V, S > &x)
IMETHOD void random(doubleVel &F)
INLINE Rall1d< T, V, S > operator-(const Rall1d< T, V, S > &lhs, const Rall1d< T, V, S > &rhs)
INLINE Rall1d< T, V, S > operator+(const Rall1d< T, V, S > &lhs, const Rall1d< T, V, S > &rhs)
void SetToZero(Jacobian &jac)
IMETHOD Vector addDelta(const Vector &a, const Vector &da, double dt=1)
Rotation operator*(const Rotation &lhs, const Rotation &rhs)
INLINE Rall1d< T, V, S > cos(const Rall1d< T, V, S > &arg)
IMETHOD void posrandom(doubleVel &F)
double epsilon
default precision while comparing with Equal(..,..) functions. Initialized at 0.0000001.
INLINE Rall1d< T, V, S > operator/(const Rall1d< T, V, S > &lhs, const Rall1d< T, V, S > &rhs)
IMETHOD bool Equal(const VectorAcc &, const VectorAcc &, double=epsilon)
ccl_device_inline float beta(float x, float y)
CCL_NAMESPACE_BEGIN struct Window V