three points of a plane, two points of a line
a number -> parallelism -> distance line plane a vertex -> intersection -> point of intersection
| |
|
|
| |
Implementation
01 function intersect_lineplane( va, vb, vc, ua, ub )
02 dim u: u = vector_create( vb, va )
03 dim v: v = vector_create( vc, va )
04 dim n: n = vector_normalize( vector_cross( u, v ) )
05 dim w: w = vector_normalize( vector_create( ua, ub ) )
06 dim y: y = vector_create( ua, va )
07 dim p: p = vector_dot( n, w )
08 dim q: q = vector_dot( n, y )
09 if( abs( p ) <= NUMBER_ZERO ) then
10 intersect_lineplane = vertex_length( ua, vertex_flatten( va, vb, vc, ua ) )
11 else
12 intersect_lineplane = vertex_translate( ua, vector_scale( w, q / p ) )
13 end if
14 end function
|
|
| |
|
|
|