pioneerspacesim/pioneer — pull request #1185 by johnbartholomew (2012-04-16 00:50:22+00:00)
Title: Fix LMR lathe primitive to be consistent with cylinder, ring and tube

There were two inconsistencies:

* `lathe` interprets its radius values as the distance to the vertices; cylinder and co. interpret radius as the distance to the middle of the edge.
* `lathe` interprets its "up" direction as the direction to the first vertex in a vertex ring. The others interpret it as the normal of the first edge in the ring.

Since `lathe` is used much less than the others, that's the function I've changed.

A test model to show the difference (try it before and after the patch):

define_model('test_lathe', {
info = {
bounding_radius = 60.0,
lod_pixels = { 50 },
materials = {'plain'}
},
static = function(lod)
set_material('plain',
0.7, 0.7, 0.7, 0.7, -- diffuse RGB; alpha
1, 1, 1, 0.1, -- specular RGB; specular strength
0, 0, 0) -- emissive RGB

use_material('plain')

tapered_cylinder(5, v(0,-20,0), v(0,-15,0), v(0,0,1), 1, 5)
ring(5, v(0,-15,0), v(0,-10,0), v(0,0,1), 5)
lathe(5, v(0,-10,0), v(0,10,0), v(0,0,1),
{0,5, 0.4,10, 0.6,10, 1,5})
cylinder(5, v(0,10,0), v(0,20,0), v(0,0,1), 5)

quad(v(-5, 20,-5), v(-5, 20, 5), v( 5, 20, 5), v( 5, 20,-5))
quad(v(-5, 20,-5), v( 5, 20,-5), v( 5, 20, 5), v(-5, 20, 5))
end
})