Aeon Engine c550894
AeonGames Open Source Game Engine
Loading...
Searching...
No Matches
Vector2.cpp
1/*
2Copyright (C) 2018,2025 Rodrigo Jose Hernandez Cordoba
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
16#include "aeongames/Vector2.hpp"
17#include "3DMath.h"
18
19namespace AeonGames
20{
22 {
23 memset ( mVector, 0, sizeof ( float ) * 2 );
24 }
25
26 Vector2::Vector2 ( const float* const aVector2 )
27 {
28 memcpy ( mVector, aVector2, sizeof ( float ) * 2 );
29 }
30
31 Vector2::Vector2 ( float aX, float aY )
32 {
33 mVector[0] = aX;
34 mVector[1] = aY;
35 }
36
38 = default;
39
40 const float* const Vector2::GetVector() const
41 {
42 return mVector;
43 }
44
45 const float& Vector2::GetX() const
46 {
47 return mVector[0];
48 }
49
50 const float& Vector2::GetY() const
51 {
52 return mVector[1];
53 }
54 bool operator== ( const Vector2 & aLhs, const Vector2 & aRhs )
55 {
56 return memcmp ( aLhs.GetVector(), aRhs.GetVector(), sizeof ( float ) * 2 ) == 0;
57 }
58}
Inline functions related to 3D Math.
2D vector class.
Definition Vector2.hpp:26
DLL const float & GetX() const
Get the X component.
Definition Vector2.cpp:45
DLL const float & GetY() const
Get the Y component.
Definition Vector2.cpp:50
float mVector[2]
X and Y components.
Definition Vector2.hpp:54
DLL const float *const GetVector() const
Get a pointer to the internal vector data.
Definition Vector2.cpp:40
DLL Vector2()
Default constructor.
Definition Vector2.cpp:21
DLL ~Vector2()
destructor.
<- This is here just for the literals
Definition AABB.hpp:31
DLL const bool operator==(const Matrix3x3 &lhs, const Matrix3x3 &rhs)
Compare two 3x3 matrices for equality.