I will get the ball rolling:
Group by Neighbour Count
if ( neighbourcount ( 0, @ptnum ) == chi("count") ) setpointgroup ( geoself ( ), chs("name"), @ptnum, 1, "set" );
Parameters:
int count (Neighbour Count)
string name (Group Name)
if ( neighbourcount ( 0, @ptnum ) == chi("count") ) setpointgroup ( geoself ( ), chs("name"), @ptnum, 1, "set" );
Parameters:
int count (Neighbour Count)
string name (Group Name)
float seed = 0.99 + ch("seed"); float r = hscript_rand ( @ptnum + seed + sin ( 13 * @ptnum + 19 * seed ) ); float s = fit ( random ( 17 * @ptnum + 91 * seed ), 0, 1, ch("srangex"), ch("srangey")); s = ch("s") * ( 1 - ch("srand") ) + s * ch("srand") * ch("s"); float val = fit ( random ( 173 * @ptnum + 11 * seed ), 0, 1, ch("vrangex"), ch("vrangey")); val = ch("v") * ( 1 - ch("vrand") ) + val * ch("vrand") * ch("v"); @Cd = hsvtorgb ( ( r + 0.618033988749895 ) % 1, s, val );
int createLine ( int pt0; int pt1 ) { int pr = addprim ( geoself ( ), "polyline" ); addvertex ( geoself ( ), pr, pt0 ); addvertex ( geoself ( ), pr, pt1 ); return pr; } int createPolygon ( int pt0; int pt1; int pt2 ) { int pr = addprim ( geoself ( ), "poly" ); addvertex ( geoself ( ), pr, pt0 ); addvertex ( geoself ( ), pr, pt1 ); addvertex ( geoself ( ), pr, pt2 ); return pr; } int createPolygon ( int pt0; int pt1; int pt2; int pt3 ) { int pr = addprim ( geoself ( ), "poly" ); addvertex ( geoself ( ), pr, pt0 ); addvertex ( geoself ( ), pr, pt1 ); addvertex ( geoself ( ), pr, pt2 ); addvertex ( geoself ( ), pr, pt3 ); return pr; } void createAxisGeometry ( float s; vector n; vector t; vector c; int color; int arrow; int scale ) { vector p [ ]; push ( p, 0 ); push ( p, set ( s, 0, 0 ) ); if ( arrow ) { float x = scale ? 0.75 * s : s - 0.25; float y = 0.03 * ( scale ? s : 1 ); push ( p, set ( x, y, y ) ); push ( p, set ( x, y, -y ) ); push ( p, set ( x, -y, y ) ); push ( p, set ( x, -y, -y ) ); } for ( int i = 0; i < arraylength ( p ); ++i ) { matrix3 xform = dihedral ( { 1, 0, 0 }, { 0, 0, -1 } ) * lookat ( 0, n ); p [ i ] = p [ i ] * xform + t; } int pt [ ]; for ( int i = 0; i < arraylength ( p ); ++i ) pt [ i ] = addpoint ( geoself ( ), p [ i ] ); if ( color ) { for ( int i = 0; i < arraylength ( pt ); ++i ) setattrib ( geoself ( ), "point", "Cd", pt [ i ], -1, c, "set" ); } createLine ( pt [ 0 ], pt [ 1 ] ); if ( arrow ) { createPolygon ( pt [ 1 ], pt [ 2 ], pt [ 3 ] ); createPolygon ( pt [ 1 ], pt [ 3 ], pt [ 5 ] ); createPolygon ( pt [ 1 ], pt [ 5 ], pt [ 4 ] ); createPolygon ( pt [ 1 ], pt [ 4 ], pt [ 2 ] ); createPolygon ( pt [ 2 ], pt [ 4 ], pt [ 5 ], pt [ 3 ] ); } } createAxisGeometry ( ch("s"), chv("n"), chv("t"), chv("c"), chi("color"), chi("arrow"), chi("scale") );
Ferry Taswin
v@N = random(@P*123.465) *(vector)2 - 1;
Quick Randomize vector (-1 to 1)
float s = 1; if ( chi("scale") ) s = @scaleAttribute; @P += normalize ( @N ) * ch("amount") * pow ( s, ch("exponent") );
int source = chi("source"); int index = 1 - source; int maxpts = chi("maxpts") + index; int handle = pcopen ( source, "P", @P, ch("maxdist"), maxpts ); int count = pcnumfound ( handle ); if ( count > index ) { int pt = pcimportbyidxi ( handle, "point.number", index ); float dist = pcimportbyidxf ( handle, "point.distance", index ); i@nearestpt = pt; @nearestdist = dist; } i@nearestcount = count - index; pcclose ( handle );