make sure to do VectorNormalize in double
This commit is contained in:
parent
858ec974f7
commit
52ef1c838a
|
|
@ -130,14 +130,15 @@ inline Color4b color_to_byte( const Color4f& color ){
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T VectorNormalize( BasicVector3<T>& vector ) {
|
T VectorNormalize( BasicVector3<T>& vector ) {
|
||||||
const double length = vector3_length( DoubleVector3( vector ) );
|
DoubleVector3 v( vector ); // intermediate vector to be sure to do in double
|
||||||
|
const double length = vector3_length( v );
|
||||||
|
|
||||||
if ( length == 0 ) {
|
if ( length == 0 ) {
|
||||||
vector.set( 0 );
|
vector.set( 0 );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
vector /= length;
|
vector = v / length;
|
||||||
|
|
||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user