intersection_sphere_sphere
- compas.geometry.intersection_sphere_sphere(sphere1, sphere2)[source]
Computes the intersection of 2 spheres.
- Parameters
sphere1 ([point, float] |
compas.geometry.Sphere
) – A sphere defined by a point and radius.sphere2 ([point, float] |
compas.geometry.Sphere
) – A sphere defined by a point and radius.
- Returns
{‘point’, ‘circle’, or ‘sphere’} – The type of intersection.
[float, float, float] | tuple[[float, float, float], float, [float, float, float]] | tuple[[float, float, float], float] – If the type is ‘point’, the coordinates of the point. If the type is ‘circle’, the center point and radius of the circle, and the normal of the plane containing the circle. If the type is ‘sphere’, the center point and radius of the sphere.
Notes
There are 4 cases of sphere-sphere intersection 1:
the spheres intersect in a circle,
they intersect in a point,
they overlap,
they do not intersect.
References
Examples
>>> sphere1 = (3.0, 7.0, 4.0), 10.0 >>> sphere2 = (7.0, 4.0, 0.0), 5.0 >>> result = intersection_sphere_sphere(sphere1, sphere2) >>> if result: ... case, res = result ... if case == "circle": ... center, radius, normal = res ... elif case == "point": ... point = res ... elif case == "sphere": ... center, radius = res