From 4b07328790ffd565f9f3303b625dbde68abaecc7 Mon Sep 17 00:00:00 2001 From: Pascal Serrarens Date: Thu, 25 Apr 2024 15:22:05 +0200 Subject: [PATCH] Add conversion from Vector3 --- Vector2.cpp | 6 ++++++ Vector2.h | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/Vector2.cpp b/Vector2.cpp index dbf6562..2d1ff19 100644 --- a/Vector2.cpp +++ b/Vector2.cpp @@ -5,6 +5,7 @@ #include "Vector2.h" #include "Angle.h" #include "FloatSingle.h" +#include "Vector3.h" #if defined(AVR) #include @@ -27,6 +28,11 @@ Vector2::Vector2(Vec2 v) { y = v.y; } +Vector2::Vector2(Vector3 v) { + x = v.x; + y = v.z; +} + Vector2::~Vector2() {} const Vector2 Vector2::zero = Vector2(0, 0); diff --git a/Vector2.h b/Vector2.h index c6877c4..4d88ed3 100644 --- a/Vector2.h +++ b/Vector2.h @@ -24,6 +24,8 @@ typedef struct Vec2 { } Vec2; } +class Vector3; + /// /// A 2-dimensional vector /// @@ -46,6 +48,8 @@ public: /// The C-style Vec Vector2(Vec2 v); + Vector2(Vector3 v); + ~Vector2(); ///