Find the intersection of a line with a plane: Difference between revisions
Content deleted Content added
→{{header|J}}: formatting |
→{{header|J}}: simplify |
||
Line 185: | Line 185: | ||
=={{header|J}}== |
=={{header|J}}== |
||
'''Solution:''' |
'''Solution:''' |
||
<lang j>mp=: +/ .* |
<lang j>mp=: +/ .* NB. matrix product |
||
p=: mp&{: %~ -&{. mp {:@] |
p=: mp&{: %~ -~&{. mp {:@] NB. solve |
||
intersectLinePlane=: |
intersectLinePlane=: [ +/@:* 1 , p NB. substitute</lang> |
||
'''Example Usage:''' |
'''Example Usage:''' |
||
<lang j> Line=: 0 0 10 ,: 0 _1 _1 NB. Point, Ray |
<lang j> Line=: 0 0 10 ,: 0 _1 _1 NB. Point, Ray |