VEX、Houdiniで網かごをつくる


<iframe width="560" height="315" src="https://www.youtube.com/embed/68i1wHRTFfw?si=KmWIzLzN3xN6te-Z" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>



線を作り、sin波を作り、それを重ね合い
網かごを作っていきます。



Lineノードはいいけど
計算が複雑になるのでVEXで作りました
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/3555512/2e035676-f70a-163e-967b-fba60cd20df9.png)



```C++:vex
float x=chf("x");
float y=chf("y");
float z=chf("z");
float B=chf("Freq");
 
float fxd=x/B/4;
float fyd=y/B/2;
float fzd=z/B/4;

vector xd=set(fxd,0,0); vector xd1=set(fxd,1,0);
vector yd=set(fyd,0,0);
vector zd=set(fzd,0,0);

```
<iframe width="560" height="315" src="https://www.youtube.com/embed/8j4w-wD2mlc?si=mDz2HuVp6OvZsrJ4" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>

```C++:vex
vector xd=set(fxd,0,0); vector xd1=set(fxd,1,0);
vector yd=set(fyd,0,0);
vector zd=set(fzd,0,0);

for (int i=0;i<x/fxd;i++){
//Horizontal line
int a=addpoint(0, set(fxd*i,0,0));
int b=addpoint(0, set(fxd*i,0,z));
int ab=addprim(0,"polyline",a,b);
setprimgroup(0,"U",ab,1,"set");
setprimgroup(0,"U",cd,1,"set");
setprimgroup(0,"y",cd,1,"set");

//Vertical line
int c=addpoint(0, set(fxd*i,0,0));
int d=addpoint(0, set(fxd*i,y,0));
int cd=addprim(0,"polyline",c,d);


int e=addpoint(0, set(fxd*i,0,z));
int f=addpoint(0, set(fxd*i,y,z));
int ef=addprim(0,"polyline",e,f);
setprimgroup(0,"U",ef,1,"set");
setprimgroup(0,"y",ef,1,"set");
}
```
```C++:vex
for (int i=0;i<z/fzd;i++){

int g=addpoint(0, set(0,0,fzd*i));
int h=addpoint(0, set(x,0,fzd*i));
int gh=addprim(0,"polyline",g,h);
setprimgroup(0,"V",gh,1,"set");


//Horizontal line
int j=addpoint(0, set(0,0,fzd*i));
int k=addpoint(0, set(0,y,fzd*i));
int l=addpoint(0, set(x,0,fzd*i));
int m=addpoint(0, set(x,y,fzd*i));

int jk=addprim(0,"polyline",j,k);
int lm=addprim(0,"polyline",l,m);
setprimgroup(0,"V",jk,1,"set");
setprimgroup(0,"V",lm,1,"set");
setprimgroup(0,"y",jk,1,"set");
setprimgroup(0,"y",lm,1,"set");

}

```


```C++:vex

for (int i=0;i<1;i++){
int p=addpoint(0, set(x,y,0));
int q=addpoint(0, set(x,y,z));
int r=addpoint(0, set(0,y,z));
int s=addpoint(0, set(0,y,0));
setpointgroup(0,"top",p,1,"set");
setpointgroup(0,"top",q,1,"set");
setpointgroup(0,"top",r,1,"set");
setpointgroup(0,"top",s,1,"set");
int pqsr=addprim(0,"poly",p,q,r,s);
setprimgroup(0,"top",pqsr,1,"set");
}
```

```C++:vex
float x=chf("x");
float y=chf("y");
float z=chf("z");
float B=chf("Freq");

float fxd=x/B/4;float fyd=y/B/2;float fzd=z/B/4;

for (int i=0;i<y/fyd;i++){
int l=addpoint(0, set(x,fyd*i,0));
int m=addpoint(0, set(x,fyd*i,z));

int n=addpoint(0, set(x,fyd*i,0));
int o=addpoint(0, set(0,fyd*i,0));

int lm=addprim(0,"polyline",l,m);
int no=addprim(0,"polyline",n,o);
setprimgroup(0,"z",lm,1,"set");
setprimgroup(0,"x",no,1,"set");
}
```
<iframe width="560" height="315" src="https://www.youtube.com/embed/M4Kzb7PQXD4?si=a9Qh7cSq6nntBIKV" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>