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