Changeset 250dbae for libcfa/src/vec/vec3.hfa
- Timestamp:
- Dec 31, 2019, 12:19:53 PM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- f8a8fb1
- Parents:
- 94df8de
- git-author:
- Dmitry Kobets <dkobets@…> (12/31/19 12:13:34)
- git-committer:
- Dmitry Kobets <dkobets@…> (12/31/19 12:19:53)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/vec/vec3.hfa
r94df8de r250dbae 10 10 } 11 11 12 13 12 forall (otype T) { 14 13 static inline { … … 31 30 } 32 31 33 // Assignment34 32 void ?=?(vec3(T)& vec, vec3(T) other) with (vec) { 35 33 [x,y,z] = other.[x,y,z]; … … 44 42 // - 45 43 forall(| subtract(T)) { 46 vec3(T) ?-?(vec3(T) u, vec3(T) v) { // TODO( can't make this const ref )44 vec3(T) ?-?(vec3(T) u, vec3(T) v) { 47 45 return [u.x - v.x, u.y - v.y, u.z - v.z]; 48 46 } … … 52 50 } 53 51 } 54 55 52 forall(| negate(T)) { 56 53 vec3(T) -?(vec3(T) v) with (v) { … … 58 55 } 59 56 } 60 61 57 forall(| { T --?(T&); }) { 62 58 vec3(T)& --?(vec3(T)& v) { … … 75 71 // + 76 72 forall(| add(T)) { 77 vec3(T) ?+?(vec3(T) u, vec3(T) v) { // TODO( can't make this const ref )73 vec3(T) ?+?(vec3(T) u, vec3(T) v) { 78 74 return [u.x + v.x, u.y + v.y, u.z + v.z]; 79 75 } … … 83 79 } 84 80 } 85 86 81 87 82 forall(| { T ++?(T&); }) { … … 101 96 // * 102 97 forall(| multiply(T)) { 103 vec3(T) ?*?(vec3(T) v, T scalar) with (v) { // TODO (can't make this const ref)98 vec3(T) ?*?(vec3(T) v, T scalar) with (v) { 104 99 return [x * scalar, y * scalar, z * scalar]; 105 100 } 106 vec3(T) ?*?(T scalar, vec3(T) v) { // TODO (can't make this const ref)101 vec3(T) ?*?(T scalar, vec3(T) v) { 107 102 return v * scalar; 108 103 } … … 128 123 return [u.x / v.x, u.y / v.y, u.z / v.z]; 129 124 } 130 vec3(T)& ?/=?(vec3(T)& v, T scalar) with (v){125 vec3(T)& ?/=?(vec3(T)& v, T scalar) { 131 126 v = v / scalar; 132 127 return v;
Note: See TracChangeset
for help on using the changeset viewer.