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

Function vec2_example

website/examples/Vec2.cpp:4–19  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

mainFunction · 0.85

Calls 2

sqrtFunction · 0.85
equalWithAbsErrorFunction · 0.50

Tested by

no test coverage detected