math¶
インターフェイス
関数
-
math.
add2D
(v1, v2)¶ @v1 を @v2 に加算する。
引数: - v1 –
math.IVec2()
- v2 –
math.IVec2()
戻り値: - v1 –
-
math.
add3D
(v1, v2)¶ @v1 を @v2 に加算する。
引数: - v1 –
math.IVec3()
- v2 –
math.IVec3()
戻り値: - v1 –
-
math.
clamp
(v, min, max)¶ 値 @x を @min と @max の間に収める。
引数: - v – 数値
- min – 数値
- max – 数値
戻り値: 数値
-
math.
dot2D
(v1, v2)¶ 2 つの 2D ベクトルの内積 (ドット積) を返す。
引数: - v1 –
math.IVec2()
- v2 –
math.IVec2()
戻り値: 数値
- v1 –
-
math.
dot3D
(v1, v2)¶ 2 つの 3D ベクトルの内積 (ドット積) を返す。
引数: - v1 –
math.IVec3()
- v2 –
math.IVec3()
戻り値: 数値
- v1 –
-
math.
dot4D
(v1, v2)¶ 2 つの 4D ベクトルの内積 (ドット積) を返す。
引数: - v1 –
math.IVec4()
- v2 –
math.IVec4()
戻り値: 数値
- v1 –
-
math.
equal
(v0, v1, threshold)¶ v0 と v1 がしきい値に収まっている場合、True を返す。
引数: - v0 – 数値
- v1 – 数値
- threshold – 数値
戻り値: ブール値
-
math.
equal2D
(v0, v1, threshold)¶ v0 のすべてのコンポーネントが v1 のしきい値に収まっている場合、True を返す。
引数: - v0 –
math.IVec2()
- v1 –
math.IVec2()
- threshold – 数値
戻り値: ブール値
- v0 –
-
math.
equal3D
(v0, v1, threshold)¶ v0 のすべてのコンポーネントが v1 のしきい値に収まっている場合、True を返す。
引数: - v0 –
math.IVec3()
- v1 –
math.IVec3()
- threshold – 数値
戻り値: ブール値
- v0 –
-
math.
equal4D
(v0, v1, threshold)¶ v0 のすべてのコンポーネントが v1 のしきい値に収まっている場合、True を返す。
引数: - v0 –
math.IVec4()
- v1 –
math.IVec4()
- threshold – 数値
戻り値: ブール値
- v0 –
-
math.
evalLine2D
(origin, direction, t)¶ パラメトリック線を求める。: origin + direction × t。
引数: - origin –
math.IVec2()
- direction –
math.IVec2()
- t – 数値
戻り値: - origin –
-
math.
getDistanceToSegment2D
(pt, segA, segB)¶ 点 @pt から セグメント @segA-@segB の距離の 2 乗を返す。
引数: - pt –
math.IVec2()
- segA –
math.IVec2()
- segB –
math.IVec2()
戻り値: 数値
- pt –
-
math.
getParameter_ClosestPointToSegment2D
(point, segOrigin, segDirection)¶ @point に最も近いセグメント上の点に対応するパラメトリック係数 (0 ~ 1) を返す。セグメント上の実際の点を取得するには、 evalLine2D(segOrigin, segDirection, t); を呼び出します。
引数: - point –
math.IVec2()
- segOrigin –
math.IVec2()
- segDirection –
math.IVec2()
戻り値: 数値
- point –
-
math.
getProjectionFactor2D
(vector, axis)¶ 軸のベクトルの投影点のパラメトリック座標 t を返す。
引数: - vector –
math.IVec2()
- axis –
math.IVec2()
戻り値: 数値
- vector –
-
math.
getSquaredDistanceToSegment2D
(point, segA, segB)¶ 点 @pt から セグメント @segA-@segB の距離の 2 乗を返す。
引数: - point –
math.IVec2()
- segA –
math.IVec2()
- segB –
math.IVec2()
戻り値: 数値
- point –
-
math.
homogenize3D
(v)¶ vec3 を均質化する。つまり、最後の要素は 1 です。
引数: - v –
math.IVec3()
戻り値: - v –
-
math.
homogenize4D
(v)¶ vec4 を均質化する。つまり、最後の要素は 1 です。
引数: - v –
math.IVec4()
戻り値: - v –
-
math.
length2D
(v)¶ 2D ベクトルのノルムを返す。
引数: - v –
math.IVec2()
戻り値: 数値
- v –
-
math.
length3D
(v)¶ 2D ベクトルのノルムを返す。
引数: - v –
math.IVec3()
戻り値: 数値
- v –
-
math.
lengthSq2D
(v)¶ 2D ベクトルのノルムの 2 乗を返す。
引数: - v –
math.IVec2()
戻り値: 数値
- v –
-
math.
lengthSq3D
(v)¶ 3D ベクトルのノルムの 2 乗を返す。
引数: - v –
math.IVec3()
戻り値: 数値
- v –
-
math.
mad2D
(v1, v2, v3)¶ @v1 と @v2 を乗算し、@v3 と加算する。
引数: - v1 –
math.IVec2()
- v2 –
math.IVec2()
- v3 –
math.IVec2()
戻り値: - v1 –
-
math.
mad3D
(v1, v2, v3)¶ @v1 と @v2 を乗算し、@v3 と加算する。
引数: - v1 –
math.IVec3()
- v2 –
math.IVec3()
- v3 –
math.IVec3()
戻り値: - v1 –
-
math.
mat3
(row0, row1, row2)¶ 3 行からなる 3x3 の行列を返す。
引数: - row0 –
math.IVec3()
- row1 –
math.IVec3()
- row2 –
math.IVec3()
戻り値: - row0 –
-
math.
mat3FromArray
(rawNumbers)¶ 9 個の数字の配列 (列の論理) を与えて mat3 をビルドする。
引数: - rawNumbers – 数値 []
戻り値:
-
math.
mat3Identity
()¶ mat3 アイデンティティ
戻り値: math.IMat3()
-
math.
mat3ToArray
(mat)¶ 9 個の数字の配列を与えて mat3 をビルドする
引数: - mat –
math.IMat3()
戻り値: 数値 []
- mat –
-
math.
mat4
(row0, row1, row2, row3)¶ 4 行からなる 4x4 の行列を返す。
引数: - row0 –
math.IVec4()
- row1 –
math.IVec4()
- row2 –
math.IVec4()
- row3 –
math.IVec4()
戻り値: - row0 –
-
math.
mix
(v1, v2, t)¶ @t をパラメータに使用した @v1、@v2 間のリニア補間。
引数: - v1 – 数値
- v2 – 数値
- t – 数値
戻り値: 数値
-
math.
mul2D
(v1, v2)¶ 2D ベクトルの @v1 と @v2 を乗算する。
引数: - v1 –
math.IVec2()
- v2 –
math.IVec2()
戻り値: - v1 –
-
math.
mul3D
(v1, v2)¶ 2D ベクトルの @v1 と @v2 を乗算する。
引数: - v1 –
math.IVec3()
- v2 –
math.IVec3()
戻り値: - v1 –
-
math.
mulmat3
(m, v)¶ vec3 を mat3 で変換する。
引数: - m –
math.IMat3()
- v –
math.IVec3()
戻り値: - m –
-
math.
mulmat4
(m, v)¶ vec4 を mat4 で変換する。
引数: - m –
math.IMat4()
- v –
math.IVec4()
戻り値: - m –
-
math.
muls2D
(v1, s)¶ 2D ベクトル @v1 にスカラー @s を乗算する。
引数: - v1 –
math.IVec2()
- s – 数値
戻り値: - v1 –
-
math.
muls3D
(v1, s)¶ 2D ベクトル @v1 にスカラー @s を乗算する。
引数: - v1 –
math.IVec3()
- s – 数値
戻り値: - v1 –
-
math.
muls4D
(v1, s)¶ 4D ベクトル @v1 にスカラー @s を乗算する。
引数: - v1 –
math.IVec4()
- s – 数値
戻り値: - v1 –
-
math.
normalize2D
(v)¶ 長さが 1 になるように、vec2 を正規化する。
引数: - v –
math.IVec2()
戻り値: - v –
-
math.
normalize3D
(v)¶ 長さが 1 になるように、vec3 を正規化する。
引数: - v –
math.IVec3()
戻り値: - v –
-
math.
prodmat3
(m1, m2)¶ 2 つの mat3 の積を返す。
引数: - m1 –
math.IMat3()
- m2 –
math.IMat3()
戻り値: - m1 –
-
math.
projectPointUntoSegment2D
(point, segA, segB)¶ 非推奨。
引数: - point –
math.IVec2()
- segA –
math.IVec2()
- segB –
math.IVec2()
戻り値: - point –
-
math.
projectPosition
(m, v)¶ 4x4 行列 @m を使用して、3D ベクトル @v を表す。
引数: - m –
math.IMat4()
- v –
math.IVec3()
戻り値: - m –
-
math.
projectPosition2
(m, v)¶ 3x3 行列 @m を使用して、2D ベクトル @v を表す。
引数: - m –
math.IMat3()
- v –
math.IVec2()
戻り値: - m –
-
math.
projectUnto2D
(vector, axis)¶ 軸のベクトルの投影点のを返す。
引数: - vector –
math.IVec2()
- axis –
math.IVec2()
戻り値: - vector –
-
math.
sub2D
(v1, v2)¶ @v1 から @v2 を引く。
引数: - v1 –
math.IVec2()
- v2 –
math.IVec2()
戻り値: - v1 –
-
math.
sub3D
(v1, v2)¶ @v1 から @v2 を引く。
引数: - v1 –
math.IVec3()
- v2 –
math.IVec3()
戻り値: - v1 –
-
math.
toHTMLColorString
(v)¶ vec3 を ”RGB (x*255,y*255,z*255)」 の文字列に、または、vec4 を 「RGBA(x*255,y*255,z*255,w*255)」 の文字列に変換する。また、{r,g,b,a} 要素を持つ構造体を受け取る。
引数: - v –
math.IVec3()
|math.IVec4()
|math.IColor3()
|math.IColor4()
戻り値: 未定義 | 文字列
- v –
-
math.
transposemat3
(mat)¶ mat3 を転置する
引数: - mat –
math.IMat3()
戻り値: - mat –
-
math.
transposemat4
(mat)¶ 転置した 4x4 行列を返す。
引数: - mat –
math.IMat4()
戻り値: - mat –
-
math.
vec2
(x, y)¶ 2D ベクトルを返す。
引数: - x – 数値
- y – 数値
戻り値:
-
math.
vec3
(x, y, z)¶ 3D ベクトルを返す。
引数: - x – 数値
- y – 数値
- z – 数値
戻り値:
-
math.
vec4
(x, y, z, w)¶ 4D ベクトルを返す。
引数: - x – 数値
- y – 数値
- z – 数値
- w – 数値
戻り値: