Closed ankhers closed 4 years ago
I have a really simple program,
use euclid::Vector2D; use euclid::UnknownUnit; fn main() { let v: Vector2D<f32, UnknownUnit> = Vector2D::zero(); let v2 = v.normalize(); println!("V2: {}", v2); }
The output I am receiving is
V2: (NaN,Nan)
I am seeing the same behaviour for Vector3D as well.
Vector3D
Is this a bug in the crate, or am I expected to check for a zero vector before normalizing?
You are expected to check for zero, because there isn't a correct answer to normalizing a nil-vector.
That is fair. Thank you!
I have a really simple program,
The output I am receiving is
I am seeing the same behaviour for
Vector3D
as well.Is this a bug in the crate, or am I expected to check for a zero vector before normalizing?