class cymel.core.datatypes.matrix.Matrix

Inheritance diagram of Matrix
class cymel.core.datatypes.matrix.Matrix(*args, **kwargs)

ベースクラス: object

4x4 マトリックスクラス。

コンストラクタでは以下の値を指定可能。

  • Matrix

  • 16値のシーケンス

  • 3つの Vector による 3x3 部分の行ベクトル指定。

    • 追加で4つめの Vector で translate 値の指定。

    • transpose=True オプションの指定で 3x3 部分の転置。

Methods:

addT(v)

addTranslation の別名。

addTranslation(v)

平行移動値を加算する。

adj()

adjugate の別名。

adjoint()

adjugate の別名。

adjointIt()

adjugateIt の別名。

adjugate()

余因子行列を得る。

adjugateIt()

余因子行列をセットする。

as3x3()

3x3部分以外を初期化した行列を得る。

asD([order])

asDegrees の別名。

asDegrees([order])

オイラー角回転を度数法の list として得る。

asE([order])

asEulerRotation の別名。

asEulerRotation([order])

オイラー角回転を得る。

asQ()

asQuaternion の別名。

asQuaternion()

クォータニオンを得る。

asRM()

asRotationMatrix の別名。

asRotationMatrix()

回転のみの行列を得る。

asS()

asScaling の別名。

asSM()

asScalingMatrix の別名。

asScaling()

スケーリング成分を得る。

asScalingMatrix()

スケーリング成分(scale+shear)のみの行列を得る。

asSh()

asShearing の別名。

asShearing()

シアー成分を得る。

asT()

asTranslation の別名。

asTM()

asTranslationMatrix の別名。

asTransformation()

トランスフォーメーションとして得る。

asTranslation()

平行移動成分を得る。

asTranslationMatrix()

平行移動のみの行列を得る。

asTransposed3x3()

3x3部分は転置、それ以外の部分は初期化した行列を得る。

asX()

asTransformation の別名。

axes([transpose])

3x3部分の行や列の軸ベクトルを3つ得る。

axis(i[, transpose])

3x3部分の行や列を軸ベクトルとして得る。

cofactor(i, j)

指定位置の余因子を得る。

col(i)

column の別名。

cols()

columns の別名。

column(i)

列ベクトルを得る。

columns()

列ベクトルを4つ全て得る。

det()

行列式を得る。

det2()

2x2部分の行列式を得る。

det2x2()

det2 の別名。

det3()

3x3部分の行列式を得る。

det3x3()

det3 の別名。

det4()

det の別名。

det4x4()

det の別名。

determinant()

det の別名。

determinant2()

det2 の別名。

determinant3()

det3 の別名。

div(m[, pre])

マトリックス要素同士を除算する。

getElem(row, col)

指定位置の要素を得る。

hasNonUniformScaling([tol])

非一様スケーリングが含まれているかどうか。

homogenize()

3x3部分を正規直交化した行列を得る。

homogenizeIt()

3x3部分を正規直交化した行列をセットする。

idiv(m[, pre])

各要素同士を除算し自身を更新する。

imul(m)

マトリックス要素同士を乗算してセットする。

init3x3()

3x3 部分を初期化する。

initT()

initTranslation の別名。

initTranslation()

4行目の平行移動成分をクリアする。

inverse()

逆行列を得る。

invertIt()

逆行列をセットする。

isEquivalent(m[, tol])

ほぼ同値かどうか。

isIdentity([tol])

ほぼ単位行列かどうか。

isSingular()

特異行列かどうか。

makeInvS(v[, pre])

makeInverseScaling の別名。

makeInvSh(v)

makeInverseShearing の別名。

makeInvT(v)

makeInverseTranslation の別名。

makeInverseScaling(v[, pre])

スケーリングの逆行列を作成する。

makeInverseShearing(v)

シアーの逆行列を作成する。

makeInverseTranslation(v)

平行移動の逆行列を作成する。

makeR(v[, order])

makeRotation の別名。

makeRotation(v[, order])

オイラー角回転から回転行列を作成する。

makeS(v)

makeScaling の別名。

makeScaling(v)

スケーリング行列を作成する。

makeSh(v)

makeShearing の別名。

makeShearing(v)

シアー行列を作成する。

makeT(v)

makeTranslation の別名。

makeTranslation(v)

平行移動行列を作成する。

mirror([mirrorAxis, negAxis, t])

指定軸方向でミラーしたマトリックスを得る。

mirrorIt([mirrorAxis, negAxis, t])

指定軸方向でミラーしたマトリックスをセットする。

mul(m)

マトリックス要素同士を乗算する。

orthonormalize()

3x3部分を正規直交化した行列を得る。

orthonormalizeIt()

3x3部分を正規直交化した行列をセットする。

row(i)

行ベクトルを得る。

rows()

行ベクトルを4つ全て得る。

set(v)

他の値をセットする。

setAxes(vx, vy, vz[, vt, transpose])

3x3部分の行や列と4行目の平行移動ベクトルをセットする。

setAxis(i, v[, transpose])

3x3部分の行や列のベクトルをセットする。

setColumn(i, v)

列ベクトルをセットする。

setColumns(v0, v1, v2, v3)

列ベクトルを4つ全てセットする。

setElem(row, col, val)

指定位置の要素をセットする。

setRow(i, v)

行ベクトルをセットする。

setRows(v0, v1, v2, v3)

行ベクトルを4つ全てセットする。

setT(v)

setTranslation の別名。

setToIdentity()

単位行列をセットする。

setTranslation(v)

平行移動値をセットする。

subT(v)

subTranslation の別名。

subTranslation(v)

平行移動値を減算する。

transpose()

転置行列を得る。

transposeIt()

転置行列をセットする。

Attributes:

Identity = ImmutableMatrix(((1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 0, 1)))
Tolerance = 1e-10
Zero = ImmutableMatrix(((0, 0, 0, 0), (0, 0, 0, 0), (0, 0, 0, 0), (0, 0, 0, 0)))

Methods Details:

addT(v)

addTranslation の別名。

addTranslation(v)

平行移動値を加算する。

パラメータ:

v (Vector) -- 平行移動の3次元ベクトル。

adj()

adjugate の別名。

adjoint()

adjugate の別名。

adjointIt()

adjugateIt の別名。

adjugate()

余因子行列を得る。

戻り値の型:

Matrix

adjugateIt()

余因子行列をセットする。

戻り値の型:

Matrix (self)

as3x3()

3x3部分以外を初期化した行列を得る。

戻り値の型:

Matrix

asD(order=0)

asDegrees の別名。

asDegrees(order=0)

オイラー角回転を度数法の list として得る。

パラメータ:

order (int) -- 得たい回転オーダー。

戻り値の型:

list

注釈

単位を弧度法で得たい場合は asEulerRotation を使用すると良い。

asE(order=0)

asEulerRotation の別名。

asEulerRotation(order=0)

オイラー角回転を得る。

パラメータ:

order (int) -- 得たい回転オーダー。

戻り値の型:

EulerRotation

注釈

EulerRotation の単位は弧度法なので、 度数法で得たい場合は asDegrees を使用すると良い。

asQ()

asQuaternion の別名。

asQuaternion()

クォータニオンを得る。

戻り値の型:

Quaternion

asRM()

asRotationMatrix の別名。

asRotationMatrix()

回転のみの行列を得る。

戻り値の型:

Matrix

asS()

asScaling の別名。

asSM()

asScalingMatrix の別名。

asScaling()

スケーリング成分を得る。

戻り値の型:

Vector

asScalingMatrix()

スケーリング成分(scale+shear)のみの行列を得る。

戻り値の型:

Matrix:

asSh()

asShearing の別名。

asShearing()

シアー成分を得る。

戻り値の型:

Vector

asT()

asTranslation の別名。

asTM()

asTranslationMatrix の別名。

asTransformation()

トランスフォーメーションとして得る。

戻り値の型:

Transformation

asTranslation()

平行移動成分を得る。

戻り値の型:

Vector

asTranslationMatrix()

平行移動のみの行列を得る。

戻り値の型:

Matrix

asTransposed3x3()

3x3部分は転置、それ以外の部分は初期化した行列を得る。

戻り値の型:

Matrix

asX()

asTransformation の別名。

axes(transpose=False)

3x3部分の行や列の軸ベクトルを3つ得る。

Vector の w は 1.0 となる。

パラメータ:

transpose (bool) -- 転置行列の軸ベクトルを得る。 言い換えると False では行ベクトルを True では列ベクトルを得ることになる。

戻り値の型:

tuple

axis(i, transpose=False)

3x3部分の行や列を軸ベクトルとして得る。

Vector の w は 1.0 となる。

パラメータ:
  • i (int) -- 軸指定(0=X, 1=Y, 2=Z)。

  • transpose (bool) -- 転置行列の軸ベクトルを得る。 言い換えると False では行ベクトルを True では列ベクトルを得ることになる。

戻り値の型:

Vector

cofactor(i, j)

指定位置の余因子を得る。

パラメータ:
  • i (int) -- 行インデックス。

  • j (int) -- 列インデックス。

戻り値の型:

float

col(i)

column の別名。

cols()

columns の別名。

column(i)

列ベクトルを得る。

パラメータ:

i (int) -- 列インデックス(0~3)。

戻り値の型:

Vector

columns()

列ベクトルを4つ全て得る。

戻り値の型:

tuple

det()

行列式を得る。

戻り値の型:

float

det2()

2x2部分の行列式を得る。

戻り値の型:

float

det2x2()

det2 の別名。

det3()

3x3部分の行列式を得る。

戻り値の型:

float

det3x3()

det3 の別名。

det4()

det の別名。

det4x4()

det の別名。

determinant()

det の別名。

determinant2()

det2 の別名。

determinant3()

det3 の別名。

div(m, pre=1e-13)

マトリックス要素同士を除算する。

ゼロ除算を避ける為、分母が avoidZeroDiv でフィルタされてから実行される。

パラメータ:
  • m (Matrix) -- 分母のマトリックス。

  • pre (float) -- ゼロ除算を避ける為の許容誤差。

戻り値の型:

Matrix

getElem(row, col)

指定位置の要素を得る。

パラメータ:
  • row (int) -- 行インデックス (0-3)

  • col (int) -- 列インデックス (0-3)

戻り値の型:

float

hasNonUniformScaling(tol=1e-10)

非一様スケーリングが含まれているかどうか。

パラメータ:

tol (float) -- 許容誤差。

戻り値の型:

bool

homogenize()

3x3部分を正規直交化した行列を得る。

戻り値の型:

Matrix

homogenizeIt()

3x3部分を正規直交化した行列をセットする。

戻り値の型:

Matrix (self)

idiv(m, pre=1e-13)

各要素同士を除算し自身を更新する。

ゼロ除算を避ける為、分母が avoidZeroDiv でフィルタされてから実行される。

パラメータ:
  • v (iterable) -- 要素数16個以上のシーケンス。

  • pre (float) -- ゼロ除算を避ける為の許容誤差。

imul(m)

マトリックス要素同士を乗算してセットする。

パラメータ:

m (Matrix) -- 乗じるマトリックス。

戻り値の型:

Matrix (self)

init3x3()

3x3 部分を初期化する。

4x4 全て初期化する場合は setToIdentity が利用できる。

平行移動成分のみの行列を新規に得たい場合は asTranslationMatrix が利用できる。

戻り値の型:

Matrix (self)

initT()

initTranslation の別名。

initTranslation()

4行目の平行移動成分をクリアする。

3x3 以外を初期化したマトリクスを新規に得たい場合は as3x3 が利用できる。

戻り値の型:

Matrix (self)

inverse()

逆行列を得る。

戻り値の型:

Matrix

invertIt()

逆行列をセットする。

戻り値の型:

Matrix (self)

isEquivalent(m, tol=1e-10)

ほぼ同値かどうか。

パラメータ:
  • m (Matrix) -- 比較するマトリックス。

  • tol (float) -- 許容誤差。

戻り値の型:

bool

isIdentity(tol=1e-10)

ほぼ単位行列かどうか。

パラメータ:

tol (float) -- 許容誤差。

戻り値の型:

bool

isSingular()

特異行列かどうか。

戻り値の型:

bool

classmethod makeInvS(v, pre=1e-13)

makeInverseScaling の別名。

classmethod makeInvSh(v)

makeInverseShearing の別名。

classmethod makeInvT(v)

makeInverseTranslation の別名。

classmethod makeInverseScaling(v, pre=1e-13)

スケーリングの逆行列を作成する。

パラメータ:
  • v (Vector) -- スケール値の3次元ベクトル。

  • pre (float) -- ゼロ除算を避ける為の許容誤差。

戻り値の型:

Matrix

classmethod makeInverseShearing(v)

シアーの逆行列を作成する。

パラメータ:

v (Vector) -- シアー値 (xy, yz, yx)

戻り値の型:

Matrix

classmethod makeInverseTranslation(v)

平行移動の逆行列を作成する。

パラメータ:

v (Vector) -- 平行移動の3次元ベクトル。

戻り値の型:

Matrix

classmethod makeR(v, order=0)

makeRotation の別名。

classmethod makeRotation(v, order=0)

オイラー角回転から回転行列を作成する。

パラメータ:
  • v (iterable) -- 各軸の回転角度 (x,y,z) を Radians で。

  • order (int) -- 回転オーダーを表す整数値。

戻り値の型:

Matrix

classmethod makeS(v)

makeScaling の別名。

classmethod makeScaling(v)

スケーリング行列を作成する。

パラメータ:

v (Vector) -- スケール値の3次元ベクトル。

戻り値の型:

Matrix

classmethod makeSh(v)

makeShearing の別名。

classmethod makeShearing(v)

シアー行列を作成する。

パラメータ:

v (Vector) -- シアー値 (xy, yz, yx)

戻り値の型:

Matrix

classmethod makeT(v)

makeTranslation の別名。

classmethod makeTranslation(v)

平行移動行列を作成する。

パラメータ:

v (Vector) -- 平行移動の3次元ベクトル。

戻り値の型:

Matrix

mirror(mirrorAxis=0, negAxis=True, t=True)

指定軸方向でミラーしたマトリックスを得る。

パラメータ:
  • mirrorAxis (int) -- ミラーする基準軸。 AXIS_XAXIS_YAXIS_Z のいずれかを指定する。

  • negAxis (int) --

    行列式(スケール)が反転しないように、 ミラー結果の逆を向けるローカル軸。 AXIS_XAXIS_YAXIS_Z の他に、 None 、 False 、 True を指定可能。

    省略時(True)はミラー基準軸と同じになる。 False では 3x3 部は反転しない。 None ではミラー結果から全軸を逆に向ける。

  • t (bool) -- 平行移動値(4行目)も反転するかどうか。

戻り値の型:

Matrix

mirrorIt(mirrorAxis=0, negAxis=True, t=True)

指定軸方向でミラーしたマトリックスをセットする。

パラメータ:
  • mirrorAxis (int) -- ミラーする基準軸。 AXIS_XAXIS_YAXIS_Z のいずれかを指定する。

  • negAxis (int) --

    行列式(スケール)が反転しないように、 ミラー結果の逆を向けるローカル軸。 AXIS_XAXIS_YAXIS_Z の他に、 None 、 False 、 True を指定可能。

    省略時(True)はミラー基準軸と同じになる。 False では 3x3 部は反転しない。 None ではミラー結果から全軸を逆に向ける。

  • t (bool) -- 平行移動値(4行目)も反転するかどうか。

戻り値の型:

Matrix (self)

mul(m)

マトリックス要素同士を乗算する。

パラメータ:

m (Matrix) -- 乗じるマトリックス。

戻り値の型:

Matrix

orthonormalize()

3x3部分を正規直交化した行列を得る。

戻り値の型:

Matrix

orthonormalizeIt()

3x3部分を正規直交化した行列をセットする。

戻り値の型:

Matrix (self)

row(i)

行ベクトルを得る。

パラメータ:

i (int) -- 行インデックス(0~3)。

戻り値の型:

Vector

rows()

行ベクトルを4つ全て得る。

戻り値の型:

tuple

set(v)

他の値をセットする。

コンストラクタと同様に、以下の値を指定可能。

  • Matrix

  • 16値のシーケンス

戻り値の型:

Matrix (self)

setAxes(vx, vy, vz, vt=ImmutableVector(0.000000, 0.000000, 0.000000), transpose=False)

3x3部分の行や列と4行目の平行移動ベクトルをセットする。

パラメータ:
  • vx (Vector) -- セットするX軸ベクトル。

  • vy (Vector) -- セットするY軸ベクトル。

  • vz (Vector) -- セットするZ軸ベクトル。

  • vt (Vector) -- セットする平行移動ベクトル。 これだけは transpose オプションの影響を受けない。

  • transpose (bool) -- 3x3部分には転置行列の軸ベクトルをセットする。 言い換えると False では行ベクトルを True では列ベクトルをセットすることになる。

setAxis(i, v, transpose=False)

3x3部分の行や列のベクトルをセットする。

パラメータ:
  • i (int) -- 軸指定(0=X, 1=Y, 2=Z)。

  • v (Vector) -- セットする軸ベクトル。

  • transpose (bool) -- 転置行列の軸ベクトルをセットする。 言い換えると False では行ベクトルを True では列ベクトルをセットすることになる。

setColumn(i, v)

列ベクトルをセットする。

パラメータ:
  • i (int) -- 列インデックス(0~3)。

  • v (Vector) -- セットする4次元ベクトル。

setColumns(v0, v1, v2, v3)

列ベクトルを4つ全てセットする。

パラメータ:
  • v0 (Vector) -- 1列目の4次元ベクトル。

  • v1 (Vector) -- 2列目の4次元ベクトル。

  • v2 (Vector) -- 3列目の4次元ベクトル。

  • v3 (Vector) -- 4列目の4次元ベクトル。

setElem(row, col, val)

指定位置の要素をセットする。

パラメータ:
  • row (int) -- 行を 0 ~ 3 で指定。

  • col (int) -- 列を 0 ~ 3 で指定。

  • val (float) -- セットする値。

setRow(i, v)

行ベクトルをセットする。

パラメータ:
  • i (int) -- 行インデックス(0~3)。

  • v (Vector) -- セットする4次元ベクトル。

setRows(v0, v1, v2, v3)

行ベクトルを4つ全てセットする。

パラメータ:
  • v0 (Vector) -- 1行目の4次元ベクトル。

  • v1 (Vector) -- 2行目の4次元ベクトル。

  • v2 (Vector) -- 3行目の4次元ベクトル。

  • v3 (Vector) -- 4行目の4次元ベクトル。

setT(v)

setTranslation の別名。

setToIdentity()

単位行列をセットする。

戻り値の型:

self

setTranslation(v)

平行移動値をセットする。

パラメータ:

v (Vector) -- 平行移動の3次元ベクトル。

subT(v)

subTranslation の別名。

subTranslation(v)

平行移動値を減算する。

パラメータ:

v (Vector) -- 平行移動の3次元ベクトル。

transpose()

転置行列を得る。

戻り値の型:

Matrix

transposeIt()

転置行列をセットする。

戻り値の型:

Matrix (self)