Finding the intersection points of two objects in space

### 27.3.4 Finding the intersection points of two objects in space

See Section 26.5.7 for points of intersection of objects in the plane.

The inter command finds the intersection of two geometric objects in ℝ3.

- inter takes two mandatory arguments and one optional argument.
  - obj1, obj2, two geometric objects.
  - Optionally, P, a point.
  inter(obj1,obj2 ⟨,P⟩) returns a list of points of intersection of obj1 and obj2 or the curve of intersection of the two objects.

  With the argument P, the command returns the point of intersection closest to P.

#### Examples

LA:=inter(plane(point(0,1,1),point(1,0,1),point(1,1,0)),line(point(0,0,0),point(1,1,1))):; coordinates(LA)

| ⎡ ⎢ ⎢ ⎣ | ⎡ ⎢ ⎢ ⎣ |
2
3
| , |
2
3
| , |
2
3
| ⎤ ⎥ ⎥ ⎦ | ⎤ ⎥ ⎥ ⎦

LB:=inter(sphere(point(0,0,0),1),line(point(0,0,0),point(1,1,1))):; coordinates(LB)

| ⎡ ⎢ ⎢ ⎣ | ⎡ ⎢ ⎢ ⎣ |
√ |
3
3
| , |
√ |
3
3
| , |
√ |
3
3
| ⎤ ⎥ ⎥ ⎦ | , | ⎡ ⎢ ⎢ ⎣ | − |
√ |
3
3
| ,− |
√ |
3
3
| ,− |
√ |
3
3
| ⎤ ⎥ ⎥ ⎦ | ⎤ ⎥ ⎥ ⎦

To get just one of the points, use the usual list indices.

coordinates(LB[0])

| ⎡ ⎢ ⎢ ⎣ |
√ |
3
3
| , |
√ |
3
3
| , |
√ |
3
3
| ⎤ ⎥ ⎥ ⎦

To get the point closest to (1/2,1/2,1/2):

LB1:=inter(sphere(point(0,0,0),1),line(point(0,0,0),point(1,1,1)),point(1/2,1/2,1/2)):; coordinates(LB1)

| ⎡ ⎢ ⎢ ⎣ |
√ |
3
3
| , |
√ |
3
3
| , |
√ |
3
3
| ⎤ ⎥ ⎥ ⎦