Friday, July 27, 2012

Spiral staircase problem

So it seems building the spiral staircase and the handrails are fairly straightforward building projects.  Almost at least, how to do it in the graphics related sense?  Well, a basic parametric form is the way I did it.   Here's a simple equation:

f(theta_inc) = (r * cos (theta_inc), r * sin (theta_inc), z_inc * n)

where theta_inc is the incremented position of theta based upon your choice of arc division for the spiral form, n is derived from the function theta_position / theta_inc where theta_position is the sum total of step increments on the arc curvature.

You'd need to compute the vertices for both the inner and outer radius of the spiral stair case which determines corresponding sets of vertices on the lower and upper bounds of the step.

z_inc is a given step division determined by the height of the step divided by incremental arc divisions.

Here one might recall the formula for arc length s = r theta.  Which is a good start for determining the arc increments and the the outer width of the step if you choose to have radial curvature on the step.


For handrails, I started by creating on an arbitrary prime (prior to axis rotations and translations), a polar generated form with width determined by simple polar coordinate expressions similarly defining an arc subdivisions of suitable choice so as to appear sufficiently circular.  Then I rotated coordinates using blender's mathutils Euler rotations ('x', and 'z' on 'xyz')  Remembering that in cylindrical or spherical coordinates similarly, rotations theta are matched to theta on the polar coordinates generation on the prime axis (prior to rotation), and then normal to phi which phi + 90 degrees for the 'x' rotation.  On the polar form generation prior to rotation and translation I left local z prime at 0 providing ease in translation.  Translation is merely done so either at the time of vertex generation or post generation using theta_inc as in the steps case above and making sure to use the outer radius on the steps curvature for position alongside z_inc for height position parametrically speaking.  What results is handrail whose cylindrical height is tangent to the axis of the spiral and whose cross sectional plane is normal to such curvature at any point.














Will probably post code soon here as an example. Generally abstracted so that a user can input dimensions of varying radial, step widths, riser heights and what not.

Stair build blender python file

Programs won't work for generating 'stone' type steps, at least I hadn't debugged and fully implemented this yet.

Sort of tiring at the moment on further work here so I figured I'd post some code on this, just flip to Blender's text view tab, then using the blender text editor, open the python script and run.  Its already set to generate a spiral staircase here.  

No comments:

Post a Comment

Oblivion

 Between the fascination of an upcoming pandemic ridden college football season, Taylor Swift, and Kim Kardashian, wildfires, crazier weathe...