4월, 2020의 게시물 표시

2020/04/06 공부

이미지
int[] nearpoints(해당지오, vector 해당 포인터 좌표,float 거리) https://www.sidefx.com/docs/houdini/vex/functions/nearpoints.html nearpoint = nearpoints[0] 이게 웃긴 것이 무조건 자기 자신이 병렬의 첫 번째 인덱스([0])에 채워짐. 한 마디로 매개 변수로 넣은 좌표 = 병렬 첫 번째 인덱스 int addpoint(해당지오, vector 원하는 좌표) -> 리턴값 : 만들어진 포인트 넘버 https://www.sidefx.com/docs/houdini/vex/functions/addpoint.html float distance(vector 점, vecotr 점2) -> 두 점 사이의 길이를 반환함 float distance2(vector점, vector 점2) -> 두 점 사이의 길이를 제곱하여 반환함 https://www.sidefx.com/docs/houdini/vex/functions/distance.html float    xyzdist ( <geometry> geometry ,  vector  origin )  ->점과 지오메트리간의 거리를 구함. https://www.sidefx.com/docs/houdini/vex/functions/xyzdist.html string itoa(int number) : 인티저 값을 문자열 값으로 변환하여 반환. void append(<type> array[] , <type> value) : 배열에 원하는 값을 넣어줌. https://www.sidefx.com/docs/houdini/vex/functions/append.html 응용 : 프리미티브 중앙에 점 만들기 1. wrangle을 만들고 Run Over를 primitive로 한다. 2. addpoint(0, ...

vex - Rubiks cube 분석

이미지
우선 먼저 이 글은 cgwiki의 'Rubirks cube' 파일을 기반으로 분석한 글임. 1. 좌표를 먼저 생성. copy stamp 에 쓸 좌표. 2. attribute wrangle 생성한 후에 @orient를 생성. @orient는 4개의 float 값을 가지는 벡터값이며 축과 각도를 한 꺼번에 표기할 때 쓰인다. ex) {0,0,1, 45} == z축으로 45도 기울인다는 의미. 더 자세한 내용은  https://www.sidefx.com/docs/houdini/copy/instanceattrs.html 3. wrangle을 하나 더 생성. 그리고 다음과 같이 코드 생성. float t; float speed = 2; t = @Time; t *= speed; int randaxis  = int(rand(floor(t),123)*3); int randslice = int(rand(floor(t),456)*3); float randdir = sign(fit(rand(floor(t),789),0,1,-1,1)); vector axis = {0,0,0}; if (randaxis==0) axis = {1,0,0}; if (randaxis==1) axis = {0,1,0}; if (randaxis==2) axis = {0,0,1}; float slice = 0; if (randslice==0) slice = -0.5; if (randslice==1) slice =  0; if (randslice==2) slice =  0.5; matrix3 m = ident(); float angle; angle = randdir*$PI/2*@TimeInc*speed; rotate(m, angle, axis); if (abs(sum(@P*axis) - slice) <= 0.001)...