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

Content deleted Content added
Robbie (talk | contribs)
Tikkanz (talk | contribs)
Line 183: Line 183:




=={{header|J}}==
'''Solution:'''
<lang j>mp=: +/ .* NB. matrix product
p=: mp&{: %~ -&{. mp {:@] NB. solve
intersectLinePlane=: {.@[ - {:@[ * p</lang>
'''Example Usage:'''
<lang j> Line=: 0 0 10 ,: 0 _1 _1 NB. Point, Ray
Plane=: 0 0 5 ,: 0 0 1 NB. Point, Normal
Line intersectLinePlane Plane
0 _5 5</lang>
=={{header|Java}}==
=={{header|Java}}==
{{trans|Kotlin}}
{{trans|Kotlin}}