Catenary curve deformer
A catenary is the natural curve a flexible rope or chain hangs under its own weight when fixed at two points. Imagine a power line sagging between two towers - that’s a catenary!
It’s useful for creating realistic:
- Power lines: As mentioned above, catenaries are perfect for depicting power lines with a natural droop.
- Suspension bridges: The main cables of suspension bridges often follow a catenary shape.
- Hanging cloths and fabrics: Flags, tents, and draped curtains can all benefit from a catenary curve for a realistic drape.
This is a simple example of how we can apply catenary to a curve with VEX in Houdini:
int numvtx = primvertexcount(0, @primnum);float cuv = vertexcurveparam(0, @vtxnum);float curve_length = primintrinsic(0, "measuredperimeter", @primnum);float x = fit01(cuv, -curve_length / 2, curve_length / 2);float random_seed = chf("random");float a = chf("A") + (rand(@primnum + random_seed) - 0.5) * chf("random_amplitude");a = max(a, 0.1);float gain = chf("gain");float y = gain * (a * cosh(x / a) - a * cosh(curve_length / (2 * a))) * -1;
// Set point positionv@P.y -= y;