Name

cross - returns the cross product of two three-component vectors

Synopsis

float3 cross(float3 a, float3 b);

half3  cross(half3 a, half3 b);

fixed3 cross(fixed3 a, fixed3 b);

Parameters

a
Three-component vector.
b
Three-component vector.

Description

Returns the cross product of three-component vectors a and b. The result is a three-component vector.

Reference Implementation

cross for float3 vectors could be implemented this way:

float3 cross(float3 a, float3 b)
{
  return a.yzx * b.zxy - a.zxy * b.yzx;
}

Profile Support

cross is supported in all profiles.

Support in the fp20 is limited.

See Also

dot