Share via


Geometry クラス

Geometry クラス

使用例

  • 境界球の生成

その他の算術関連関数。

定義

Visual Basic NotInheritable Public Class Geometry
   Inherits Object 
C# public sealed class Geometry : Object
Managed C++ public __gc __sealed class Geometry  : public Object
JScript public class Geometry extends Object

メンバ テーブル

次のテーブルは、Geometry オブジェクトによって公開されているメンバの一覧である。左側のタブをクリックし、表示したいメンバの種類を選ぶこと。

メソッド

メソッド 説明
BoxBoundProbe レイがボックスの境界ボックスのボリュームに当たるかどうかを判別する。
ComputeBoundingBox 座標軸を原点とする境界ボックスを算出する。
ComputeBoundingSphere メッシュの境界球を算出する。
DegreeToRadian 度をラジアンに変換する。
FresnelTerm Fresnel Term を算出する。
IntersectTri テクスチャ座標の勾配に基づいて頂点ごとの座標系を算出する。
RadianToDegree ラジアンを度に変換する。
SphereBoundProbe レイが境界球のボリュームに当たるかどうかを判別する。

継承の階層構造

Object

Geometry

使用例

境界球の生成

この例では、Geometry.ComputeBoundingSphere メソッドを使って、3D オブジェクトの周りに簡単な境界球を生成する方法を示す。3D グラフィックでは、境界球にはさまざまな使い方がある。たとえば、ある 3D オブジェクトが別のオブジェクトと交差するかどうかをテストするときに役に立つ。

次のサンプル コードでは、メッシュ オブジェクトの頂点データから頂点バッファを作成している。次に、新しい頂点バッファをロックし、その頂点バッファに対して Geometry アルゴリズムを計算できるようにする。ComputeBoundingSphere の出力は、メッシュ オブジェクトの中心から最も遠い端までの半径である。

using Microsoft.DirectX.Direct3D;

protected Device device; // The rendering device
device = null;
Mesh pMesh = null;
GraphicsStream adj = null;
ExtendedMaterial[] mtrl = null;
MeshFlags i32BitFlag;

float objectRadius = 0.0f; // Radius of bounding sphere of object

// Load the mesh from the specified file.
pMesh = Mesh.FromFile("tiger.x", MeshFlags.Managed, device,
                      out adj,out mtrl);
i32BitFlag = pMesh.Options.Use32Bit ? MeshFlags.Use32Bit : 0;

// Retrieve the vertex buffer data in the mesh object
VertexBuffer vb = pMesh.VertexBuffer;

// Lock the vertex buffer to generate a simple bounding sphere
GraphicsStream vertexData = vb.Lock(0, 0, LockFlags.NoSystemLock);
objectRadius = Geometry.ComputeBoundingSphere(vertexData,
                                              pMesh.NumberVertices,
                                              pMesh.VertexFormat,
                                              out objectCenter);
vb.Unlock();
vb.Dispose();

クラスの情報

名前空間 Microsoft.DirectX.Direct3D
アセンブリ Microsoft.DirectX.Direct3DX (microsoft.directx.direct3dx.dll)
厳密名 Microsoft.DirectX.Direct3DX,  Version=0293,  Culture=neutral,  PublicKeyToken=d3231b57b74a1492

© 2002 Microsoft Corporation. All rights reserved. Terms of use.