Intersections and Joins
The most important functions are intersect() (also available as meet()) and join():
>>> 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
In this example, the function ddg.geometry.intersect() automatically applied
the functions ddg.geometry._subspaces.intersect_subspaces() and
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 ddg.geometry.Intersection or ddg.geometry.Join object. Intersection supports the in keyword.