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