Previous Up Next

12.4.3  Find an intersection point of two objects in space: single_inter line_inter

See section 11.6.5 for single points of intersection of objects in the plane.

The single_inter (or the line_inter) command takes two geometric objects as arguments and returns one of the points of intersection of the two objects.

The single_inter command optionally takes a third argument, which can be a point or a list of points. If the optional argument is a single point, then single_inter returns the point of intersection closest to the optional argument. If the optional argument is a list of points, then single_inter tries to return a point of intersection not in the list.

Input:

A := single_inter(plane(point(0,1,1),point(1,0,1),point(1,1,0)),
line(point(0,0,0),point(1,1,1)))

then:

coordinates(A)

Output:

[2/3,2/3,2/3]

Input:

B := single_inter(sphere(point(0,0,0),1),
line(point(0,0,0),point(1,1,1)))

then:

coordinates(B)

Output:

[1/sqrt(3), 1/sqrt(3), 1/sqrt(3)]

Input:

B1 := single_inter(sphere(point(0,0,0),1),
line(point(0,0,0),point(1,1,1)), point(-1,0,0))

then:

coordinates(B1)

Output:

[-1/sqrt(3), -1/sqrt(3), -1/sqrt(3)]

Input:

C := single_inter(sphere(point(0,0,0),1),
line(point(1,0,0),point(1,1,1)))

then:

coordinates(C)

Output:

[1,0,0]

Input:

C1 := single_inter(sphere(point(0,0,0),1),
line(point(1,0,0),point(1,1,1)),[point(1,0,0)])

then:

coordinates(C1)

Output:

[1/3,2/3,2/3]

Previous Up Next