Intersections and Joins

To handle intersecting and joining an arbitrary number of geometric objects of varying type, we have the module ddg.geometry.intersection. The most important functions are intersect() (also available as meet()) and join():

>>> 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
../_images/intersection.png

In this example, the function intersect automatically applied the functions ddg.geometry.subspaces.intersect_subspaces() and 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 ddg.geometry.intersection.Intersection or ddg.geometry.intersection.Join object. Intersection supports the in keyword.