Commit b3baab23 authored by Luke Jones's avatar Luke Jones

Fix normalise

parent 276c28ff
Pipeline #62700420 passed with stages
in 3 minutes and 52 seconds
[package] [package]
name = "vec2d" name = "vec2d"
version = "0.1.0" version = "0.1.1"
authors = ["Luke Jones <luke@sphereidentity.com>"] authors = ["Luke Jones <luke@sphereidentity.com>"]
edition = "2018" edition = "2018"
......
...@@ -25,7 +25,7 @@ macro_rules! impl_vec_ops_for { ...@@ -25,7 +25,7 @@ macro_rules! impl_vec_ops_for {
/// Normalises the vector /// Normalises the vector
pub fn normalise(self) -> Self { pub fn normalise(self) -> Self {
let mut magnitude = self.magnitude(); let mut magnitude = self.magnitude();
if magnitude <= 0.0001 { magnitude = 1.0 } if magnitude <= 0.0001 { magnitude = 0.0 }
self / magnitude self / magnitude
} }
/// Returns the magnitude/length of the vector /// Returns the magnitude/length of the vector
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment