Geometry Class (Microsoft.DirectX.Direct3D)

Contains miscellaneous math-related functions.


Visual Basic NotInheritable MustInherit Public Class Geometry
    Inherits ObjectLeave Site
C# public abstract sealed class Geometry : ObjectLeave Site
C++ public ref class Geometry abstract sealed : ObjectLeave Site
JScript public final abstract class Geometry extends ObjectLeave Site

Members Table

The following table lists the members exposed by the object.


Method Description
static (Shared in Visual Basic) BoxBoundProbe Determines whether a ray intersects the volume of a bounding box.
static (Shared in Visual Basic) ComputeBoundingBox Computes a coordinate axis-oriented bounding box.
static (Shared in Visual Basic) ComputeBoundingSphere Computes a bounding sphere for a mesh.
static (Shared in Visual Basic) ComputeTangentFrame Performs tangent frame computations on a mesh. Tangent, binormal, and optionally normal vectors are generated. Singularities are handled as required by grouping edges and splitting vertices.
static (Shared in Visual Basic) DegreeToRadian Converts degrees to radians.
static (Shared in Visual Basic) FresnelTerm Calculates the Fresnel term.
static (Shared in Visual Basic) IntersectTri Computes the intersection of a ray and a triangle.
static (Shared in Visual Basic) OptimizeFaces Optimizes a set of faces.
static (Shared in Visual Basic) OptimizeVertices Optimizes a set of vertices.
static (Shared in Visual Basic) RadianToDegree Converts radians to degrees.
static (Shared in Visual Basic) SphereBoundProbe Determines whether a ray intersects the volume of a sphere's bounding box.

Inheritance Hierarchy

ObjectLeave Site

How Do I...?

Compute a Bounding Sphere from a Mesh

This example shows how to generate a simple bounding sphere around a 3-D object, using the Geometry.ComputeBoundingSphere method. A bounding sphere has many possible uses in 3-D graphics; for example, to help test whether one 3-D object intersects with another.

In the following C# code example, a vertex buffer is created from the vertex data of the mesh object. The new vertex buffer is then locked so that Geometry algorithms can be computed on it. The output of the ComputeBoundingSphere is the radius from the center to the farthest extremity of the mesh object. The mesh object is assumed to be a valid mesh loaded with Mesh.FromFile.

float objectRadius = 0.0f;
Vector3 objectCenter = new Vector3();

using (VertexBuffer vb = Mesh.VertexBuffer)
    GraphicsStream vertexData = vb.Lock(0, 0, LockFlags.None);
    objectRadius = Geometry.ComputeBoundingSphere(vertexData,
                                                  out objectCenter);

Class Information

Namespace Microsoft.DirectX.Direct3D
Assembly Microsoft.DirectX.Direct3DX (microsoft.directx.direct3dx.dll)
Strong Name Microsoft.DirectX.Direct3DX,  Version=1.0.900.0,  Culture=neutral,  PublicKeyToken=d3231b57b74a1492