query: tag:3D

PLY形式のモデルデータをMSH形式に変換する方法のメモ。

MT Package の FORM2FORMコンバータを使います。
このページの下のほう
から mtjade.tar.gz をダウンロードして展開し、FORM2FORMディレクトリに移動してmakeします。
使い方はこんな感じです。

pre>>
% ./form2form foo.ply foo.msh
<<--

以下の行をコメントアウトしておくと、indexedではないmshが生成されます。

c>>
#define INDEXED
<<--

MSH形式の仕様は
こんな感じ
です。

posted by genki genki on Mon 1 Mar 2010 at 08:20 with 0 comments

gluLookAtでMultiplyされる行列を自前で作る場合、以下のようにすればokです。

If you want to get the matrix that is generated by gluLookAt, here is the way to do it.

c>>
//gluLookAt(
// eye[0], eye[1], eye[2],
// at[0], at[1], at[2],
// 0.0, 1.0, 0.0);
// equivalent pseudo code
float lookat[16];
midentity(lookat);
vec3 s = (vec3)&lookat[0];
vec3 u = (vec3)&lookat[4];
vec3 f = (vec3)&lookat[8];
vec3 t = (vec3)&lookat[12];
vcpy(t, &eye);
vneg(t);
vsub(f, &at, &eye);
vnormalize(f);
vec3 up = {0, 1, 0};
vcross(s, f, &up);
vcross(u, s, f);
vneg(f);
glMultMatrixf(lookat);
<<--

posted by takiuchi takiuchi on Sun 16 Aug 2009 at 14:34 with 0 comments

Posture consists of forward, upward and rightward directions.
Each directions has 2 degrees of freedom, but the set of them has only 3 degrees.

Recall that the posture can be represented as a unit quaternion.
The unit quaternion has a constraint on its length, so thus it has 3 degrees of freedom.

posted by takiuchi takiuchi on Wed 10 Jun 2009 at 02:30 with 0 comments