# Points transformation

## Random pscale

static
animated
static
@pscale = rand(@ptnum)@pscale = fit01(@pscale, ch('min'),ch('max')); // fit within range
animated
​

## Random delete points/prim/id

if(rand(@ptnum) > ch('threshold') ) {   removepoint(0,@ptnum);}​// shorthandif rand(@pt)<ch('threshold')    removepoint(0,@ptnum);

## Random 'pushing' along Normal

float factor = fit01(rand(@ptnum),chf('min'),chf('max'));​@N*=ch('scale')*factor;@N = pow(@N,1.1);@P= @N;​

## Spirals

Constant
Regular
Phylotaxis
Constant
int points = chi("points");float radius = chf("radius");float freq = chf("freq");float mul = chf("mul");vector pos ={0,0,0};​​pos.x = radius*sin(@Time*freq);pos.y = radius*cos(@Time*freq);pos.z = @Time*freq*mul;​addpoint(0,pos);
Regular
Source: David Kahl Polar Coordinates in Houdini// 1st point wrangle​int points =chi("points");float step = (PI*2)/ ch("steps");​vector pos;float angle = chf("angle");float radius = chf("radius");​​for(int i=0; i<points;i++){    angle+= step;    radius = float(i)/ float(points);    pos.x = cos(angle) * radius;    pos.z = sin(angle) * radius;    addpoint(0,pos);}​// 2nd point wranglefloat norm = float(@ptnum)/float(npoints(0));@P.y=norm*chi("mult");​// 3rd point wranglefor(int i= 0;i<npoints(0);i++){    int prim = addprim(0,"polyline");    addvertex(0,prim,i);    addvertex(0,prim,i+1);    }
Phylotaxis
// Source: https://github.com/kiryha/Houdini/wiki//vex-snippets​int count = chi('points');float bound = 10.0;float tau = 6.28318530; // 2*$PIfloat phi = (1+ sqrt(5))/2; // Golden ratio = 1.618float golden_angle = (2 - phi)*tau; // In radians(*tau)vector pos = {0,0,0};float radius = 1.0;float theta = 0;int pt;​​vector polar_to_cartesian(float theta; float radius){ return set(cos(theta)*radius, 0, sin(theta)*radius);}​for (int n=0; n<count; n++){ radius = bound * pow(float(n)/float(count), ch('power')); theta += golden_angle; pos = polar_to_cartesian(theta, radius);​ // Create UP, pscale and N attr pt = addpoint(0, pos); setpointattrib(0, "pscale", pt, pow(radius,0.5)); setpointattrib(0, "N", pt, normalize(-pos)); setpointattrib(0, "up", pt, set(0,1,0));} # Rotation ## Rotation with p@orient float rotx = ch('rot_x');float roty = ch('rot_y');float rotz = ch('rot_z'); vector r = set(rotx,roty,rotz); p@orient = eulertoquaternion(radians(r),XFORM_XYZ); ## Rotating points with matrix matrix3 m = ident(); // identity matrix creationfloat angle = radians(chf("degrees")); // angles in radiansvector axis = {0,1,0}; // axis to turn​rotate(m,angle,2);@P *= m;​ # Scale ## Scale primitive locally with matrix & foreach Local towards Prim Center Local float scale = chf('scale');vector nml = prim_normal(0, @primnum, {0,0,0});int pts[] = primpoints(0, @primnum);foreach(int pt; pts){ matrix m = instance(v@P, nml, scale, {0,0,0}, {0,0,0,1}, v@P); vector pos = point(0, 'P', pt) * m; setpointattrib(0, 'P', pt, pos, 'set');} // Source:https://www.sidefx.com/forum/topic/50477/?page=1#post-227472 towards Prim Center float scale = chf('scale');int pts[] = primpoints(0, @primnum);foreach(int pt; pts){ vector pos_pt = point(0, 'P', pt); vector dir = normalize(pos_pt - v@P); vector pos = pos_pt + dir * scale; setpointattrib(0, 'P', pt, pos, 'set');}  # Spreading points in one axis @P.y = normalize(curlnoise(@P+@Time*.02)*0.5);@pscale = rand(@ptnum);@Cd = rand(@ptnum); # Color ## Band(s) of color moving across geo in one-axis @dir = @P.y;float width = chf('width');float offset = chf('offset');float vel = chf('vel');@Cd = sin(offset+width*@dir-@Time*vel);@pscale = @Cd; # Oscillations ## Sin wave abs(sin(@Time*rand(@ptnum)+chf('Z'))); # Using Cd for alpha float u = clamp(@value,,0,1); @Alpha = chramp('ramp_value'),u) # Connecting lines ## Plexus — Entagma float maxdist = chf('max_dist');int npts[] = nearpoints(0,v@P,maxdist);​removeindex(npts,0);i[]@npts = npts;​foreach(int npt; npts){ addprim(0,"polyline",@ptnum,npt);}  # Type ## Random character  \\int(fit01(rand($F),1,94))   // use 65-90 for lower case letters.  // Time Shift SOP stamp('../copy1','step',2)  // copystamp SOP  fit01(rand(@ptnum+$F+22),0,100) # Geometry ## Sphere $x = \rho cos\theta sin\phi\\y = \rho sin\theta sin\phi\\z=\rho cos\phi$ // Attribute wrangle SOP (Detail mode) ​float vel = chf('vel');int numpt = chi('Points');float a = ch('a'); // completionfloat b = ch('b'); // arc lengthfloat u = ch('v'); // radiusvector pos; ​for(int i=1;i<numpt;i++){​ addpoint(0,pos); float offset = @ptnum*vel*i; addprim(0,"polyline",i); addvertex(0,1,i); pos.x = u*cos(a*offset)*sin(b*offset); pos.y = u*sin(a*offset)*sin(b*offset); pos.z = u*cos(offset*b); } ## ​Torus / Toroidal $x=(a+bcosu)cosv \\ y=(a+bcosu)sinv\\ z=bsinu$ 1 2 1 // Have a geo & scatter sop before the wrangle node​float t = 1.0*@elemnum/@numelem ;​float completion = ch('completion') * 2 *$PI;float coils = ch('coils');float R = ch('outerRadius');float r = ch('innerRadius');​float u = t * completion * coils ;float v = t * completion ;​float x = cos(v)*(R+r*cos(u));float y = sin(v)*(R+r*cos(u));float z = r * sin(u);​@P = set(x,y,z);​//https://berniebernie.fr/wiki/Houdini_VEX
2
​float t = 3.0*@elemnum/@numelem ;​float a = ch('a'); // radiusfloat b= ch('b'); // inner radiusfloat u = ch('u')*t; // coilsfloat v = ch('v')*t; // completion​float x = (a+b*cos(u))*cos(v);float y = (a+b*cos(u))*sin(v);float z = b*sin(u);​v@P = set(x,y,z);​//https://math.stackexchange.com/questions/324527/do-these-equations-create-a-helix-wrapped-into-a-torus

## Mobius strip

$x = [ R + s cos(½ t)] cos(t)\\ y= [ R + s cos(½ t)] sin (t) \\ z = s sin(½ t)$
//  Have a geo & scatter sop before the wrangle node​float completion = ch('completion');float t = completion*@elemnum/@numelem ;t += ch('vel');float R = chf('radius'); float s = chf('s');vector pos = @P;​float x = (R+s*cos(.5*t))*cos(t);float y = (R+s*cos(.5*t))*sin(t);float z = s*sin(0.5*t);​@P = set(x,y,z);//https://berniebernie.fr/wiki/Houdini_VEX

# Abstract

## Cardioid

​

Also check out: Times Tables, Mandelbrot and the Heart of Mathematics