Example #1
0
TEST(Transformable_objects, have_a_forward_and_backward_direction_along_the_z_axis)
{
	Transformable t;	

	EXPECT_EQ( Transformable::Z_AXIS, t.forward());
	EXPECT_EQ(-Transformable::Z_AXIS, t.backward());
}
Example #2
0
TEST(Transformable_objects, have_directions_that_adapt_to_rotation_around_z_axis)
{
	Transformable t;

	EXPECT_EQ(Transformable::X_AXIS, t.left());
	EXPECT_EQ(Transformable::Y_AXIS, t.up());
	EXPECT_EQ(Transformable::Z_AXIS, t.forward());

	t.rotate(Transformable::Z_AXIS, toRadian(90));

	EXPECT_EQ( Transformable::Y_AXIS, t.left());
	EXPECT_EQ(-Transformable::X_AXIS, t.up());
	EXPECT_EQ( Transformable::Z_AXIS, t.forward());

	t.rotate(Transformable::Z_AXIS, toRadian(90));

	EXPECT_EQ(-Transformable::X_AXIS, t.left());
	EXPECT_EQ(-Transformable::Y_AXIS, t.up());
	EXPECT_EQ( Transformable::Z_AXIS, t.forward());
}
Example #3
0
TEST(Transformable_objects, can_be_aligned_with_direction_using_alignWith)
{
	Transformable t;

	t.moveTo(5,5,5);

	vec3 direction(1,0,-1);

	t.alignWith(direction);

	EXPECT_EQ(normalize(direction), t.forward());
	EXPECT_EQ(vec3(5,5,5), t.position());
}