# Finding the intersection points of two objects in space: inter

### 14.4.4 Finding the intersection points of two objects in space: inter

See Section 13.6.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.

- Input:

  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)

  Output:

  ⎡
  ⎢
  ⎢
  ⎣

  ⎡
  ⎢
  ⎢
  ⎣

  2
  3

  ,

  2
  3

  ,

  2
  3

  ⎤
  ⎥
  ⎥
  ⎦

  ⎤
  ⎥
  ⎥
  ⎦

- Input:

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

  Output:

  ⎡
  ⎢
  ⎢
  ⎣

  ⎡
  ⎢
  ⎢
  ⎣

  √

  3

  3

  ,

  √

  3

  3

  ,

  √

  3

  3

  ⎤
  ⎥
  ⎥
  ⎦

  ,

  ⎡
  ⎢
  ⎢
  ⎣

  −

  √

  3

  3

  ,−

  √

  3

  3

  ,−

  √

  3

  3

  ⎤
  ⎥
  ⎥
  ⎦

  ⎤
  ⎥
  ⎥
  ⎦

  To get just one of the points, use the usual list indices.
  Input:
  coordinates(LB[0])
  Output:

  ⎡
  ⎢
  ⎢
  ⎣

  √

  3

  3

  ,

  √

  3

  3

  ,

  √

  3

  3

  ⎤
  ⎥
  ⎥
  ⎦

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

  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)

  Output:

  ⎡
  ⎢
  ⎢
  ⎣

  √

  3

  3

  ,

  √

  3

  3

  ,

  √

  3

  3

  ⎤
  ⎥
  ⎥
  ⎦