Exemplo n.º 1
0
	void v3math_object::test<33>()
	{
		F32 x = -202.23412f, y = 123.2312f, z = -89.f;
		LLVector3 vec(x,y,z);
		vec.snap(2);
		ensure("1:snap: Fail ", is_approx_equal(-202.23f, vec.mV[VX]) && is_approx_equal(123.23f, vec.mV[VY]) && is_approx_equal(-89.f, vec.mV[VZ]));
	}
Exemplo n.º 2
0
	void v4math_object::test<3>()
	{
		F32 x = 10.f, y = -2.3f, z = -.023f;
		LLVector4 vec4(x,y,z);
		ensure("magVec:Fail ", is_approx_equal(vec4.magVec(), fsqrtf(x*x + y*y + z*z)));
		ensure("magVecSquared:Fail ", is_approx_equal(vec4.magVecSquared(), (x*x + y*y + z*z)));
	}
Exemplo n.º 3
0
	void v3math_object::test<8>()
	{
		F32 x = 2.32f, y = 1.212f, z = -.12f;
		LLVector3 vec3(x,y,z);		
		ensure("1:magVecSquared:Fail ", is_approx_equal(vec3.magVecSquared(), (x*x + y*y + z*z)));
		ensure("2:magVec:Fail ", is_approx_equal(vec3.magVec(), fsqrtf(x*x + y*y + z*z)));
	}
Exemplo n.º 4
0
	void v3color_object::test<4>()
	{
		F32 r = 2.3436212f, g = 1231.f, b = 4.7849321232f;
		LLColor3 llcolor3(r,g,b);
		ensure("magVecSquared:Fail ", is_approx_equal(llcolor3.magVecSquared(), (r*r + g*g + b*b)));
		ensure("magVec:Fail ", is_approx_equal(llcolor3.magVec(), fsqrtf(r*r + g*g + b*b)));
	}
Exemplo n.º 5
0
	void v2math_object::test<13>()
	{
		F32 x1 = 1.f, y1 = 2.f,x2 = 2.332f, y2 = -1.23f;
		F32 val1, val2;
		LLVector2 vec2(x1, y1), vec3(x2, y2);
		vec2 +=vec3;
		val1 = x1+x2;
		val2 = y1+y2;
		ensure("1:operator+= failed",(val1 == vec2.mV[VX]) && (val2 == vec2.mV[VY]));
		
		vec2.setVec(x1, y1);
		vec2 -=vec3;
		val1 = x1-x2;
		val2 = y1-y2;
		ensure("2:operator-= failed",(val1 == vec2.mV[VX]) && (val2 == vec2.mV[VY]));
		
		vec2.clearVec();
		vec3.clearVec();
		x1 = -21.000466f, y1 = 2.98382f,x2 = 0.332f, y2 = -01.23f;
		vec2.setVec(x1, y1);
		vec3.setVec(x2, y2);
		vec2 +=vec3;
		val1 = x1+x2;
		val2 = y1+y2;
		ensure("3:operator+= failed",(val1 == vec2.mV[VX]) && (val2 == vec2.mV[VY]));

		vec2.setVec(x1, y1);
		vec2 -=vec3;
		val1 = x1-x2;
		val2 = y1-y2;
		ensure("4:operator-= failed", is_approx_equal(val1, vec2.mV[VX]) && is_approx_equal(val2, vec2.mV[VY]));
	}
Exemplo n.º 6
0
	void v4color_object::test<6>()
	{
		F32 r = 0x20, g = 0xFFFF, b = 0xFF;
		LLColor4 llcolor4(r,g,b);
		ensure("magVecSquared:Fail ", is_approx_equal(llcolor4.magVecSquared(), (r*r + g*g + b*b)));
		ensure("magVec:Fail ", is_approx_equal(llcolor4.magVec(), fsqrtf(r*r + g*g + b*b)));
	}
Exemplo n.º 7
0
	void v2math_object::test<3>()
	{
		F32 x = 2.2345f, y = 3.5678f ;
		LLVector2 vec2(x,y);
		ensure("magVecSquared:Fail ", is_approx_equal(vec2.magVecSquared(), (x*x + y*y)));
		ensure("magVec:Fail ", is_approx_equal(vec2.magVec(), fsqrtf(x*x + y*y)));
	}
Exemplo n.º 8
0
	void v4coloru_object::test<7>()
	{
		U8 r = 0x12, g = 0xFF, b = 0xAF;
		LLColor4U llcolor4u(r,g,b);
		ensure("magVecSquared:Fail ", is_approx_equal(llcolor4u.magVecSquared(), (F32)(r*r + g*g + b*b)));
		ensure("magVec:Fail ", is_approx_equal(llcolor4u.magVec(), fsqrtf(r*r + g*g + b*b)));
	}
Exemplo n.º 9
0
	void v4math_object::test<6>()
	{
		F32 x = 10.f, y = -2.3f, z = -.023f, w = -2.0f;
		LLVector4 vec4(x,y,z,w),vec4a;
		vec4a = vec4.scaleVec(vec4);
		ensure("scaleVec:Fail " ,(is_approx_equal(x*x, vec4a.mV[VX]) && is_approx_equal(y*y, vec4a.mV[VY]) && is_approx_equal(z*z, vec4a.mV[VZ])&& is_approx_equal(w*w, vec4a.mV[VW])));
	}
Exemplo n.º 10
0
	void v4color_object::test<18>()
	{
		F32 r1 = 0x20, g1 = 0xFFFF, b1 = 0xFF, val = 0x20;
		F32 r2 = 0xABF, g2 = 0xFB, b2 = 0xFFF;
		LLColor4 llcolor4a(r1,g1,b1),llcolor4b(r2,g2,b2),llcolor4c;
		llcolor4c = lerp(llcolor4a,llcolor4b,val);
		ensure("lerp:Fail ",  (is_approx_equal(r1 + (r2 - r1)* val,llcolor4c.mV[VX]) && is_approx_equal(g1 + (g2 - g1)* val,llcolor4c.mV[VY]) && is_approx_equal(b1 + (b2 - b1)* val,llcolor4c.mV[VZ])));
	}
Exemplo n.º 11
0
	void v4math_object::test<13>()
	{
		F32 x1 = 1.f, y1 = 2.f, z1 = -1.1f;
		F32 x2 = 1.2f, y2 = 2.5f, z2 = 1.f;
		LLVector4 vec4(x1,y1,z1),vec4a(x2,y2,z2),vec4b;
		vec4b = vec4 % vec4a;
		ensure("1:operator% failed " ,is_approx_equal(y1*z2 - y2*z1, vec4b.mV[VX]) && is_approx_equal(z1*x2 -z2*x1, vec4b.mV[VY]) && is_approx_equal(x1*y2-x2*y1, vec4b.mV[VZ])); 
		vec4 %= vec4a;
		ensure_equals("operator%= failed " ,vec4,vec4b); 
	}
Exemplo n.º 12
0
	void v3color_object::test<16>()
	{
		F32 r1 =1.f, g1 = 2.f,b1 = 1.2f, r2 = -2.3f, g2 = 1.11f, b2 = 1234.234f;
		LLColor3 llcolor3(r1,g1,b1),llcolor3a(r2,g2,b2);
		llcolor3a *= llcolor3;
		ensure("1:operator*= failed",is_approx_equal(r1*r2 ,llcolor3a.mV[0]) && is_approx_equal(g1*g2,llcolor3a.mV[1])&& is_approx_equal(b1*b2,llcolor3a.mV[2]));
		F32 mulVal = 4.332f;
		llcolor3 *=mulVal;
		ensure("2:operator*= failed",is_approx_equal(r1*mulVal ,llcolor3.mV[0]) && is_approx_equal(g1*mulVal,llcolor3.mV[1])&& is_approx_equal(b1*mulVal,llcolor3.mV[2]));
	}
Exemplo n.º 13
0
	void v3color_object::test<19>()
	{
		F32 r1 =1.f, g1 = 2.f,b1 = 1.2f, r2 = -2.3f, g2 = 1.11f, b2 = 1234.234f;
		LLColor3 llcolor3(r1,g1,b1),llcolor3a(r2,g2,b2);
		F32 val = distVec(llcolor3,llcolor3a);
		ensure("distVec failed ", is_approx_equal(fsqrtf((r1-r2)*(r1-r2) + (g1-g2)*(g1-g2) + (b1-b2)*(b1-b2)) ,val));
		
		F32 val1 = distVec_squared(llcolor3,llcolor3a);
		ensure("distVec_squared failed ", is_approx_equal(((r1-r2)*(r1-r2) + (g1-g2)*(g1-g2) + (b1-b2)*(b1-b2)) ,val1));
	}
Exemplo n.º 14
0
	void v4color_object::test<7>()
	{
		F32 r = 0x20, g = 0xFFFF, b = 0xFF;
		LLColor4 llcolor4(r,g,b);
		F32 vecMag = llcolor4.normVec();
		F32 mag = fsqrtf(r*r + g*g + b*b);
		F32 oomag = 1.f / mag;
		F32 val1 = r * oomag, val2 = g * oomag,	val3 = b * oomag;
		ensure("1:normVec failed ", (is_approx_equal(val1, llcolor4.mV[0]) && is_approx_equal(val2, llcolor4.mV[1]) && is_approx_equal(val3, llcolor4.mV[2]) && is_approx_equal(vecMag, mag)));
	}
Exemplo n.º 15
0
	void v3color_object::test<14>()
	{
		F32 r1 =1.f, g1 = 2.f,b1 = 1.2f, r2 = -2.3f, g2 = 1.11f, b2 = 1234.234f;
		LLColor3 llcolor3(r1,g1,b1),llcolor3a(r2,g2,b2);
		llcolor3a += llcolor3;
		ensure("1:operator+= failed",is_approx_equal(r1+r2 ,llcolor3a.mV[0]) && is_approx_equal(g1+g2,llcolor3a.mV[1])&& is_approx_equal(b1+b2,llcolor3a.mV[2]));
		llcolor3.setVec(r1,g1,b1);
		llcolor3a.setVec(r2,g2,b2);
		llcolor3a += llcolor3;
		ensure("2:operator+= failed",is_approx_equal(r1+r2 ,llcolor3a.mV[0]) && is_approx_equal(g1+g2,llcolor3a.mV[1])&& is_approx_equal(b1+b2,llcolor3a.mV[2]));
	}
Exemplo n.º 16
0
	void v4color_object::test<13>()
	{
		F32 r1 = 0x20, g1 = 0xFFFF, b1 = 0xFF;
		F32 r2 = 0xABF, g2 = 0xFB, b2 = 0xFFF;
		LLColor4 llcolor4a(r1,g1,b1),llcolor4b(r2,g2,b2),llcolor4c;
		llcolor4c = llcolor4a - llcolor4b;
		ensure("operator-:Fail to subtract the values ",  (is_approx_equal(r1-r2,llcolor4c.mV[VX]) && is_approx_equal(g1-g2,llcolor4c.mV[VY]) && is_approx_equal(b1-b2,llcolor4c.mV[VZ])));

		llcolor4a -= llcolor4b;
		ensure("operator-=:Fail to subtract the values ",  (is_approx_equal(r1-r2,llcolor4a.mV[VX]) && is_approx_equal(g1-g2,llcolor4a.mV[VY]) && is_approx_equal(b1-b2,llcolor4a.mV[VZ])));
	}
Exemplo n.º 17
0
	void v4color_object::test<12>()
	{
		F32 r1 = 0x20, g1 = 0xFFFF, b1 = 0xFF;
		F32 r2 = 0xABF, g2 = 0xFB, b2 = 0xFFF;
		LLColor4 llcolor4a(r1,g1,b1),llcolor4b(r2,g2,b2),llcolor4c;
		llcolor4c = llcolor4b + llcolor4a;
		ensure("operator+:Fail to Add the values ",  (is_approx_equal(r1+r2,llcolor4c.mV[VX]) && is_approx_equal(g1+g2,llcolor4c.mV[VY]) && is_approx_equal(b1+b2,llcolor4c.mV[VZ])));

		llcolor4b += llcolor4a;
		ensure("operator+=:Fail to Add the values ",  (is_approx_equal(r1+r2,llcolor4b.mV[VX]) && is_approx_equal(g1+g2,llcolor4b.mV[VY]) && is_approx_equal(b1+b2,llcolor4b.mV[VZ])));
	}
Exemplo n.º 18
0
	void v3color_object::test<9>()
	{
		F32 r1 =1.f, g1 = 2.f,b1 = 1.2f, r2 = -2.3f, g2 = 1.11f, b2 = 1234.234f;
		LLColor3 llcolor3(r1,g1,b1),llcolor3a(r2,g2,b2),llcolor3b;
		llcolor3b = llcolor3 - llcolor3a ;
		ensure("1:operator- failed",is_approx_equal(r1-r2 ,llcolor3b.mV[0]) && is_approx_equal(g1-g2,llcolor3b.mV[1])&& is_approx_equal(b1-b2,llcolor3b.mV[2]));
		r1 = -.235f, g1 = -24.32f, b1 = 2.13f,  r2 = -2.3f, g2 = 1.f, b2 = 34.21f;
		llcolor3.setVec(r1,g1,b1);
		llcolor3a.setVec(r2,g2,b2);
		llcolor3b = llcolor3 - llcolor3a;
		ensure("2:operator- failed",is_approx_equal(r1-r2 ,llcolor3b.mV[0]) && is_approx_equal(g1-g2,llcolor3b.mV[1])&& is_approx_equal(b1-b2,llcolor3b.mV[2]));
	}
Exemplo n.º 19
0
	void v4math_object::test<4>()
	{
		F32 x = 10.f, y = -2.3f, z = -.023f;
		LLVector4 vec4(x,y,z);
		F32 mag = vec4.normVec();
		mag = 1.f/ mag;
		ensure("1:normVec: Fail " ,is_approx_equal(mag*x,vec4.mV[VX]) && is_approx_equal(mag*y, vec4.mV[VY])&& is_approx_equal(mag*z, vec4.mV[VZ]));
		x = 0.000000001f, y = 0.000000001f, z = 0.000000001f;
		vec4.clearVec();
		vec4.setVec(x,y,z);
		mag = vec4.normVec();
		ensure("2:normVec: Fail " ,is_approx_equal(mag*x,vec4.mV[VX]) && is_approx_equal(mag*y, vec4.mV[VY])&& is_approx_equal(mag*z, vec4.mV[VZ]));
	}
Exemplo n.º 20
0
	void llquat_test_object_t::test<9>()
	{
		//test case for LLQuaternion operator*(const LLQuaternion &a, const LLQuaternion &b) fn
		LLQuaternion quat1(1.0f, 2.5f, 3.5f, 5.5f);
		LLQuaternion quat2(4.0f, 3.0f, 5.0f, 1.0f);
		LLQuaternion result = quat1 *  quat2;
		ensure("1. LLQuaternion Operator* failed", (21.0f == result.mQ[0]) &&
											(10.0f == result.mQ[1]) &&
											(38.0f == result.mQ[2]) && 
											(-23.5f == result.mQ[3]));

		LLQuaternion quat3(2341.340f, 2352.345f, 233.25f, 7645.5f);
		LLQuaternion quat4(674.067f, 893.0897f, 578.0f, 231.0f);
		result = quat3 * quat4;
		ensure("2. LLQuaternion Operator* failed", (4543086.5f == result.mQ[0]) &&
											(8567578.0f == result.mQ[1]) &&
											(3967591.25f == result.mQ[2]) &&
											is_approx_equal(-2047783.25f, result.mQ[3]));

		//inline LLQuaternion operator+(const LLQuaternion &a, const LLQuaternion &b)fn.		
		result = quat1 + quat2;
		ensure("3. LLQuaternion operator+ failed", (5.0f == result.mQ[0]) &&
											(5.5f == result.mQ[1]) &&
											(8.5f == result.mQ[2]) &&
											(6.5f == result.mQ[3]));

		result = quat3 + quat4;
		ensure(
			"4. LLQuaternion operator+ failed",
			is_approx_equal(3015.407227f, result.mQ[0]) &&
			is_approx_equal(3245.434570f, result.mQ[1]) &&
			(811.25f == result.mQ[2]) &&
			(7876.5f == result.mQ[3]));

		//inline LLQuaternion operator-(const LLQuaternion &a, const LLQuaternion &b) fn
		result = quat1 - quat2;
		ensure(
			"5. LLQuaternion operator-(const LLQuaternion &a, const LLQuaternion &b) failed", 
			(-3.0f == result.mQ[0]) &&
			(-0.5f == result.mQ[1]) &&
			(-1.5f == result.mQ[2]) &&
			(4.5f == result.mQ[3]));

		result = quat3 - quat4;
		ensure(
			"6. LLQuaternion operator-(const LLQuaternion &a, const LLQuaternion &b) failed", 
			is_approx_equal(1667.273071f, result.mQ[0]) &&
			is_approx_equal(1459.255249f, result.mQ[1]) &&
			(-344.75f == result.mQ[2]) &&
			(7414.50f == result.mQ[3]));
	}
Exemplo n.º 21
0
	void v2math_object::test<4>()
	{
		F32 x =-2.0f, y = -3.0f ;
		LLVector2 vec2(x,y);
		ensure_equals("abs():Fail", vec2.abs(), TRUE);
		ensure("abs() x", is_approx_equal(vec2.mV[VX], 2.f));
		ensure("abs() y", is_approx_equal(vec2.mV[VY], 3.f));

		ensure("isNull():Fail ", FALSE == vec2.isNull());	//Returns TRUE if vector has a _very_small_ length

		x =.00000001f, y = .000001001f;
		vec2.setVec(x, y);
		ensure("isNull(): Fail ", TRUE == vec2.isNull());	
	}
Exemplo n.º 22
0
	void v4color_object::test<15>()
	{
		F32 r = 0x20, g = 0xFFFF, b = 0xFF,a = 0x30;
		F32 div = 12.345f;
		LLColor4 llcolor4a(r,g,b,a),llcolor4b;
		llcolor4b = llcolor4a % div;//chnage only alpha value nor r,g,b;
		ensure("1operator%:Fail ",  (is_approx_equal(r,llcolor4b.mV[VX]) && is_approx_equal(g,llcolor4b.mV[VY]) && is_approx_equal(b,llcolor4b.mV[VZ])&& is_approx_equal(div*a,llcolor4b.mV[VW])));
		
		llcolor4b = div % llcolor4a;
		ensure("2operator%:Fail ",  (is_approx_equal(r,llcolor4b.mV[VX]) && is_approx_equal(g,llcolor4b.mV[VY]) && is_approx_equal(b,llcolor4b.mV[VZ])&& is_approx_equal(div*a,llcolor4b.mV[VW])));

		llcolor4a %= div;
		ensure("operator%=:Fail ",  (is_approx_equal(a*div,llcolor4a.mV[VW])));
	}
Exemplo n.º 23
0
	void v3math_object::test<32>()
	{
		F32 x =12.3524f, y = -342.f,z = 4.126341f;
		LLVector3 vec3(x,y,z);
		F32 mag = vec3.normVec();
		mag = 1.f/ mag;
		F32 val1 = x* mag, val2 = y* mag, val3 = z* mag;
		ensure("1:normVec: Fail ", is_approx_equal(val1, vec3.mV[VX]) && is_approx_equal(val2, vec3.mV[VY]) && is_approx_equal(val3, vec3.mV[VZ]));
		x = 0.000000001f, y = 0.f, z = 0.f;
		vec3.clearVec();
		vec3.setVec(x,y,z);
		mag = vec3.normVec();
		val1 = x* mag, val2 = y* mag, val3 = z* mag;
		ensure("2:normVec: Fail ", (mag == 0.) && (0. == vec3.mV[VX]) && (0. == vec3.mV[VY])&& (0. == vec3.mV[VZ]));
	}
Exemplo n.º 24
0
	void llquat_test_object_t::test<22>()
	{
		//test case for void LLQuaternion::getEulerAngles(F32 *roll, F32 *pitch, F32 *yaw) const fn
		F32 roll = -12.0f;
		F32 pitch = -22.43f;
		F32 yaw = 11.0f;

		LLQuaternion llquat;
		llquat.getEulerAngles(&roll, &pitch, &yaw);
		ensure(
			"LLQuaternion::getEulerAngles(F32 *roll, F32 *pitch, F32 *yaw) failed",
			is_approx_equal(0.000f, llquat.mQ[0]) &&
			is_approx_equal(0.000f, llquat.mQ[1]) &&
			is_approx_equal(0.000f, llquat.mQ[2]) &&
			is_approx_equal(1.000f, llquat.mQ[3]));
	}
Exemplo n.º 25
0
	void m3math_test_object_t::test<9>()
	{
		LLMatrix3 llmat_obj1;
		LLQuaternion llmat_quat;		
		
		LLVector3 llmat1(2.0f, 1.0f, 6.0f);
		LLVector3 llmat2(1.0f, 1.0f, 3.0f);
		LLVector3 llmat3(1.0f, 7.0f, 5.0f);

		llmat_obj1.setRows(llmat1, llmat2, llmat3);
		llmat_quat = llmat_obj1.quaternion();
		ensure("LLMatrix3::quaternion failed ", is_approx_equal(-0.66666669f, llmat_quat.mQ[0]) &&
						is_approx_equal(-0.83333337f, llmat_quat.mQ[1]) &&
						is_approx_equal(0.0f, llmat_quat.mQ[2]) &&
						is_approx_equal(1.5f, llmat_quat.mQ[3]));
	}
Exemplo n.º 26
0
	void v4math_object::test<11>()
	{
		F32 x1 = 1.f, y1 = 2.f, z1 = -1.1f, w1 = .23f;
		F32 x2 = 1.2f, y2 = 2.5f, z2 = 1.f, w2 = 1.3f;
		LLVector4 vec4(x1,y1,z1,w1),vec4a(x2,y2,z2,w2),vec4b;
		vec4b = vec4a - vec4;
		ensure("1:operator-:Fail to initialize " ,(is_approx_equal(x2-x1,vec4b.mV[VX]) && is_approx_equal(y2-y1,vec4b.mV[VY]) && is_approx_equal(z2-z1,vec4b.mV[VZ])));
		x1 = -2.45f, y1 = 2.1f, z1 = 3.0f;
		vec4.clearVec();
		vec4a.clearVec();
		vec4.setVec(x1,y1,z1);
		vec4a -=vec4;
		ensure_equals("2:operator-=: Fail to initialize" , vec4a,-vec4);
		vec4a -=vec4;
		ensure("3:operator-=:Fail to initialize " ,(is_approx_equal(-2*x1,vec4a.mV[VX]) && is_approx_equal(-2*y1,vec4a.mV[VY]) && is_approx_equal(-2*z1,vec4a.mV[VZ])));
	}
Exemplo n.º 27
0
	void v3dmath_object::test<12>()
	{
		F64 x1 = 1., y1 = 2., z1 = -1.1;
		F64 x2 = 1.2, y2 = 2.5, z2 = 1.;
		F64 val1, val2, val3;
		LLVector3d vec3D(x1,y1,z1),vec3Da(x2,y2,z2), vec3Db;
		vec3Db = vec3D % vec3Da;
		val1 = y1*z2 - y2*z1;
		val2 = z1*x2 -z2*x1;
		val3 = x1*y2-x2*y1;
		ensure("1:operator% failed",(val1 == vec3Db.mdV[VX]) && (val2 == vec3Db.mdV[VY]) && (val3 == vec3Db.mdV[VZ])); 
		vec3D %= vec3Da;
		ensure("2:operator%= failed",
		       is_approx_equal(vec3D.mdV[VX],vec3Db.mdV[VX]) &&
		       is_approx_equal(vec3D.mdV[VY],vec3Db.mdV[VY]) &&
		       is_approx_equal(vec3D.mdV[VZ],vec3Db.mdV[VZ]) ); 
	}
Exemplo n.º 28
0
	void v3color_object::test<5>()
	{
		F32 r = 2.3436212f, g = 1231.f, b = 4.7849321232f;
		F32 val1, val2,val3;
		LLColor3 llcolor3(r,g,b);
		F32 vecMag = llcolor3.normVec();
		F32 mag = fsqrtf(r*r + g*g + b*b);
		F32 oomag = 1.f / mag;
		val1 = r * oomag;
		val2 = g * oomag;
		val3 = b * oomag;
		ensure("1:normVec failed ", (is_approx_equal(val1, llcolor3.mV[0]) && is_approx_equal(val2, llcolor3.mV[1]) && is_approx_equal(val3, llcolor3.mV[2]) && is_approx_equal(vecMag, mag)));
		r = .000000000f, g = 0.f, b = 0.0f;
		llcolor3.setVec(r,g,b);
		vecMag = llcolor3.normVec();
		ensure("2:normVec failed should be 0. ", (0. == llcolor3.mV[0] && 0. == llcolor3.mV[1] && 0. == llcolor3.mV[2] && vecMag == 0.));
	}
Exemplo n.º 29
0
	void v2math_object::test<14>()
	{
		F32 x1 =1.f, y1 = 2.f;
		F32 val1, val2, mulVal = 4.332f;
		LLVector2 vec2(x1, y1);
		vec2 /=mulVal;
		val1 = x1 / mulVal;
		val2 = y1 / mulVal;
		ensure("1:operator/= failed", is_approx_equal(val1, vec2.mV[VX]) && is_approx_equal(val2, vec2.mV[VY]));
		
		vec2.clearVec();
		x1 = .213f, y1 = -2.34f, mulVal = -.23f;
		vec2.setVec(x1, y1);
		vec2 /=mulVal;
		val1 = x1 / mulVal;
		val2 = y1 / mulVal;
		ensure("2:operator/= failed", is_approx_equal(val1, vec2.mV[VX]) && is_approx_equal(val2, vec2.mV[VY]));
	}
Exemplo n.º 30
0
	void v4color_object::test<17>()
	{
		F32 r = 0x20, g = 0xFFFF, b = 0xFF;
		LLColor4 llcolor4a(r,g,b),llcolor4b;
		LLColor3 llcolor3 = vec4to3(llcolor4a);
		ensure("vec4to3:Fail to convert vec4 to vec3 ",  (is_approx_equal(llcolor3.mV[VX],llcolor4a.mV[VX]) && is_approx_equal(llcolor3.mV[VY],llcolor4a.mV[VY]) && is_approx_equal(llcolor3.mV[VZ],llcolor4a.mV[VZ])));
		llcolor4b = vec3to4(llcolor3);
		ensure_equals("vec3to4:Fail to convert vec3 to vec4 ",  llcolor4b, llcolor4a);
	}