Ask Your Question

Intersection of a line and a plane

asked 2013-02-26 17:03:37 -0500

assadabbasi gravatar image

updated 2013-02-26 17:04:35 -0500


I have a line described by points (1, 0, 1), (4, -2, 2) and a plane x + y + z = 6. If solve by hand I get the point of intersection as (7, -4, 3). But in sage, I don't find any intersection point. My code in sage is as follows:

P = Polyhedron(eqns=[(-6,1,1,1)])

L = [[1, 0, 1], [4, -2, 2]]

L1 = Polyhedron(L)

intersect = L1.intersection(P)

Output is "The empty polyhedron in QQ^3". Whats wrong here? my calculation by hand or my code?

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2013-02-26 20:48:16 -0500

twch gravatar image

The Problem is that the way you define your line above, you only get the line segment between the two indicated points. The intersection points lies however on the line outside of this segment. So try this instead to see the difference:

P = Polyhedron(eqns=[(-6,1,1,1)])
L1 = Polyhedron([[1, 0, 1], [4, -2, 2]])
L2 = Polyhedron(vertices=[[1,0,1]], rays=[[3,-2,1],[-3,2,-1]])
print L1.intersection(P)
print L2.intersection(P).vertices()

By the way: Is there an easier way of defining a complete line as a Polyhedron?

edit flag offensive delete link more

answered 2013-02-27 11:35:29 -0500

assadabbasi gravatar image

Thanks for the explanation but how do we get rays=[[3,-2,1],[-3,2,-1]] ???

edit flag offensive delete link more


Well its just the vector connecting your two points. You have to take both directions (plus and minus) of this vector to generate the full line.

twch gravatar imagetwch ( 2013-02-27 22:03:28 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2013-02-26 17:03:37 -0500

Seen: 614 times

Last updated: Feb 27 '13