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 05:21, 15 April 2018
, 6 years ago→{{header|J}}: formatting
(→{{header|J}}: Add J) |
(→{{header|J}}: formatting) |
||
Line 185:
=={{header|J}}==
'''Solution:'''
<lang j>mp=: +/ .* NB. matrix product
p=: mp&{: %~ -&{. mp {:@] NB. solve
intersectLinePlane=: {.@[ - {:@[ * p NB. substitute</lang>
'''Example Usage:'''
<lang j> Line=: 0 0 10 ,: 0 _1 _1 NB. Point, Ray
Line 193:
Line intersectLinePlane Plane
0 _5 5</lang>
=={{header|Java}}==
{{trans|Kotlin}}
|