rsencu / pyeuclid

Automatically exported from code.google.com/p/pyeuclid
0 stars 0 forks source link

_connect_sphere_sphere produces incorrect results #15

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hi 

Thanks you very much for this module. I intend to use it as a basis to tidy up 
a bunch of 3D geometry code I've written.

I've found a typo in _connect_sphere_sphere.

What steps will reproduce the problem?

>>> from euclid import *
>>> sphA1 = Sphere(Point3(0.0, 0.0, 4.0), 2.0 )
>>> sphB = Sphere(Point3(0.0, 0.0 ,5.0), 4.0)
>>> print sphA1.connect(sphB)

What is the expected output? What do you see instead?
expect
LineSegment3(<0.00, 0.00, 2.00> to <0.00, 0.00, 1.00>)
get
LineSegment3(<0.00, 0.00, 2.00> to <0.00, 0.00, 4.00>)

What version of the product are you using? On what operating system?
Windows XP Python 2.6.5

Please provide any additional information below.
There is a typo in line 1963, with an 'x' instead of a 'z'
    return LineSegment3(Point3(A.c.x + v.x * A.r,
                               A.c.y + v.y * A.r,
                               A.c.x + v.z * A.r),

Also the closest two points on the spheres may be in either direction along v, 
the vector between the two sphere centres

See attached file for a rough go at fixing the problem.

cheers

Eleanor Howick

Original issue reported on code.google.com by elf...@gmail.com on 11 Aug 2011 at 5:31

Attachments:

GoogleCodeExporter commented 8 years ago
I've added you as a project committed if you'd like to commit the patch.

Original comment by Alex.Hol...@gmail.com on 13 Aug 2011 at 12:51