We seek the point S in which a straight line
declared by 2 point A and B intersects a plane parallel to yz plane containing the point C.
Here are the point A and B:
(For details on textures see the scene file!)
// given 2 points:
#declare A = <-0.00,1.00,-2.00>;
#declare B = < 0.75,1.20,-1.50>;
// and a point on a plane || to yz :
#declare C = < 2.00,0.00,0.00>;
// Showing A and B:
sphere{ <0,0,0>, 0.075 translate A
texture{ T_YellowGreen }
}
sphere{ <0,0,0>, 0.075 translate B
texture{ T_Yellow }
}
And here is a box showing the position
of the plane x = 2:
box { <0.00, 0.00,-2.00>,< 0.025, 5.00, 3.50>
texture { pigment{ color rgb<1, 1, 1>}
finish { phong 1 }
} // end of texture
translate <C.x,0,0>
} // end of box --------------------------
Calculation of the intersection in point S:
Equations of a straigth line through A and B by the components:
[The components of a vector: A=<A.x, A.y, A.z>]
x1 = A.x + m ( B.x - A.x ) I
x2 = A.y + m ( B.y - A.y ) II
x3 = A.z + m ( B.z - A.z ) III
Here x1 = 2. (=C.x)
So: 2 = A.x + m ( B.x - A.x ) | -A.x
<=> 2 - A.x = m ( B.x - A.x ) | : (B.x - A.x )
<=> m = ( 2 - A.x )/( B.x - A.x )
#declare m = ( C.x - A.x )/( B.x - A.x );
#declare SX = C.x; // here: = 2
#declare SY = A.y + m *( B.y - A.y );
#declare SZ = A.z + m *( B.z - A.z );
#declare S = < SX, SY, SZ >;
// Show S:
sphere{ <0,0,0>, 0.1 translate S
texture{ T_Red }
}
Where a staight line hits a plane parallel to the yz plane
This scene for POV-Ray:
"Straight2Plane_1.pov" file
|