Find the intersection of a line with a plane: Difference between revisions

Add Factor
(Add Factor)
Line 295:
{{out}}
<pre>The ray intersects the plane at (0.00, -5.00, 5.00)</pre>
 
=={{header|Factor}}==
{{trans|11l}}
<lang factor>USING: io locals math.vectors prettyprint ;
 
:: intersection-point ( rdir rpt pnorm ppt -- loc )
rpt rdir pnorm rpt ppt v- v. v*n rdir pnorm v. v/n v- ;
 
"The ray intersects the plane at " write
{ 0 -1 -1 } { 0 0 10 } { 0 0 1 } { 0 0 5 } intersection-point .</lang>
{{out}}
<pre>
The ray intersects the plane at { 0 -5 5 }
</pre>
 
=={{header|FreeBASIC}}==
1,808

edits