void v3math_object::test<11>() { F32 x =20.0f, y = 30.0f, z = 15.f ; F32 angle = 100.f; LLVector3 vec3(x,y,z),vec3a(1.f,2.f,3.f); vec3a = vec3a.rotVec(angle, vec3); LLVector3 vec3b(1.f,2.f,3.f); vec3b = vec3b.rotVec(angle, vec3); ensure_equals("rotVec():Fail" ,vec3b,vec3a); }
void v3math_object::test<2>() { F32 x = 2.32f, y = 1.212f, z = -.12f; LLVector3 vec3(x,y,z); LLVector3d vector3d(vec3); LLVector3 vec3a(vector3d); ensure("1:LLVector3:Fail to initialize ", vec3 == vec3a); LLVector4 vector4(vec3); LLVector3 vec3b(vector4); ensure("2:LLVector3:Fail to initialize ", vec3 == vec3b); }
void v3math_object::test<1>() { LLVector3 vec3; ensure("1:LLVector3:Fail to initialize ", ((0.f == vec3.mV[VX]) && (0.f == vec3.mV[VY]) && (0.f == vec3.mV[VZ]))); F32 x = 2.32f, y = 1.212f, z = -.12f; LLVector3 vec3a(x,y,z); ensure("2:LLVector3:Fail to initialize ", ((2.32f == vec3a.mV[VX]) && (1.212f == vec3a.mV[VY]) && (-.12f == vec3a.mV[VZ]))); const F32 vec[3] = {1.2f ,3.2f, -4.2f}; LLVector3 vec3b(vec); ensure("3:LLVector3:Fail to initialize ", ((1.2f == vec3b.mV[VX]) && (3.2f == vec3b.mV[VY]) && (-4.2f == vec3b.mV[VZ]))); }
static uint32_t block_get_neighboors(const block_data_t *data, int x, int y, int z, uint8_t neighboors[27]) { int xx, yy, zz, i = 0; vec3b_t npos; uint32_t ret = 0; #define ITER_NEIGHBORS(x, y, z) \ for (z = -1; z <= 1; z++) \ for (y = -1; y <= 1; y++) \ for (x = -1; x <= 1; x++) ITER_NEIGHBORS(xx, yy, zz) { npos = vec3b(x + xx, y + yy, z + zz); neighboors[i] = DATA_AT(data, npos.x, npos.y, npos.z).a; if (neighboors[i] >= 127) ret |= 1 << i; i++; }
void reduction_entropy:: update_color(shared_surfel target_surfel, shared_entropy_surfel_vector const& neighbour_ptrs) const{ vec3r accumulated_color(0.0, 0.0, 0.0); double accumulated_weight = 0.0; accumulated_color = target_surfel->color(); accumulated_weight = 1.0; for(auto const curr_neighbour_ptr : neighbour_ptrs){ accumulated_weight += 1.0; accumulated_color += curr_neighbour_ptr->contained_surfel->color(); } vec3b normalized_color = vec3b(accumulated_color[0] / accumulated_weight, accumulated_color[1] / accumulated_weight, accumulated_color[2] / accumulated_weight ); target_surfel->color() = normalized_color; }