Microsoft DirectX 8.1 (Visual Basic)

D3DXVec3BaryCentric

Returns a point in Barycentric coordinates, using the specified 3-D vectors.

D3DXVec3BaryCentric( _ 
    VOut As D3DVECTOR, _ 
    V1 As D3DVECTOR, _ 
    V2 As D3DVECTOR, _ 
    V3 As D3DVECTOR, _ 
    f As Single, _ 
    g As Single)

Parameters

VOut
D3DVECTOR type that is the result of the operation, a vector in Barycentric coordinates.
V1
A source D3DVECTOR type.
V2
A source D3DVECTOR type.
V3
A source D3DVECTOR type.
f
Weighting factor. See Remarks.
g
Weighting factor. See Remarks.

Error Codes

If the function fails, an error is raised and Err.Number can be set to one of the following values.

D3DERR_INVALIDCALL
D3DERR_OUTOFVIDEOMEMORY

For information on trapping errors, see the Microsoft® Visual Basic® Error Handling topic.

Remarks

The D3DXVec3BaryCentric function provides a way to understand points in and around a triangle, independent of where the triangle is actually located. This function returns the resulting point by using the following equation: V1 + f(V2-V1) + g(V3-V1).

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

Note the following relations.

Barycentric coordinates are a form of general coordinates. In this context, using Barycentric coordinates simply represents a change in coordinate systems; what holds true for Cartesian coordinates holds true for Barycentric coordinates.