.. _geometry_intersection: Intersections and Joins ======================= To handle intersecting and joining an arbitrary number of geometric objects of varying type, we have the module :py:mod:`ddg.geometry.intersection`. The most important functions are :py:func:`~ddg.geometry.intersection.intersect` (also available as :py:func:`~ddg.geometry.intersection.meet`) and :py:func:`~ddg.geometry.intersection.join`: .. doctest:: >>> import numpy as np >>> from ddg.geometry.quadrics import Quadric >>> from ddg.geometry.subspaces import Subspace, Point >>> from ddg.geometry.intersection import intersect, join >>> Q = Quadric(np.diag([1, 1, 1, -1])) >>> S1 = Subspace([0, 1, 0, 0]).dualize() >>> S2 = Subspace([0, 0, 1, 0]).dualize() >>> intsct = intersect(Q, S1, S2) >>> isinstance(intsct, Quadric) True >>> intsct.dimension 0 >>> Point([1, 0, 0, 1]) in intsct and Point([-1, 0, 0, 1]) in intsct True .. image:: intersection.png :scale: 50 % :align: center In this example, the function ``intersect`` automatically applied the functions :py:func:`ddg.geometry.subspaces.intersect_subspaces` and :py:func:`ddg.geometry.quadrics.intersect_quadric_subspace` to reduce the intersection as much as possible. In this case, it could be fully resolved to a single ``Quadric`` object. If the intersection or join can not be fully resolved due to lack of implemented intersection functions for the given types, we instead get an :py:class:`ddg.geometry.intersection.Intersection` or :py:class:`ddg.geometry.intersection.Join` object. ``Intersection`` supports the ``in`` keyword.