MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/Imath / vec4_example

Function vec4_example

website/examples/Vec4.cpp:4–21  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2#include <cassert>
3
4void
5vec4_example ()
6{
7 Imath::V4f a (1.0f, 2.0f, 3.0f, 4.0f);
8 Imath::V4f b; // b is uninitialized
9
10 b.x = a[0];
11 b.y = a[1];
12 b.z = a[2];
13 b.w = a[3];
14
15 assert (a == b);
16
17 assert (a.length () == sqrt (a ^ a));
18
19 a.normalize ();
20 assert (Imath::equalWithAbsError (a.length (), 1.0f, 1e-6f));
21}

Callers 1

mainFunction · 0.85

Calls 2

sqrtFunction · 0.85
equalWithAbsErrorFunction · 0.50

Tested by

no test coverage detected