Skip to content

Instantly share code, notes, and snippets.

@NSDesign
NSDesign / polycarve.py
Created October 13, 2015 00:13
Carve polygon curves by attribute or expression
node = hou.pwd()
geo = node.geometry()
u_parm = []
for pr in geo.prims():
node.setCurPrim(pr)
u_parm.append(node.evalParm("u_carve_start"))
# Reference u parameter used as the carve parametric location on the curve
import math
node = hou.pwd()
geo = node.geometry()
# Lines Construction
hasInputs = True if len(node.inputs()) > 0 else False
if hasInputs == False:
@NSDesign
NSDesign / Matrix Rotation
Last active February 6, 2024 14:54
VEX : Matrix rotation about a pivot point
f@angle = chf("angle") * 2 * $PI; // angle is a float slider with range from 0 - 1
v@axis = chv("axis") + point(1, "N", 0); // axis is a 3 float vector {0.0, 0.0, 0.0}
3@imatrix = ident();
rotate(@imatrix, @angle, @axis);
@P = (@P - point(1, "P", 0)) * @imatrix + point(1, "P", 0);
@NSDesign
NSDesign / gist:a8e2046c8fb45cd5d7ce
Created February 9, 2015 11:02
Vex : Random Walker
// User parameters added to attribute wrangle parameter interface
int walkers = chi("walkers");
int steps = chi("steps"); // Placing $F in steps, each walker will grow during playback
vector step = chv("step");
int connectPoints = chi("connect");
vector direct = {0,1,0};
vector offset = 0.5;
vector rand = 0.0;
vector stepinc = 0.0;
@NSDesign
NSDesign / gist:983bb7df6d6a154e9a19
Created February 9, 2015 10:56
VEX : get a polygon primitive's points
i@prim;
v@uv;
float dist = xyzdist(1, @P, @prim, @uv);
//Above gets the prim(n) and prim(uv) for a given point position
//Also the distance between the given point and the prim returned
//Although all we really need is the primitive number
//--
//Create array to store the primitive's point numbers
@NSDesign
NSDesign / index.html
Created September 10, 2014 14:19
A Pen by Rich East.
<!-- MOVE NOT ADDED YET. OTHER BUTTONS SHOULD WORK -->
<div class="footer" id="footer">
<div class="btn btn-sq btn-grey" id="zoomOut">-</div>
<div class="btn btn-sq btn-grey" id="zoomIn">+</div>
<div class="btn spacer-8">&nbsp</div>
<div class="btn btn-sm btn-blue btn-select" id="draw">Draw</div>
<div class="btn btn-sm btn-blue" id="move">Move</div>
<div class="btn btn-sm btn-blue" id="delete">Delete</div>
<div class="btn btn-med btn-blue right" id="reset">RESET</div>