source: libcfa/src/vector.hfa @ 8bbdfdd

arm-ehenumforall-pointer-decayjacob/cs343-translationnew-ast-unique-expr
Last change on this file since 8bbdfdd was 8bbdfdd, checked in by Dmitry Kobets <dkobets@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 467 bytes
Line 
1#pragma once
2#include <math.h>
3
4
5//---------------------- Vector Types ----------------------
6// TODO: make generic, as per glm
7
8struct vec2 {
9    float x, y;
10};
11
12//---------------------- Geometric Functions ----------------------
13// These functions implement the Geometric Functions section of GLSL
14
15static inline float dot(const vec2& v, const vec2& u) {
16    return v.x * u.x + v.y * u.y;
17}
18
19static inline float length(const vec2& v) {
20   return sqrt(dot(v, v));
21}
Note: See TracBrowser for help on using the repository browser.