RayMeshGridIntersect インタフェース: 
            
 
            Interface: rayMeshGridIntersectOps 
  
             メソッド: 
            
 
            <void>initialize <integer>gridSize 
  
            ボクセル グリッドを指定されたグリッド サイズで初期化します。 
            
 
            グリッド サイズの値は、3 軸すべてに沿ったボクセルの数を定義します。 
            
 
            ボクセルの実際のサイズは、処理されるノードのバウンディング ボックスに依存します。 
            
 
                
            
 
            <void>addNode <node>addNode 
  
            ノード リストにノードを追加します。 
            
 
            上の注意を参照してください。リストの最初のオブジェクトのみが使用されます。 
            
 
                
            
 
             
            ボクセル グリッドにデータを入力します。 
            
 
                
            
 
             
            ボクセル グリッドからすべてのデータを削除します。 
            
 
                
            
 
            <integer>intersectBox <point3>min <point3>max 
  
            指定されたワールド空間の最小ポイント数と最大ポイント数を使用して、ボックス交差を実行します。 
            
 
                
            
 
            <integer>intersectSphere <point3>center <float>radius 
  
            指定された中心と半径を使用して、球の交差を実行します。 
            
 
                
            
 
            <integer>intersectRay <point3>p <point3>dir <boolean>doubleSided 
  
            指定された位置と方向を使用して、レイの交差を実行します。 
            
 
            doubleSided 引数が False の場合は、法線がレイに向かっている面との交差のみが収集されます。 
            
 
            True の場合、法線がレイの方向に向かっているときでも、面は両面と見なされ、交差します。 
            
 
            結果は、交差が検出されなかった場合は 0、検出された場合は交差している面の数を表す正の数です。 
            
 
                
            
 
            <integer>intersectSegment <point3>p1<point3>p2 <boolean>doubleSided 
  
            指定された 2 つのワールド位置を使用して、セグメントの交差を実行します。 
            
 
            これは intersectRay に似ていますが、ポイントと方向の代わりに、スペース内の 2 つの絶対位置を使用して交差レイが定義されます。p1 は原点、方向は p1
               から p2 です。 
            
 
            doubleSided 引数が False の場合は、法線がレイに向かっている面との交差のみが収集されます。 
            
 
            True の場合、法線がレイの方向に向かっているときでも、面は両面と見なされ、交差します。 
            
 
            結果は、交差が検出されなかった場合は 0、検出された場合はヒットしている面の数を表す正の数です。 
            
 
                
            
 
            <integer>getHitFace <integer>index 
  
            インデックスで指定されたヒットの TriMesh 面のインデックスを返します。 
            
 
            インデックスには、1 から最後の交差メソッドによってレポートされたヒット数までの正の数を指定できます。 
            
 
                
            
 
            <point3>getHitBary <integer>index 
  
            インデックスで指定されたヒットの TriMesh 面の重心座標を返します。 
            
 
            インデックスには、1 から最後の交差メソッドによってレポートされたヒット数までの正の数を指定できます。 
            
 
                
            
 
            <point3>getHitNormal <integer>index 
  
            ワールド空間内のインデックスで指定されたヒットの TriMesh 面の面法線を返します。 
            
 
            インデックスには、1 から最後の交差メソッドによってレポートされたヒット数までの正の数を指定できます。 
            
 
                
            
 
            <float>getHitDist <integer>index 
  
            インデックスで指定されたヒットまでの距離を返します。 
            
 
            インデックスには、1 から最後の交差メソッドによってレポートされたヒット数までの正の数を指定できます。 
            
 
                
            
 
            <integer>intersectSegmentDebug <point3>p1 <point3>p2 <boolean>doubleSided <integer>gridID 
  
            このメソッドはデバッグ専用です。 
            
 
                
            
 
             
            最も近いヒットのインデックスを返します。 
            
 
                
            
 
            <integer>getFarthestHit() 
  
            最も遠いヒットのインデックスを返します。 
            
 
                
            
 
            <integer>closestFace <point3>p 
  
            指定されたワールドポイントからすべての面との交差を実行し、ヒットの数を整数で返します。 
            
 
            指定されたワールド ポイントに最も近い面と最も遠い面を決定するには getClosestHit() および getFarthestHit()、すべての面までの距離を決定するには
               getHitDist()、ポイントまでの垂直距離を決定するには getPerpDist() を使用できます。 
            
 
                
            
 
            <float>getPerpDist <integer>index 
  
            インデックスで指定されたヒットまでの垂直距離を返します。 
            
 
            インデックスには、1 から最後の交差メソッドによってレポートされたヒット数までの正の数を指定できます。 
            
 
                
            
 
             
            すべての統計をクリアします。 
            
 
                
            
 
             
            面の数および実行された検索の数を含む現在の統計を出力します。 
            
 
                
            
 
            次の例では、球と天球体を作成し、球をボクセル グリッドで登録して、各天球体からレイを当て、これらのレイがヒットした球の面を選択します。 
            
 
               
                  
                     
                  
                  
                     |    例 
                          
                      | 
                  
                  
                      
                        
(
resetMaxFile #noprompt --reset the scene
theSphere = Sphere radius:40 segs:50 pos:[100,200,300] --create a sphere
theGeoSphere = Geosphere radius:100 segs:3 pos:[100,200,300] --create a geosphere
theFacesArray = #() --init. an array to collect face selection
 
rm = RayMeshGridIntersect () --create an instance of the Reference Target
rm.Initialize 10 --init. the voxel grid size to 10x10x10
rm.addNode theSphere --add the sphere to the grid
rm.buildGrid () --build the grid data (collecting faces into the grid voxels)
theGSMesh = snapshotasmesh theGeoSphere --grab the TriMesh of the Geosphere
for v = 1 to theGSMesh.numverts do --go through all verts of the Geosphere
(
thePos = getVert theGSMesh v --get the position of the vertex
theNormal = -(getNormal theGSMesh v) --get the normal of the vertex, reverse direction
theHitsCount = rm.intersectRay thePos theNormal false --intersect the ray with the sphere
if theHitsCount > 0 then --if have hit anything...
(
 theIndex = rm.getClosestHit () --get the index of the closest hit by the ray
 theFace = rm.getHitFace theIndex --get the face index corresponding to that indexed hit
 append theFacesArray theFace --add to the face array to select the face...
)
else
 format "The Ray % Missed\n" v
)
 
ms = mesh_select() --create a mesh select modifier
addModifier theSphere ms --add on top of the sphere
select theSphere --select the sphere
max modify mode --go to modify panel
setFaceSelection theSphere 1 theFacesArray --set the selection in the MeshSelect
subObjectLevel = 3 --go to face selection level
)
   
                      |