### Axes of Evil

A quick and dirty set of 3D axes for Visual:

```from visual import arrow, cylinder   def visual_axes( scale ): """\ Display a set of 3D axes.   @param scale: The scale of the axis set. @type scale: C{float} """ for axis in [ tuple( [ i == j and scale * 5 or 0 for i in range( 3 ) ] ) \ for j in range( 3 ) ]: arrow( pos = ( 0, 0, 0 ), axis = axis, shaftwidth = scale / 10.0 )   cylinder( pos = ( ( scale * 6.0 ), -( scale / 4.0 ), 0 ), axis = ( -( scale / 2.0 ), ( scale / 2.0 ), 0 ), radius = scale / 20.0 ) cylinder( pos = ( scale * 5.5, -( scale / 4.0 ), 0 ), axis = ( ( scale / 2.0 ), ( scale / 2.0 ), 0 ), radius = scale / 20.0 )   cylinder( pos = ( 0, ( scale * 5.5 ), 0 ), axis = ( 0, ( scale / 4.0 ), 0 ), radius = scale / 20.0 ) cylinder( pos = ( 0, ( scale * 5.75 ), 0 ), axis = ( -( scale * 0.17 ), ( scale / 4.0 ), ( scale * 0.17 ) ), radius = scale / 20.0 ) cylinder( pos = ( 0, ( scale * 5.75 ), 0 ), axis = ( ( scale * 0.17 ), ( scale / 4.0 ), -( scale * 0.17 ) ), radius = scale / 20.0 )   cylinder( pos = ( 0, -( scale / 4.0 ), ( scale * 6.0 ) ), axis = ( 0.0, ( scale / 2.0 ), -( scale / 2.0 ) ), radius = scale / 20.0 ) cylinder( pos = ( 0, -( scale / 4.0 ), ( scale * 6.0 ) ), axis = ( 0.0, 0.0, -( scale / 2.0 ) ), radius = scale / 20.0 ) cylinder( pos = ( 0, ( scale / 4.0 ), ( scale * 6.0 ) ), axis = ( 0.0, 0.0, -( scale / 2.0 ) ), radius = scale / 20.0 )```

Yep, this is how I’m validating my geometry module by eye.

Mar 22nd, 2010
Tags: ,