13
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Houdini VEXメモ

Last updated at Posted at 2020-04-07

vexの頻度の高い内容をメモ書き ➀ -加筆中-

HIPファイル

#データ型

int     a  = 2;
float   b  = 2.1;
vector  c  = (2.1, 2.1, 2.1);
vector2 c2 = (2.1, 2.1);
string  d  = "two";
matrix3 m3 = { {1,1,1}, {2,2,2}, {3,3,3} };
matrix  m4 = { {1,1,1,1}, {2,2,2,2}, {3,3,3,3}, {4,4,4,4} };

#配列

int     a[]  = {1, 2, 3};
float   b[]  = {1.1, 2.1, 3.1};
vector  c[]  = {{1.0, 1.0, 1.0}, {2.0, 2.0, 2.0}};
vector2 c2[] = {{1.0, 1.0}, {2.0, 2.0}};
string  d[]  = {"one", "two", "three"};

#アトリビュートの型指定

i@a  = 2;
f@b  = 2.1;
v@c  = (2.1, 2.1, 2.1);
u@c2 = (2.0, 2.0);
s@d  = "two";
3@m3 = { {1,1,1,}, {2,2,2}, {3,3,3} };
4@m4 = { {1,1,1,1}, {2,2,2,2}, {3,3,3,3}, {4,4,4,4} };

#頻度の高い関数

###ch() チャンネルの値

float colorRed   = ch("red");
float colorGreen = ch("green");
float colorBlue  = ch("blue");

v@Cd = set( colorRed, colorGreen, colorBlue );

###chv() vectorチャンネルの値

vector translate= chv("translate");

###chramp() ランプの値
floatまたはvectorの値を出力する
入力値は0~1に収めないといけない

float red = chramp("red",@P.y); 
@Cd = set(red, 0, 0); 

もし0以下や1以上の値を入力するとリピートした値が出力される
image.png

カラーランプ(vector)の値を出力させたい時は、vectorを指定

vector color = vector(chramp("color",@P.y)); 
@Cd = color;

image.png

###fit() 範囲指定して別の範囲にラッピング

@P.y = fit(@P.y, -0.35, 0.35, 0, 1);

###fit01()
###rand() 0~1の乱数
floatやvectorの型に合わせて出力してくれる

@Cd = set(rand(i@primnum), 0, 0);
@Cd = rand(i@primnum);

###relbbox() バウンディングボックス(0~1)の相対位置

@Cd = relbbox(0, @P);

###getbbox_size() バウンディングボックスのサイズ

vector v = getbbox_size(0);
printf("%f", v);

###getbbox_center() バウンディングボックスの中心

vector center = getbbox_center(0);
printf("%f", center);

###addpoint() ポイントの追加

addpoint(0, set(0, 0, 0));

###removepoint() ポイントの削除

removepoint(0,i@ptnum);

###removepoint() ポイントの参照
ノードパスを指定したい場合は、op:をパスに付ける

vector getPosition = point(0, "P", 0);
printf("input 0    %f \n",getPosition);

getPosition = point('op:/obj/func_point/transform1', "P", 0);
printf("input path %f \n",getPosition);

###maketransform() トランスフォームマトリックス
パラメータが特に多いので難しく感じるけど、transformノードと一緒で移動、回転、スケールを入れるだけ
赤がtransformで緑がmaketransform、両方とも同じ値
image.png

vector translate= chv("translate");
vector rotate   = chv("rotate");
vector scale    = chv("scale");
vector pivot    = chv("pivot");

@P *= maketransform(0,0, translate, rotate, scale, pivot);
13
11
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
13
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?