lygia
/math
/dot
)this file contains the definition of the dot function for float2, float3, and float4 types, to match GLSL's behavior.
Dependencies:
Use:
<float|int|uint> dot(<float2|int2|uint2|float3|int3|uint3|float4|int4|uint4> a, <float2|int2|uint2|float3|int3|uint3|float4|int4|uint4> b);
#ifndef FNC_DOT
#define FNC_DOT
inline __host__ __device__ float dot(float2 a, float2 b) { return a.x * b.x + a.y * b.y; }
inline __host__ __device__ float dot(float3 a, float3 b) { return a.x * b.x + a.y * b.y + a.z * b.z; }
inline __host__ __device__ float dot(float4 a, float4 b) { return a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w; }
inline __host__ __device__ int dot(int2 a, int2 b) { return a.x * b.x + a.y * b.y; }
inline __host__ __device__ int dot(int3 a, int3 b) { return a.x * b.x + a.y * b.y + a.z * b.z; }
inline __host__ __device__ int dot(int4 a, int4 b) { return a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w; }
inline __host__ __device__ uint dot(uint2 a, uint2 b) { return a.x * b.x + a.y * b.y; }
inline __host__ __device__ uint dot(uint3 a, uint3 b) { return a.x * b.x + a.y * b.y + a.z * b.z; }
inline __host__ __device__ uint dot(uint4 a, uint4 b) { return a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w; }
#endif
LYGIA is dual-licensed under the Prosperity License and the Patron License for sponsors and contributors.
Sponsors and contributors are automatically added to the Patron License and they can ignore the any non-commercial rule of the Prosperity Licensed software (please take a look to the exception).
It's also possible to get a permanent comercial license hook to a single and specific version of LYGIA.
Sign up for the news letter bellow, joing the LYGIA's channel on Discord or follow the Github repository