- Timestamp:
- Dec 13, 2019, 7:54:05 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:
- 0f4527d
- Parents:
- 7799f79
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/vec/vec3.hfa
r7799f79 rae09808 71 71 } 72 72 73 // ScalarMultiplication73 // Multiplication 74 74 forall(| multiply(T)) { 75 75 vec3(T) ?*?(vec3(T) v, T scalar) with (v) { // TODO (can't make this const ref) … … 79 79 return v * scalar; 80 80 } 81 vec3(T) ?*?(vec3(T) u, vec3(T) v) { 82 return [u.x * v.x, u.y * v.y, u.z * v.z]; 83 } 81 84 vec3(T)& ?*=?(vec3(T)& v, T scalar) { 82 85 v = v * scalar; 83 86 return v; 84 87 } 88 vec3(T)& ?*=?(vec3(T)& u, vec3(T) v) { 89 u = u * v; 90 return u; 91 } 85 92 } 86 93 87 // ScalarDivision94 // Division 88 95 forall(| divide(T)) { 89 96 vec3(T) ?/?(vec3(T) v, T scalar) with (v) { 90 97 return [x / scalar, y / scalar, z / scalar]; 91 98 } 99 vec3(T) ?/?(vec3(T) u, vec3(T) v) { 100 return [u.x / v.x, u.y / v.y, u.z / v.z]; 101 } 92 102 vec3(T)& ?/=?(vec3(T)& v, T scalar) with (v) { 93 103 v = v / scalar; 94 104 return v; 105 } 106 vec3(T)& ?/=?(vec3(T)& u, vec3(T) v) { 107 u = u / v; 108 return u; 95 109 } 96 110 }
Note: See TracChangeset
for help on using the changeset viewer.