Microsoft DirectX 9.0 SDK Update (October 2004)

UnsafeNativeMethods.Vector4.BaryCentric Method

Language:

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

Returns a point in barycentric coordinates, using the specified 4-D vectors.

Note: For programming in Microsoft® Visual Basic® .NET or Microsoft® JScript® .NET, use the equivalent method in the Microsoft.DirectX structures.

Definition

Visual Basic .NET Public Shared Function BaryCentric( _
    ByVal pOut As Vector4, _
    ByVal pV1 As Vector4, _
    ByVal pV2 As Vector4, _
    ByVal pV3 As Vector4, _
    ByVal f As Single, _
    ByVal g As Single _
) As Vector4
C# public static Vector4 BaryCentric(
    Vector4 pOut,
    Vector4 pV1,
    Vector4 pV2,
    Vector4 pV3,
    float f,
    float g
);
Managed C++ public: static Vector4 BaryCentric(
    Vector4 pOut,
    Vector4 pV1,
    Vector4 pV2,
    Vector4 pV3,
    float f,
    float g
);
JScript .NET public static function BaryCentric(
    pOut : Vector4,
    pV1 : Vector4,
    pV2 : Vector4,
    pV3 : Vector4,
    f : float,
    g : float
) : Vector4;

Parameters

pOut Microsoft.DirectX.Vector4. A Vector4 structure in barycentric coordinates.
pV1 Microsoft.DirectX.Vector4. Source Vector4 structure.
pV2 Microsoft.DirectX.Vector4. Source Vector4 structure.
pV3 Microsoft.DirectX.Vector4. Source Vector4 structure.
f System.Single. Weighting factor. See Remarks.
g System.Single. Weighting factor. See Remarks.

Return Value

Microsoft.DirectX.Vector4 . A Vector4 structure in barycentric coordinates.

Remarks

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

pV1 + f(pV2 - pV1) + g(pV3 - pV1)

Any point in the plane pV1pV2pV3 can be represented by the barycentric coordinates (f, g). The f parameter controls the extent to which pV2 gets weighted into the result, and the f parameter controls the extent to which pV3 gets weighted into the result. Lastly, (1 - f - g) controls the extent to which pV1 gets weighted into the result.

Note the following relations.

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 holds true for barycentric coordinates.

The return value for this method is the same value returned in the pOut parameter. Resultantly, the BaryCentric method can be used as a parameter for another method.

See Also


© 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