coneneko.math
class
MathError
: object.Error;
struct
Vector
;
float x, y, z, w、Matrixにかける場合はw値に注意
float
x
;
float
y
;
float
z
;
float
w
;
alias
r
;
alias
g
;
alias
b
;
alias
a
;
static Vector
create
();
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
);
/=
Vector
opMul
(Matrix
m
);
void
opMulAssign
(Matrix
m
);
wの値に注意、設定、除算、初期化
char[]
toString
();
void
print
();
alias
vector
;
Vector
mulW
(Vector
a
, Matrix
b
);
a
.w=1として計算、除算、result.w=0で返す
float
scalar
(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[4u][4u]
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
(Vector
position
, Vector
at
, Vector
up
= create(0F,1F,0F));
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
);
directxのを持ってきたのでz[0, 1]のまま、注意、TODO 混乱するので削除?
static Matrix
perspectiveFovRH
(float
fieldOfViewY
= cast(float)(0x1.921fb54442d1846ap+1L / 8L), float
aspectRatio
= cast(float)(640 / 480), float
nearPlaneZ
= 1F, float
farPlaneZ
= 1000F);
opengl仕様 z[-1.0, 1.0]
alias
perspectiveFov
;
static Matrix
ortho
(float
left
= cast(float)-1, float
right
= 1F, float
bottom
= cast(float)-1, float
top
= 1F, float
zNear
= cast(float)-1, float
zFar
= 1F);
char[]
toString
();
void
print
();
static Matrix
opCall
(char[]
a
);
static Matrix
opCall
(float[]
a
);
void
opIndexAssign
(float
value
, uint
x
, uint
y
);
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
, ref 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
);
Vector
clampVector
(Vector
a
, float
min
, float
max
);
bool
nearly
(float
a
, float
b
);
ほぼ等しい
bool
nearly
(Vector
a
, Vector
b
);
ほぼ等しい
float
lerp
(float
left
, float
right
, float
interpolater
);
Vector
lerp
(Vector
left
, Vector
right
, float
interpolater
);
Vector[]
lerp
(Vector[]
left
, Vector[]
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) 内部の点であるかどうか
bool
innerArea
(Vector[]
areaTriangles
, Vector
point
);
六方向にrayを飛ばして全て衝突しているなら
class
AnyRoute
(T);
A-B-C... span(最初から最後までの所要時間)を設定して、任意のtから [A, B
A-Bの位置[0.0, 1.0 [B, C
B-Cの位置[0.0, 1.0
を取り出せる ) )
)
class
MotionKeysRoute
: coneneko.math.AnyRoute!(MotionKeys).AnyRoute;
隣り合うnodeのkeyFrameの差をrangeとして扱う
)
Page generated by
Ddoc
.