Changeset 9a83ccd for libcfa/src
- Timestamp:
- Nov 11, 2019, 2:41:41 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 44f41997
- Parents:
- 8bbdfdd
- git-author:
- Dmitry Kobets <dkobets@…> (10/04/19 14:20:38)
- git-committer:
- Dmitry Kobets <dkobets@…> (11/11/19 14:41:41)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/vector.hfa
r8bbdfdd r9a83ccd 1 1 #pragma once 2 #include <math.h>3 2 #include "math.hfa" 3 #include <iostream.hfa> 4 4 5 5 //---------------------- Vector Types ---------------------- 6 6 // TODO: make generic, as per glm 7 7 8 8 9 struct vec2 { … … 10 11 }; 11 12 12 //---------------------- Geometric Functions ---------------------- 13 // These functions implement the Geometric Functions section of GLSL 13 void ?{}( vec2 & v, float x, float y) { 14 v.[x, y] = [x, y]; 15 } 14 16 15 static inline float dot(const vec2& v, const vec2& u) { 16 return v.x * u.x + v.y * u.y; 17 forall( dtype ostype | ostream( ostype ) ) { 18 ostype & ?|?( ostype & os, const vec2& v) with (v) { 19 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) ); 20 fmt( os, "<%g,%g>", x, y); 21 return os; 22 } 23 void ?|?( ostype & os, const vec2 v ) { 24 (ostype &)(os | v); ends( os ); 25 } 26 } 27 28 vec2 ?-?(const vec2& u, const vec2& v) { 29 return [u.x - v.x, u.y - v.y]; 30 } 31 32 /* //---------------------- Geometric Functions ---------------------- */ 33 /* // These functions implement the Geometric Functions section of GLSL */ 34 35 static inline float dot(const vec2& u, const vec2& v) { 36 return u.x * v.x + u.y * v.y; 17 37 } 18 38
Note: See TracChangeset
for help on using the changeset viewer.