Fix errant typecast in VECTOR2<T>::Resize
This fails QA on Windows but not Linux
This commit is contained in:
parent
b53bc1ae38
commit
c31b5eb7d8
|
@ -356,8 +356,8 @@ VECTOR2<T> VECTOR2<T>::Resize( T aNewLength ) const
|
|||
extended_type y_sq = (extended_type) y * y;
|
||||
extended_type l_sq = x_sq + y_sq;
|
||||
extended_type newLength_sq = (extended_type) aNewLength * aNewLength;
|
||||
extended_type newX = std::sqrt( rescale( newLength_sq, x_sq, l_sq ) );
|
||||
extended_type newY = std::sqrt( rescale( newLength_sq, y_sq, l_sq ) );
|
||||
double newX = std::sqrt( rescale( newLength_sq, x_sq, l_sq ) );
|
||||
double newY = std::sqrt( rescale( newLength_sq, y_sq, l_sq ) );
|
||||
|
||||
if( std::is_integral<T>::value )
|
||||
{
|
||||
|
|
|
@ -53,16 +53,18 @@ BOOST_AUTO_TEST_CASE( test_dot_product, *boost::unit_test::tolerance( 0.000001 )
|
|||
|
||||
BOOST_AUTO_TEST_CASE( test_resize, *boost::unit_test::tolerance( 0.000001 ) )
|
||||
{
|
||||
// a few vectors just to ensure the sign change happens as needed
|
||||
// just some arbitrary vectors
|
||||
VECTOR2I v1( 4, 3 );
|
||||
VECTOR2I v2( 5, -1 );
|
||||
VECTOR2I v3( -2, 1 );
|
||||
VECTOR2I v4( 1, 1 );
|
||||
VECTOR2I v5( -70, -70 );
|
||||
|
||||
BOOST_CHECK( v1.Resize( 8 ) == VECTOR2I( 6, 4 ) );
|
||||
BOOST_CHECK( v2.Resize( 10 ) == VECTOR2I( 9, -2 ) );
|
||||
BOOST_CHECK( v3.Resize( 4 ) == VECTOR2I( -3, 1 ) );
|
||||
BOOST_CHECK( v1.Resize( 8 ) == VECTOR2I( 6, 5 ) );
|
||||
BOOST_CHECK( v2.Resize( 10 ) == VECTOR2I( 10, -2 ) );
|
||||
BOOST_CHECK( v3.Resize( 4 ) == VECTOR2I( -4, 2 ) );
|
||||
BOOST_CHECK( v4.Resize( 1 ) == VECTOR2I( 1, 1 ) );
|
||||
BOOST_CHECK( v5.Resize( 100 ) == VECTOR2I( -71, -71 ) );
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
|
Loading…
Reference in New Issue