coneneko.math
struct
Vector
;
float x, y, z, w、Matrixにかける場合はw値に注意
float
w
;
static Vector
create
(float
x
, float
y
);
static Vector
create
(float
x
, float
y
, float
z
);
static Vector
create
(float
x
, float
y
, float
z
, float
w
);
Vector
opNeg
();
-
bool
opEquals
(Vector
f
);
==
Vector
opAdd
(Vector
f
);
+
Vector
opSub
(Vector
f
);
-
Vector
opMul
(float
f
);
*
Vector
opDiv
(float
f
);
/
void
opAddAssign
(Vector
f
);
+=
void
opSubAssign
(Vector
f
);
-=
void
opMulAssign
(float
f
);
*=
void
opDivAssign
(float
f
);
/=
char[]
toString
();
void
print
();
alias
vector
;
Vector
mul
(Vector
v
, Matrix
m
, bool
vwIs1
);
v
*
m
,
vwIs1
=
true
のとき、
v
.w=1として計算する
Vector
mul3
(Vector
v3
, Matrix
m
);
vec3とmatrixをかけるときに使う、
v3
.wを1.0として計算する
Vector
mul4
(Vector
v4
, Matrix
m
);
そのままかける
float
length
(Vector
a
);
長さ
float
distance
(Vector
a
, Vector
b
);
二点間の距離(差の長さ)
Vector
normalize
(Vector
a
);
正規化
float
dot
(Vector
a
, Vector
b
);
内積( length(
a
) * length(
b
) * cos(ab) )
float
cross2
(Vector
a
, Vector
b
);
外積( length(
a
) * length(
b
) * sin(ab) )、二次元のは例外的に
Vector
cross
(Vector
a
, Vector
b
);
vec3
Vector
cross
(Vector
a
, Vector
b
, Vector
c
);
vec4, 外積( 体積 )
Matrix
matrix
(float[]
a
...);
struct
Matrix
;
Direct3Dの方に合わせている、そのうちOpenGLに合わせる
float[4][4]
m
;
左上から[行][列]
00 01 02 03 10 11 12 13 20 21 22 23 30 31 32 33
Matrix
opMul
(Matrix
m2
);
*
void
opMulAssign
(Matrix
m2
);
*=
static Matrix
identity
();
static Matrix
zero
();
static Matrix
translation
(float
x
, float
y
, float
z
);
static Matrix
translation
(Vector
a
);
static Matrix
scaling
(float
sx
, float
sy
, float
sz
);
static Matrix
rotationX
(float
radian
);
static Matrix
rotationY
(float
radian
);
static Matrix
rotationZ
(float
radian
);
static Matrix
lookAtLH
(float
px
, float
py
, float
pz
, float
ax
, float
ay
, float
az
, float
ux
, float
uy
, float
uz
);
static Matrix
lookAtLH
(Vector
p
, Vector
a
, Vector
u
);
static Matrix
lookAtRH
(float
px
, float
py
, float
pz
, float
ax
, float
ay
, float
az
, float
ux
= 0F, float
uy
= 1F, float
uz
= 0F);
alias
lookAt
;
static Matrix
perspectiveFovLH
(float
fieldOfViewY
, float
aspectRatio
, float
nearPlaneZ
, float
farPlaneZ
);
static Matrix
perspectiveFovRH
(float
fieldOfViewY
= cast(float)(0x1.921fb54442d1846ap+1L / 8L), float
aspectRatio
= cast(float)(640 / 480), float
nearPlaneZ
= 1F, float
farPlaneZ
= 4000F);
alias
perspectiveFov
;
char[]
toString
();
void
print
();
static Matrix
opCall
(char[]
a
);
static Matrix
opCall
(float[]
a
);
void
opIndexAssign
(float
value
, uint
upToDownIndex
, uint
leftToRightIndex
);
static Matrix
modelLookAt
(Vector
position
, Vector
at
);
モデルデータ用、upは(0, 1, 0)
float[]
toFloatArray
(char[]
a
);
Matrix
inverse
(Matrix
m
);
Matrix
createMatrixFromQuaternion
(Vector
quaternion
);
Vector
createSlerpQuaternion
(Vector
quaternion0
, Vector
quaternion1
, float
t
);
bool
triangleIntersectRay
(Vector
t0
, Vector
t1
, Vector
t2
, Vector
rayPosition
, Vector
rayDirection
);
float
distanceOfTriangleAndRay
(Vector
t0
, Vector
t1
, Vector
t2
, Vector
rayPosition
, Vector
rayDirection
);
bool
triangleIntersectRay2
(Vector
t0
, Vector
t1
, Vector
t2
, Vector
rayPosition
, Vector
rayDirection
, inout float
distance
);
float
distanceOfPointAndLine
(Vector
p
, Vector
l0
, Vector
l1
);
float
distanceOfPointAndLineSegment
(Vector
p
, Vector
ls0
, Vector
ls1
);
Vector
lineSegmentToPoint
(Vector
ls0
, Vector
ls1
, Vector
p
);
float
toDegree
(float
radian
);
float
toRadian
(float
degree
);
float
clamp
(float
x
, float
min
, float
max
);
Vector
clamp
(Vector
a
, float
min
, float
max
);
float
lerp
(float
left
, float
right
, float
interpolater
);
bool
isInnerPoint
(Matrix
m
, float
x
, float
y
);
基本ビルボード (0.5, 0.5) (0.5, -0.5) (-0.5, -0.5) (-0.5, 0.5) 内部の点であるかどうか
class
MathException
: object.Exception;
this(long
line
, char[]
msg
= null);
_LINE__
Page generated by
Ddoc
.