fc2ブログ

三次元変換行列(5)出直し

2008/05/12 22:03 - AS3.0





a + b = b + a
a × b = b × a

a - b ≠ b - a
a ÷ b ≠ b ÷ a



これから反映させようとしている行列×今現在の行列
public function concat( mat:Matrix3D ):void {
 var now:Matrix3D = this.clone();

 _a  = mat.a*now.a  + mat.b*now.d  + mat.c*now.g;
 _b  = mat.a*now.b  + mat.b*now.e  + mat.c*now.h;
 _c  = mat.a*now.c  + mat.b*now.f  + mat.c*now.i;
 _tx = mat.a*now.tx + mat.b*now.ty + mat.c*now.tz + mat.tx;

 _d  = mat.d*now.a  + mat.e*now.d  + mat.f*now.g;
 _e  = mat.d*now.b  + mat.e*now.e  + mat.f*now.h;
 _f  = mat.d*now.c  + mat.e*now.f  + mat.f*now.i;
 _ty = mat.d*now.tx + mat.e*now.ty + mat.f*now.tz + mat.ty;

 _g  = mat.g*now.a  + mat.h*now.d  + mat.i*now.g;
 _h  = mat.g*now.b  + mat.h*now.e  + mat.i*now.h;
 _i  = mat.g*now.c  + mat.h*now.f  + mat.i*now.i;
 _tz = mat.g*now.tx + mat.h*now.ty + mat.i*now.tz + mat.tz;
}



public function clone():Matrix3D {
 return new Matrix3D(
     _a , _b , _c,
     _d , _e , _f,
     _g , _h , _i,
     _tx, _ty, _tz );
}

にほんブログ村 IT技術ブログへ



スポンサーサイト




コメントの投稿

非公開コメント

タグクラウド

最近の記事
カテゴリ
月別アーカイブ
プロフィール

Aquioux

Author:Aquioux
日曜 Flash プログラマ。
Flash 作品は本館で展示しています。


mailto:aquioux@mail.goo.ne.jp

ブログパーツ

あわせて読みたい

フィードメーター - 閃光的網站・弛緩複合体 -Review Division-


検索/translation
Google



オススメ本

コメント
トラックバック
RSS

Add to Google

Bloglinesで閲読登録

はてなRSSに追加

Subscribe with livedoor Reader

My Yahoo!に追加

Add to Technorati Favorites!

feedpathに追加