Microsoft DirectX 9.0 SDK Update (October 2004)

Mesh.IntersectSubset Method

Language:

Note: This documentation is preliminary and is subject to change.

Intersects the specified ray with a given mesh subset.

Definition

Visual Basic .NET Public Function IntersectSubset( _
    ByVal attributeId As Integer, _
    ByVal rayPos As Vector3, _
    ByVal rayDir As Vector3, _
    ByRef closestHit As IntersectInformation, _
    ByRef allHits As IntersectInformation _
) As Boolean
C# public bool IntersectSubset(
    int attributeId,
    Vector3 rayPos,
    Vector3 rayDir,
    out IntersectInformation closestHit,
    out IntersectInformation allHits
);
Managed C++ public: bool IntersectSubset(
    int attributeId,
    Vector3 rayPos,
    Vector3 rayDir,
    IntersectInformation *closestHit,
    IntersectInformation *allHits
);
JScript .NET public function IntersectSubset(
    attributeId : int,
    rayPos : Vector3,
    rayDir : Vector3,
    closestHit : IntersectInformation,
    allHits : IntersectInformation
) : boolean;

Parameters

attributeId System.Int32. Attribute identifier of the subset to intersect with.
rayPos Microsoft.DirectX.Vector3. A Vector3 structure that specifies the origin coordinate of the ray.
rayDir Microsoft.DirectX.Vector3. A Vector3 structure that specifies the direction of the ray.
closestHit Microsoft.DirectX.Direct3D.IntersectInformation. An IntersectInformation object that describes the closest intersection between the array and the mesh.
allHits Microsoft.DirectX.Direct3D.IntersectInformation[]. Array of IntersectInformation structures that describe all intersections of the ray and the mesh.

Return Value

System.Boolean . Value that is true if the ray intersects a triangular face on the mesh; otherwise, the value is false.

Remarks

This method provides functionality that is similar to that of Intersect.

The IntersectSubset method provides a way to understand points in and around a triangle, independent of where the triangle is actually located. This method returns the resulting point by using the following equation:

V1 + U(V2-V1) + V(V3-V1)

Any point in the plane V1V2V3 can be represented by the barycentric coordinate (U,V). The U parameter controls how much V2 gets weighted into the result, and the V parameter controls how much V3 gets weighted into the result. Lastly, 1-U-V controls how much V1 gets weighted into the result.

Barycentric coordinates are a form of general coordinates. In this context, using them represents a change in coordinate systems. What holds true for Cartesian coordinates also holds true for barycentric coordinates.

Exceptions
InvalidCallException The method call is invalid. For example, a method's parameter might contain an invalid value.
OutOfMemoryException Leave Site Microsoft® Direct3D® could not allocate sufficient memory to complete the call.


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

Feedback? Please provide us with your comments on this topic.
For more help, visit the DirectX Developer Center