Changeset 44f41997
- 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:
- b545cad
- Parents:
- 9a83ccd
- git-author:
- Dmitry Kobets <dkobets@…> (10/04/19 14:57:33)
- git-committer:
- Dmitry Kobets <dkobets@…> (11/11/19 14:41:41)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/vector.hfa
r9a83ccd r44f41997 29 29 return [u.x - v.x, u.y - v.y]; 30 30 } 31 vec2 ?*?(const vec2& v, float scalar) with (v) { 32 return [x * scalar, y * scalar]; 33 } 34 vec2 ?/?(const vec2& v, float scalar) with (v) { 35 return [x / scalar, y / scalar]; 36 } 31 37 32 38 /* //---------------------- Geometric Functions ---------------------- */ … … 40 46 return sqrt(dot(v, v)); 41 47 } 48 49 // Returns the distance betwwen v1 and v2, i.e., length(p0 - p1). 50 static inline float distance(const vec2& v1, const vec2& v2) { 51 return length(v1 - v2); 52 } 53 54 static inline vec2 normalize(const vec2& v) { 55 // TODO(dkobets) -- show them inversesqrt 56 // https://github.com/g-truc/glm/blob/269ae641283426f7f84116f2fe333472b9c914c9/glm/detail/func_exponential.inl 57 /* return v * inversesqrt(dot(v, v)); */ 58 return v / sqrt(dot(v, v)); 59 }
Note: See TracChangeset
for help on using the changeset viewer.