ランタイム: Mix/Vector2.h Source File

ランタイム

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

Vector2.h
Go to the documentation of this file.
1 #pragma once
2
5
6 namespace Mix
7 {
8 class Point;
9
12 class _MIX_DLL_API Vector2
13 {
14 public:
15 union
16 {
17 struct
18 {
19 Float32 x;
20 Float32 y;
21 };
22
23 struct
24 {
25 Float32 u;
26 Float32 v;
27 };
28
29 Float32 data[2];
30 };
31
32 public:
34 Vector2( void );
37 Vector2( const Vector2& v );
40 Vector2( const Point& p );
44 Vector2( Float32 vx, Float32 vy );
45
49 Boolean operator == ( const Vector2& v ) const;
53 Boolean operator != ( const Vector2& v ) const;
54
58 Vector2& operator = ( const Vector2& v );
62 Vector2& operator = ( const Point& p );
66 Vector2& operator += ( const Vector2& v );
70 Vector2& operator -= ( const Vector2& v );
74 Vector2& operator *= ( const Vector2& v );
78 Vector2& operator /= ( const Vector2& v );
79
83 Vector2 operator + ( const Vector2& v ) const;
87 Vector2 operator - ( const Vector2& v ) const;
91 Vector2 operator * ( const Vector2& v ) const;
95 Vector2 operator / ( const Vector2& v ) const;
96
100 Vector2& operator *= ( Float32 s );
104 Vector2& operator /= ( Float32 s );
105
109 Vector2 operator * ( Float32 s ) const;
113 Vector2 operator / ( Float32 s ) const;
114
117 Vector2 operator +( void ) const;
120 Vector2 operator -( void ) const;
121
126 friend const Vector2 operator * ( Float32 s, const Vector2& v )
127 {
128 Vector2 tmp( v );
129 tmp *= s;
130 return tmp;
131 }
132
137 friend const Vector2 operator / ( Float32 s, const Vector2& v )
138 {
139 Vector2 tmp( v );
140 tmp /= s;
141 return tmp;
142 }
143
147 void Set( Float32 vx, Float32 vy );
148
151 Float32 Normalize( void );
155 Vector2 ToNormalize( Float32* pLength = NULL ) const;
156
158 void Saturate( void );
161 Vector2 ToSaturate( void ) const;
162
165 Float32 GetLengthSqr( void ) const;
168 Float32 GetLength( void ) const;
172 Float32 GetLengthF( void ) const;
173
178 static Float32 Dot( const Vector2& l, const Vector2& r );
179
182 static Vector2 Rand( void );
186 static Vector2 Rand( const Vector2& v );
191 static Vector2 Rand( const Vector2& v0, const Vector2& v1 );
192
197 static Vector2 Min( const Vector2& v0, const Vector2& v1 );
202 static Vector2 Max( const Vector2& v0, const Vector2& v1 );
203
209 static Vector2 Lerp( const Vector2& vs, const Vector2& ve, Float32 t );
215 static Vector2 Slerp( const Vector2& vs, const Vector2& ve, Float32 t );
216
217 public:
220 static const Vector2& Zero( void )
221 {
222 static const Vector2 zero( 0.0f, 0.0f );
223 return zero;
224 }
225
228 static const Vector2& XAxis( void )
229 {
230 static const Vector2 xAxis( 1.0f, 0.0f );
231 return xAxis;
232 }
233
236 static const Vector2& YAxis( void )
237 {
238 static const Vector2 yAxis( 0.0f, 1.0f );
239 return yAxis;
240 }
241 };
242 };
Mix::Vector2::y
Float32 y
Y座標
Definition: Vector2.h:20
Mix::Point
ポイントクラス
Definition: Point.h:12
Mix::Vector2::x
Float32 x
X座標
Definition: Vector2.h:19
Mix::Vector2::Zero
static const Vector2 & Zero(void)
初期値( 0.0f, 0.0f )を取得します
Definition: Vector2.h:220
Mix::Vector2::v
Float32 v
V座標
Definition: Vector2.h:26
Mix::Vector2::XAxis
static const Vector2 & XAxis(void)
X軸( 1.0f, 0.0f )を取得します
Definition: Vector2.h:228
Mix
ミックス
Definition: AtomicValue.h:6
Mix::Vector2
2次元浮動小数点ベクトルクラス
Definition: Vector2.h:12
Float32
float Float32
32ビット浮動小数点
Definition: Common.h:83
Mix::Vector2::u
Float32 u
U座標
Definition: Vector2.h:25
Mix::Vector2::YAxis
static const Vector2 & YAxis(void)
Y軸( 0.0f, 1.0f )を取得します
Definition: Vector2.h:236
Boolean
BOOL Boolean
32ビットブーリアン
Definition: Common.h:102
_MIX_DLL_API
#define _MIX_DLL_API
DLLインポート定義
Definition: Common.h:38
Mix::Rand
_MIX_DLL_API UInt32 Rand(void)
整数の乱数を取得します