LYGIA Shader Library

lengthSq (lygia/math/quat/lengthSq)

Returns the squared length of a quaternion.

Dependencies:

Use:

<QUAT> quatLengthSq(<QUAT> q)

Check it on Github



#ifndef FNC_QUATLENGTHSQ
#define FNC_QUATLENGTHSQ
float quatLengthSq(QUAT q) { return dot(q.xyz, q.xyz) + q.w * q.w; }
#endif

Dependencies:

Use:

<QUAT> quatLengthSq(<QUAT> q)

Check it on Github



#ifndef FNC_QUATLENGTHSQ
#define FNC_QUATLENGTHSQ
float quatLengthSq(QUAT q) { return dot(q.xyz, q.xyz) + q.w * q.w; }
#endif

Use:

<QUAT> quatLengthSq(<QUAT> q)

Check it on Github


fn quatLengthSq(q: vec4f) -> f32 { return dot(q.xyz, q.xyz) + q.w * q.w; }

License

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.

Get the latest news and releases

Sign up for the news letter bellow, joing the LYGIA's channel on Discord or follow the Github repository