TEST(Transformable_objects, can_be_scaled) { Transformable t; EXPECT_EQ(vec3(1,1,1), t.scaling()); t.scaleTo(vec3(2,3,4)); EXPECT_EQ(vec3(2,3,4), t.scaling()); t.scaleTo(-2,-5,-9); EXPECT_EQ(vec3(-2,-5,-9), t.scaling()); t.scaleTo(2,3,4); t.scale(4,2,3); EXPECT_EQ(vec3(8,6,12), t.scaling()); t.scale(vec3(1.0f/4.0f, 1.0f/2.0f, 1.0f/3.0f)); EXPECT_EQ(vec3(2,3,4), t.scaling()); }
TEST(Transformable_objects, have_a_position_rotation_and_scaling) { Transformable t; EXPECT_EQ(vec3(0,0,0), t.position()); EXPECT_EQ(vec3(1,1,1), t.scaling()); EXPECT_EQ(quat(0,0,0,1), t.rotation()); }
// SetTransformation void ChannelTransform::SetTransformation(const Transformable& other) { // calc affine parameters // translation double tx; double ty; other.translation(&tx, &ty); // rotation double rotation = agg::rad2deg(other.rotation()); // scale double scaleX; double scaleY; other.scaling(&scaleX, &scaleY); if (isnanf(tx) || isnanf(ty) || isnanf(scaleX) || isnanf(scaleY)) return; SetTransformation(B_ORIGIN, BPoint(tx, ty), rotation, scaleX, scaleY); }