AppEasy Core SDK  1.5.0
Cross platform mobile and desktop app and game development SDK - The easy way to make apps
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines
CzVec2.h
Go to the documentation of this file.
00001 // 
00002 //
00003 // AppEasy SDK - Cross Platform Multi-purpose Game and App Engine
00004 //
00005 // Developed by Matthew Hopwood of Pocketeers Limited - www.pocketeers.co.uk
00006 //
00007 // For updates, tutorials and more details check out www.appeasymobile.com
00008 //
00009 // This code is provided free of charge and without any warranty whatsoever. You must ensure that this whole notice is present in all files and derivatives, so the reader knows its origin.
00010 // If you use this SDK in your product then please ensure that you credit AppEasy's usage appropriately. Please see www.appeasymobile.com for licensing details and support
00011 //
00012 //
00013 
00014 #ifndef __CV_VEC2_H__
00015 #define __CV_VEC2_H__
00016 
00017 #include "CzVec3.h"
00018 #include "CzSVec2.h"
00019 
00020 class CzVec2
00021 {
00022 public:
00023     float   x, y;
00024 
00025 private:
00026 public:
00027     CzVec2();
00028     CzVec2(float x, float y);
00029 
00030     void            Set(float n);
00031     void            Add(CzVec2& v);
00032     void            Add(float v);
00033     void            Zero();
00034     void            One();
00035     void            Sub(CzVec2& v);
00036     void            Sub(float v);
00037     void            Invert();
00038     void            Mul(CzVec2& v);
00039     void            Mul(float v);
00040     float           Dot(CzVec2& v) const;
00041     void            Normalise();
00042     void            Clamp(float max_mag);
00043     void            Clamp(CzVec2& clamp);
00044     float           Mag() const;
00045     float           MagSquared() const;
00046     float           PointDistanceToLine(CzVec2& v0, CzVec2& v1) const;
00047     float           PointClosestToLine(CzVec2 const &v0, CzVec2 const &v1, CzVec2 &out) const;
00048 
00049     bool            operator==	(CzVec2 const &v) const;
00050     bool            operator!=	(CzVec2 const &v) const;
00051     CzVec2          operator+	(CzVec2 const &v) const;
00052     CzVec2&         operator+=	(CzVec2 const &v);
00053     CzVec2          operator-	(CzVec2 const &v) const;
00054     CzVec2&         operator-=	(CzVec2 const &v);
00055     CzVec2          operator*	(CzVec2 const &v) const;
00056     CzVec2&         operator*=	(CzVec2 const &v);
00057     CzVec2          operator*	(float n) const;
00058     CzVec2&         operator*=	(float n);
00059     
00060     CzSVec2         toSVec2() const;
00061     CzVec3          toVec3() const;
00062 
00063 };
00064 
00065 
00066 #endif  // __CV_VEC2_H__
00067