v5.0
ジオメトリオブジェクトのバウンディングボックスのセンターおよび範囲を戻します。入力変換が指定されている場合、バウンディングボックスが計算される前にこのメソッドが戻されます。
Object Geometry.GetBoundingBox( Object in_pXfoObjectToBBoxSpace ); |
oArray = Geometry.GetBoundingBox( [Transform] ); |
1D Array には6 つの値が含まれます。最初の 3 つはセンタの x、Y、Z座標値で、その後ろにバウンディングボックスのローカルX、Y、Z 軸方向の範囲値が続きます。
| パラメータ | タイプ | 説明 |
|---|---|---|
| Transform | SITransformation | 変換は、バウンディングボックスが計算される前にジオメトリに適用されます。 |
/* 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.ActivePrimitive.Geometry.GetBoundingBox() ) ; var jsa = vba.toArray() ; // Report the (local) center and extents Application.LogMessage( "center:" + jsa[0] + ", " + jsa[1] + ", " + jsa[2] ) ; Application.LogMessage( "extents:" + 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.ActivePrimitive.Geometry.GetBoundingBox(oTransform) ) ;
var jsa = vba.toArray() ;
// Report the (local) center and extents
Application.LogMessage( "center:" + jsa[0] + ", " + jsa[1] + ", " + jsa[2] ) ;
Application.LogMessage( "extents:" + 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] ;
oCube.PosY = jsa[1] ;
oCube.PosZ = jsa[2] ;
oCube.sclx = jsa[3] ;
oCube.scly = jsa[4] ;
oCube.sclz = jsa[5] ; |