compas-dev / compas

Core packages of the COMPAS framework.
https://compas.dev/compas/
MIT License
305 stars 104 forks source link

Intersection methods that accepts tuples. #1323

Open petrasvestartas opened 3 months ago

petrasvestartas commented 3 months ago

Describe the bug I doubt it is a bug, but still would like to ask. In several intersection methods of compas, input parameters are either a tuple or a primitive geometry object, but it works only with a tuple. For example:

p0, p1 = intersection_sphere_line((sphere.base, sphere.radius), line)

But this does not work, since the intersection method tries to unpack the sphere: p0, p1 = intersection_sphere_line(sphere, line)

To Reproduce Above.

Expected behavior Preferred way would be to work with a primitive rather than a tuple.

Desktop (please complete the following information):

tomvanmele commented 2 months ago

@gonzalocasas this problem still exists in many places. perhaps we should remove the explicit reference to equivalent geometry objects from the docs. the lower level function API then explicitly uses the minimal mathematical representation of these objects, and in the higher level object API, we do this conversion behind the scenes automatically...

also, i think we should rename the function to always list the lower dimensional entity first.