The cylinder module

Geometry managers based on a cylinder along the Z axis.

References

[1]http://www.siggraph.org/education/materials/HyperGraph/raytrace/rtinter4.htm
class tracer.cylinder.FiniteCylinder(diameter, height)

This geometry manager represents a cylinder with a given height, centered on its origin, (so that the top Z is at height/2).

mesh(resolution)

Represent the surface as a mesh in local coordinates. Uses cylindrical bins, i.e. the points are equally distributed by angle and axial location, not by x,y.

Arguments

  • resolution: in points per unit length (so the number of points returned is O(height*pi*diameter*resolution**2))

Returns

x, y, z - each a 2D array holding in its (i,j) cell the x, y, and z coordinate (respectively) of point (i,j) in the mesh.

class tracer.cylinder.InfiniteCylinder(diameter)

A cylindrical surface infinitely long on the Z axis.

get_ABC(bundle)

Finds the coefficients of the quadratic equation for the intersection of a ray and the cylinder. See [1].

Arguments

  • bundle: a RayBundle instance with rays for which to get the coefficients.

Returns

A, B, C - satisfying A*t**2 + B*t + C = 0 such that the intersection points are at distance t from each ray’s vertex.

Previous topic

The paraboloid module

This Page