dot.3Cg

Langue: en

Version: 355880 (ubuntu - 24/10/10)

Section: 3 (Bibliothèques de fonctions)

NAME

dot - returns the scalar dot product of two vectors

SYNOPSIS

   float  dot(float  a, float  b);
   float1 dot(float1 a, float1 b);
   float2 dot(float2 a, float2 b);
   float3 dot(float3 a, float3 b);
   float4 dot(float4 a, float4 b);
 
 
 
   half   dot(half  a, half  b);
   half1  dot(half1 a, half1 b);
   half2  dot(half2 a, half2 b);
   half3  dot(half3 a, half3 b);
   half4  dot(half4 a, half4 b);
 
 
 
   fixed  dot(fixed  a, fixed  b);
   fixed1 dot(fixed1 a, fixed1 b);
   fixed2 dot(fixed2 a, fixed2 b);
   fixed3 dot(fixed3 a, fixed3 b);
   fixed4 dot(fixed4 a, fixed4 b);
 
 
 

PARAMETERS


a
First vector.
b
Second vector.

DESCRIPTION

Returns the scalar dot product of two same-typed vectors a and b.

REFERENCE IMPLEMENTATION

dot for float4 vectors could be implemented this way:
   float dot(float4 a, float4 b)
   {
     return a.x*b.x + a.y*b.y + a.z*b.z + a.w*b.w;
   }
 
 
 

PROFILE SUPPORT

dot is supported in all profiles.

The fixed3 dot product is very efficient in the fp20 and fp30 profiles.

The float3 and float4 dot products are very efficient in the vp20, vp30, vp40, arbvp1, fp30, fp40, and arbfp1 profiles.

The float2 dot product is very efficient in the fp40 profile. In optimal circumstances, two two-component dot products can sometimes be performed at the four-component and three-component dot product rate.

SEE ALSO

cross, lit, mul