//primpoint
int primPts [] = primpoints(0,@primnum);
//calculer dir
vector pt1 = point(0,"P",primPts[1]);
vector pt0 = point(0,"P",primPts[0]);
setpointattrib(0,"name",primPts[1],"corner","set");
setpointattrib(0,"name",primPts[0],"corner","set");
//dirPoint
vector ptPos = lerp(pt1,pt0,0.5);
int dirPt = addpoint(0,ptPos);
vector dir = ptPos*-1 ;
setpointattrib(0,"dir",dirPt,dir,"set");
setpointattrib(0,"name",dirPt,"midPoint","set");
//addPoints sur curve
int maxPt = chi("maxPt");
int seed = chi("seed")+@primnum;
//boucle
for (int i=0;i<=maxPt;i++){
float randNumber = rand(i+seed);
vector ptCurve = lerp(pt1,pt0,randNumber);
addpoint(0,ptCurve);
}
//remove dirPt
//removepoint(0,dirPt);
connectAdjEdgePropagationChaos
// connect adjacent edge style propagation plus chaos
//depart = 0
// it = $F
int depart = chi("depart");
vector color = set(0,1,0);
int voisins[] = neighbours(0,depart);
int maxIt = fit(chi("it"),0,30,0,30);
int prim = addprim(0,"polyline");
for (int i;i<maxIt;i++){
foreach (int voisin;voisins)
{
setpointattrib(0,"Cd",voisin,color,"set");
addvertex(0,prim,voisin);
int newArray[]=neighbours(0,voisin);
append(voisins,newArray);
}
foreach(int i ; voisins)
{
foreach(int index ;int b ; voisins)
{
if (b==i){removeindex(voisins,index);}
}
}
}
connectAjacentEdge
// connect adjacent edge style marche de saoul
//depart = 0
// it = $F
int voisin(int depart;int direction){
int voisin = neighbour(0,depart,direction);
vector color = set(0,1,0);
int prim = addprim(0,"polyline");
addvertex(0,prim,depart);
addvertex(0,prim,voisin);
setpointattrib(0,"Cd",voisin,color,"set");
return voisin;
}
int depart = chi("depart");
int direction = 2;
int max = chi("max");
for (int i ; i<max;i++){
direction = floor(rand(i)*3);
depart = voisin(depart,direction);
}
contactSheet
int x=0;
int y=2;
vector pos;
int ligne = chi("ligne");
int max = @numpt;
for (int i = 0; i<max;i++){
x+=2;
if (i%ligne == 0){
y+=-2;
x=0;
}
pos = set(x,y,0);
setpointattrib(0,"P",i,pos,"set");
}
int numPoint = chi("numPoint");
int mypc = pcopen(0,"P",@P,chf("radius"),numPoint);
@Cd= chramp("ramp",fit(pcnumfound(mypc),0,numPoint,0,1));
if (@Cd.x<chf("seuilColor"))removepoint(0,@ptnum);
dyn_menu
geo=hou.node("./IN_shapes").geometry()
menuList=[]
for point in geo.iterPoints():
name=point.attribValue("name")
if not name in menuList:
menuList.append(name)
menuList.append(name)
return menuList
fillpointBetweenPoint
float searchrad=ch("searchrad");
float mindist=ch("mindist");
int maxpoints=chi("maxpoints");
int fillpoints=chi("fillpts");
vector clpos;
int handle=pcopen(0,"P",@P,searchrad,maxpoints+1);
int i=0;
while(pciterate(handle))
{
if (i==0) // the first point found should be the closest, in this case, itself. We want to skip it.
{
i++;
continue;
}
pcimport(handle,"P",clpos);
if (length(@P-clpos)>mindist)
{
vector pointstep=(clpos-@P)/(fillpoints*2+1); // this ensures there are no duplicate point
// at the cost of doubling the fill points number
for (int t=0;t<fillpoints;t++)
addpoint(0,@P+(pointstep*float(t+1)));
}
}
intersectRay
vector orig = point(1,"P",0);
float dist = distance(orig,@P)-0.01;
vector dir = normalize(@P-orig)*dist;
vector pos,uvw;
int intersect = intersect(0,orig,dir,pos,uvw);
if (intersect>0 ){
@Cd = 0;
}
keepXpts
float val = rand(@id + ch("seed"));
int npts = npoints(0);
if(val * npts > chi("max_pts")) removepoint(0,@ptnum);
nameList
// creer une liste a partir des noms sur les points
s[]@nameListe;
string nameT;
int maxit=@numpt;
for (int i=0;i<maxit;i++)
{
nameT = point(0,"name",i);
if (len(nameT)>0 && find(s[]@nameListe,nameT)<0){
push(s[]@nameListe,nameT);}
}
nearpointConnect
// input un geo test input deux nuage de pts
int handle = pcopen(1,"P",@P,20,100);
int max = pcnumfound(handle);
for (int i;i<max;i++){
vector start = point(1,"P",i);
int near[]= nearpoints(0,start,10,3);
int prim = addprim(0,"polyline");
int startPt = addpoint(0,start);
int primTwo = addprim(0,"poly");
foreach(int index;int pt;near){
vector color = rand(index);
setpointattrib(0,"Cd",pt,color,"set");
addvertex(0,prim,startPt);
addvertex(0,prim,pt);
addvertex(0,primTwo,pt);
}
}