aboutsummaryrefslogtreecommitdiff
path: root/src/vector.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/vector.rs')
-rw-r--r--src/vector.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/vector.rs b/src/vector.rs
index 9b89168..ff443f5 100644
--- a/src/vector.rs
+++ b/src/vector.rs
@@ -30,6 +30,25 @@ impl<T: Number> Sub for Vector2<T> {
}
}
+impl From<Vector2i> for Vector2f {
+ fn from(v: Vector2i) -> Self {
+ Self {
+ x: v.x as Float,
+ y: v.y as Float,
+ }
+ }
+}
+
+impl From<Vector2f> for Vector2i {
+ fn from(v: Vector2f) -> Self {
+ Self {
+ x: v.x as i32,
+ y: v.y as i32,
+ }
+ }
+}
+
+
#[cfg(test)]
mod tests {
use super::*;