v5.0
ジオメトリオブジェクトのバウンディング球のセンターおよび半径を戻します。入力変換が指定されている場合、バウンディング球が計算される前にこのメソッドが戻されます。
oArray = Geometry.GetBoundingSphere( [Type], [Transform] ); |
1D Array には4 つの値が含まれます。最初の 3 つはセンタの x、Y、Z座標値で、その後ろに球の半径値が続きます。
| パラメータ | タイプ | 詳細 |
|---|---|---|
| タイプ | siVolumeCenterMethod | バウンディング球のセンタの計算に使用します。
デフォルト値:siVolumeCenterMethodBBoxCenter |
| 変換 | SITransformation | 変換は、バウンディング球が計算される前にジオメトリに適用されます。 |
/*
Example using no input transform and default center calculation method
*/
// 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 sphere
var vba = new VBArray( oTorus.ActivePrimitive.Geometry.GetBoundingSphere() ) ;
var jsa = vba.toArray() ;
// Report the (local) center and radius
Application.LogMessage( "center:" + jsa[0] + ", " + jsa[1] + ", " + jsa[2] ) ;
Application.LogMessage( "radius:" + jsa[3] ) ;
|
/*
Example using an input transform to preserve scaling and a different center
calculation method
*/
// 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 sphere
var vba = new VBArray( oTorus.ActivePrimitive.Geometry.GetBoundingSphere( siVolumeCenterMethodCOG, oTransform) ) ;
var jsa = vba.toArray() ;
// Report the (local) center and radius
Application.LogMessage( "center:" + jsa[0] + ", " + jsa[1] + ", " + jsa[2] ) ;
Application.LogMessage( "radius:" + jsa[3] ) ;
// Build a sphere that shows the bounding volume
var oSphere = ActiveSceneRoot.AddPrimitive("Sphere" ) ;
oSphere.radius = jsa[3] ;
oSphere.PosX = jsa[0] ;
oSphere.PosY = jsa[1] ;
oSphere.PosZ = jsa[2] ;
|