Design Scripting Documentation
     
 
     
  Intersection between planes  
     
     
  Inputs:  
     
two pairs of three points that define the planes
     
  Outputs:  
     
an array of a vertex, vector pair of the intersection line
     
  Implementation
01  function intersect_planeplane( pa, pb, pc, qa, qb, qc )
02    dim pn: pn = vector_normal( pa, pb, pc )
03    dim qn: qn = vector_normal( qa, qb, qc )
04  
05    dim dot: dot = vector_dot( pn, qn )
06    if( dot = 1.0 ) then
07      intersect_planeplane = vbnull
08      exit function
09    end if
10  
11    dim dp: dp = vector_dot( pa, pn )
12    dim dq: dq = vector_dot( qa, qn )
13  
14    dim dpn: dpn = vector_dot( pn, pn )
15    dim dqn: dqn = vector_dot( qn, qn )
16  
17    dim det: det = dpn * dqn - dot * dot
18  
19    if( det = 0.0 ) then
20      intersect_planeplane = vbnull
21      exit function
22    end if
23  
24    dim co: co = ( dp * dqn - dq * dot ) / det
25    dim ci: ci = ( dq * dpn - dp * dot ) / det
26  
27    intersect_planeplane = array(                    _
28      vertex_new(                                    _
29        co * pn( VERTEX_X ) + ci * qn( VERTEX_X ),   _
30        co * pn( VERTEX_Y ) + ci * qn( VERTEX_Y ),   _
31        co * pn( VERTEX_Z ) + ci * qn( VERTEX_Z ) ), _
32      vector_cross( pn, qn ) )
33  end function
 
     

Creative Commons License
The Design Scripting Library, including its sources, online documentation and graphics, are licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License.

Online Documentation generated by { vbdoclib } version 1.0
Color-Coding generated by { vbcc } version 2.0
Page timestamp: { Feb. 2, 2006 }





 
     
     
 
Documentation
Cover Page
Expand
Collapse
 
Array
 
Bitmap File
 
Bounding Box
 
Color
 
Container
 
Doclet
 
Ellipse
 
Intersection
 
Language
 
Map
 
Matrix
 
Number
 
Nurbs
 
Range
 
STL File
 
Streams
 
String
 
Surface
 
Text File
 
Triangle
 
Vector
 
Vertex
 
Wave File