Anonymous user
Find the intersection of a line with a plane: Difference between revisions
Find the intersection of a line with a plane (view source)
Revision as of 20:19, 14 December 2020
, 3 years ago→{{header|APL}}
m (→{{header|APL}}) |
m (→{{header|APL}}) |
||
Line 23:
=={{header|APL}}==
<lang APL>⍝ Find Intersection of a line with a plane
⍝ The intersection I belongs to a line defined by point
⍝ I belongs to the plan defined by point P and normal vector N. This means that the vector IP is normal to vector N
⍝ This translates to their scalar product being zero.
⍝ (P - I).N = 0 <=> (P -
⍝ Using distributivity, then associativity, the following equations are established:
⍝ (P -
⍝ so that: t = ((P -
⍝ In APL, A.B is coded +/A x B
V ← 0 ¯1 ¯1
N ← 0 0 1
P ← 0 0 5
dot ← {+/⍺×⍵}
t ← ((P -
I ←
</lang>
{{out}}
|