SampleCollection.Navigate

導入

v3.0

詳細

ジオメトリのサンプル間を移動できます。このメソッドは、コレクション内のコンポーネントごとに対応する Sample を戻します。たとえば、5 つのメンバを持つSampleCollectionがあり、方向が siLastComponent に設定されている状態でこのメソッドを呼び出すと、元の SampleCollection のうち、最終サンプルの 5 つのインスタンスを含むコレクションが戻されます。

C#構文

SampleCollection SampleCollection.Navigate( siNavigateComponentType in_siNavigate );

スクリプト構文

oReturn = SampleCollection.Navigate( Navigation );

戻り値

SampleCollection

パラメータ

パラメータ タイプ 説明
Navigation siNavigateComponentType 移動方向を選択します。

JScript の例

var obj = ActiveSceneRoot.AddGeometry( "Cube", "MeshSurface" );

var samplelist = obj.ActivePrimitive.Geometry.Facets(2).Samples;

var results = "";

var fs = new Enumerator( samplelist.Navigate(siFirstComponent) );

for ( ; ! fs.atEnd(); fs.moveNext() ) {

	var firstsample = fs.item();

	results += firstsample.Index + " ";

}

LogMessage( "The associated first samples are " + results );

results = "";

var ls = new Enumerator( samplelist.Navigate(siLastComponent) );

for ( ; ! ls.atEnd(); ls.moveNext() ) {

	var lastsample = ls.item();

	results += lastsample.Index + " ";

}

LogMessage( "The associated last samples are " + results );

results = "";

var ns = new Enumerator( samplelist.Navigate(siNextComponent) );

for ( ; ! ns.atEnd(); ns.moveNext() ) {

	var nextsample = ns.item();

	results += nextsample.Index + " ";

}

LogMessage( "The associated next samples are " + results );

results = "";

var ps = new Enumerator( samplelist.Navigate(siPreviousComponent) );

for ( ; ! ps.atEnd(); ps.moveNext() ) {

	var prevsample = ps.item();

	results += prevsample.Index + " ";

}

LogMessage( "The associated previous samples are " + results );

// Expected results:

//INFO : The associated first samples are 0 0 0 0 

//INFO : The associated last samples are 23 23 23 23 

//INFO : The associated next samples are 9 10 11 12 

//INFO : The associated previous samples are 7 8 9 10

関連項目

Sample.Navigate Geometry.Samples