Ray and Object Intersections: Plane by Otto Wilke otto_wilke@hotmail.comI am vaguely aware that graphics is normally done with vector operations, genericsolids positioned at the origin, and transformation matrices to move rays to and fro.I thought it would be interesting to use rectangular coordinates and objects locatedanywhere in space and oriented in any direction.This is one of four files covering the plane, the sphere, the cylinder, and the cone. INTERSECTION OF A LINE AND A PLANEThe general equation of a plane isA*x+B*y+C*z+D=0;After division by D, and redefining A, B, and CA*x+B*y+C*z+1=0;Any three points define a plane. Using the points (1,5,-4), (1,1,-2), and (8,1,-2), solvethree simultaneous equations for A, B, and C.solve({A+5*B-4*C+1=0,A+B-2*C+1=0,8*A+B-2*C+1=0},{A,B,C});For the three points,y/3+2*z/3+1=0;or,y+2*z+3=0;If a line L with direction numbers A, B, and C is normal to a plane P, then P has the formA*x+B*y+C*z+D=0;Any multiple of 0*x+1*y+2*x+3=0 would give the A, B, C, and D for a line perpendicular to the plane above.If P1(x1,y1,z1) and P2(x2,y2,z2) are two points on a line L, then A=(x2-x1), B=(y2-y1), and C=(z2-z1) aredirection numbers of L. The line L on the point P1 and with direction numbers A, B, and C has parametric equationsx = x1 + A*t; y=y1+B*t;z=z1+C*t;If P1(x1,y1,z1) and P2(x2,y2,z2) are two points on a line L, not necessarily perpendicular to a particular plane P, then a=(x2-x1), b=(y2-y1), and c=(z2-z1) aredirection numbers of L. The line L on the point P1 and with direction numbers a, b, and c has parametric equationsx = x1 + a*t; y=y1+b*t;z=z1+c*t;To find the intersection of a line and a plane, solve the simultaneous equations for x, y, z, and t.A*x+B*y+C*z+D=0;x = x1 + a*t; y=y1+b*t;z=z1+c*t;solve({x = x1 + a*t, y=y1+b*t,z=z1+c*t,A*x+B*y+C*z+D=0},{x,y,z,t});For the plane above, and a line through the origin and having direction numbers (1, -1, 2)solve({x=0+1*t , y=0-1*t , z=0+2*t , y+2*z+3=0},{x,y,z,t});with(plots):plot1:=implicitplot3d(y+2*z+3=0,x=-3..3,y=-3..3,z=-3..3):plot2 := arrow(<0,0,0>, <-1,1,-2>, difference, color=red):display({plot1,plot2});