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

ランタイム

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

- File List
- File Members

Vector3.h
Go to the documentation of this file.
1 #pragma once
2
5
6 namespace Mix{
7
8 class Vector4;
9
12 class _MIX_DLL_API Vector3
13 {
14 public:
15 union
16 {
17 struct
18 {
19 Float32 x;
20 Float32 y;
21 Float32 z;
22 };
23
24 struct
25 {
26 Float32 r;
27 Float32 g;
28 Float32 b;
29 };
30
31 Float32 data[3];
32 };
33
34 public:
36 Vector3( void );
39 Vector3( const Vector3& v );
42 Vector3( const Vector4& v );
47 Vector3( Float32 vx, Float32 vy, Float32 vz );
48
52 Boolean operator == ( const Vector3& v ) const;
56 Boolean operator != ( const Vector3& v ) const;
57
61 Vector3& operator = ( const Vector3& v );
65 Vector3& operator = ( const Vector4& v );
69 Vector3& operator += ( const Vector3& v );
73 Vector3& operator -= ( const Vector3& v );
77 Vector3& operator *= ( const Vector3& v );
81 Vector3& operator *= ( Float32 s );
85 Vector3& operator /= ( const Vector3& v );
89 Vector3& operator /= ( Float32 s );
90
94 Vector3 operator + ( const Vector3& v ) const;
98 Vector3 operator - ( const Vector3& v ) const;
102 Vector3 operator * ( const Vector3& v ) const;
106 Vector3 operator * ( Float32 s ) const;
110 Vector3 operator / ( const Vector3& v ) const;
114 Vector3 operator / ( Float32 s ) const;
115
118 Vector3 operator +( void ) const;
121 Vector3 operator -( void ) const;
122
127 friend const Vector3 operator * ( Float32 s, const Vector3& v )
128 {
129 Vector3 tmp( v );
130 tmp *= s;
131 return tmp;
132 }
133
138 friend const Vector3 operator / ( Float32 s, const Vector3& v )
139 {
140 Vector3 tmp( v );
141 tmp /= s;
142 return tmp;
143 }
144
149 void Set( Float32 vx, Float32 vy, Float32 vz );
150
153 Float32 Normalize( void );
157 Vector3 ToNormalize( Float32* pLength = NULL ) const;
158
160 void Saturate( void );
163 Vector3 ToSaturate( void ) const;
164
167 Float32 GetLengthSqr( void ) const;
170 Float32 GetLength( void ) const;
174 Float32 GetLengthF( void ) const;
175
180 static Float32 Dot( const Vector3& l, const Vector3& r );
185 static Vector3 Cross( const Vector3& l, const Vector3& r );
186
189 static Vector3 Rand( void );
193 static Vector3 Rand( const Vector3& v );
198 static Vector3 Rand( const Vector3& v0, const Vector3& v1 );
199
204 static Vector3 Min( const Vector3& v0, const Vector3& v1 );
209 static Vector3 Max( const Vector3& v0, const Vector3& v1 );
210
216 static Vector3 Lerp( const Vector3& vs, const Vector3& ve, Float32 t );
222 static Vector3 Slerp( const Vector3& vs, const Vector3& ve, Float32 t );
223
224 public:
227 static const Vector3& Zero( void )
228 {
229 static const Vector3 zero( 0.0f, 0.0f, 0.0f );
230 return zero;
231 }
232
235 static const Vector3& XAxis( void )
236 {
237 static const Vector3 xAxis( 1.0f, 0.0f, 0.0f );
238 return xAxis;
239 }
240
243 static const Vector3& YAxis( void )
244 {
245 static const Vector3 yAxis( 0.0f, 1.0f, 0.0f );
246 return yAxis;
247 }
248
251 static const Vector3& ZAxis( void )
252 {
253 static const Vector3 zAxis( 0.0f, 0.0f, 1.0f );
254 return zAxis;
255 }
256 };
257
258 }
Mix::Vector3
3次元浮動小数点ベクトルクラス
Definition: Vector3.h:12
Mix::Vector3::r
Float32 r
R成分
Definition: Vector3.h:26
Mix::Vector3::YAxis
static const Vector3 & YAxis(void)
Y軸( 0.0f, 1.0f, 0.0f )を取得します
Definition: Vector3.h:243
Mix::Vector3::g
Float32 g
G成分
Definition: Vector3.h:27
Mix::Vector3::y
Float32 y
Y座標
Definition: Vector3.h:20
Mix::Vector3::ZAxis
static const Vector3 & ZAxis(void)
Z軸( 0.0f, 0.0f, 1.0f )を取得します
Definition: Vector3.h:251
Mix::Vector3::b
Float32 b
B成分
Definition: Vector3.h:28
Mix::Vector3::x
Float32 x
X座標
Definition: Vector3.h:19
Mix::Vector3::Zero
static const Vector3 & Zero(void)
初期値( 0.0f, 0.0f, 0.0f )を取得します
Definition: Vector3.h:227
Mix::Vector3::z
Float32 z
Z座標
Definition: Vector3.h:21
Mix
ミックス
Definition: AtomicValue.h:6
Float32
float Float32
32ビット浮動小数点
Definition: Common.h:83
Mix::Vector4
4次元浮動小数点ベクトルクラス
Definition: Vector4.h:12
Mix::Vector3::XAxis
static const Vector3 & XAxis(void)
X軸( 1.0f, 0.0f, 0.0f )を取得します
Definition: Vector3.h:235
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)
整数の乱数を取得します