v10.0 (2012)
 X3DObject の可視バウンディングの最小および最大座標を戻します。入力変換が指定されている場合、バウンディングボックスの計算時に適用されます。指定されていない場合、オブジェクトのローカル座標空間にあるバウンディングボックスが戻されます。
バウンディングボックスが未定義の場合、最大座標よりも大きな最小座標が戻されます。この状況は、オブジェクトが非表示の場合、またはオブジェクトにジオメトリがない場合に発生します。
注: バウンディングボックスが未定義かどうかを判断する場合、テストが必要な座標は 1 つだけです。(最小 X > 最大 X)
| Object X3DObject.GetBoundingBox( Object in_pXfoObjectToBBoxSpace, Boolean in_bRecursive ); | 
| oArray = X3DObject.GetBoundingBox( [Transform], [Recursive] ); | 
6 個の値(バウンディングボックスの最小 X、Y、Z 座標と最大 X、Y、Z 座標)を含む 1D Array。
| パラメータ | タイプ | 説明 | 
|---|---|---|
| Transform | SITransformation | バウンディングボックスの計算時に適用される変換 | 
| Recursive | Boolean | True の場合は子が含まれ、False の場合は X3DObject のみの入力用バウンディングボックスを戻します。 デフォルト値: False | 
| /* Example using no input transform */ // Create and move (rotate and translate) a torus NewScene( null, false ) ; var oTorus = ActiveSceneRoot.AddGeometry( "Torus", "MeshSurface" ) ; SelectObj( oTorus ) ; Rotate(null, 45, 0, 0, siAbsolute, siPivot, siObj, siX, null, null, null, null, null, null, null, 0, null) ; Translate(null, 3, 2, 1, siAbsolute, siPivot, siObj, siX, null, null, null, null, null, null, null, null, null, 0, null) ; // Find the bounding box var vba = new VBArray( oTorus.GetBoundingBox() ) ; var jsa = vba.toArray() ; // Report the (local) min and max Application.LogMessage( "min:" + jsa[0] + ", " + jsa[1] + ", " + jsa[2] ) ; Application.LogMessage( "max:" + jsa[3] + ", " + jsa[4] + ", " + jsa[5] ) ; | 
| // Example using an input transform to preserve scaling
//
// Create and move (rotate and translate) a torus
NewScene( null, false ) ;
var oTorus = ActiveSceneRoot.AddGeometry( "Torus", "MeshSurface" ) ;
SelectObj( oTorus ) ;
Scale(null, 0.5, 0.5, 1, siAbsolute, siGlobal, siObj, siY, null, null, null, null, null, null, null, 0, null) ;
oTransform = oTorus.Kinematics.Local.Transform ;
// Find the bounding box
var vba = new VBArray( oTorus.GetBoundingBox(oTransform) ) ;
var jsa = vba.toArray() ;
// Report the min and max
Application.LogMessage( "min:" + jsa[0] + ", " + jsa[1] + ", " + jsa[2] ) ;
Application.LogMessage( "max:" + jsa[3] + ", " + jsa[4] + ", " + jsa[5] ) ;
// Build a cube that shows the bounding box
var oCube = ActiveSceneRoot.AddPrimitive("Cube") ;
oCube.length = 1 ;
oCube.PosX = (jsa[0]+jsa[3])/2 ;
oCube.PosY = (jsa[1]+jsa[4])/2 ;
oCube.PosZ = (jsa[2]+jsa[5])/2 ;
oCube.sclx = jsa[3]-jsa[0] ;
oCube.scly = jsa[4]-jsa[1] ;
oCube.sclz = jsa[5]-jsa[2] ; |