IO is an event based input manager which permit to select which composents are manged on your system
Dependencies: C12832 FXOS8700Q LM75B MMA7660
Vector.cpp@4:50e2aefe516b, 2016-02-25 (annotated)
- Committer:
- co838_app56
- Date:
- Thu Feb 25 15:12:32 2016 +0000
- Revision:
- 4:50e2aefe516b
- Parent:
- 3:1ab88130bb9d
Fixing precision issue;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
co838_app56 | 3:1ab88130bb9d | 1 | #include "Vector.h" |
co838_app56 | 0:2ac59c564ab0 | 2 | |
co838_app56 | 0:2ac59c564ab0 | 3 | #include <float.h> |
co838_app56 | 0:2ac59c564ab0 | 4 | |
co838_app56 | 3:1ab88130bb9d | 5 | Vector::Vector(void) : x(0), y(0), z(0) {} |
co838_app56 | 3:1ab88130bb9d | 6 | Vector::Vector(float X, float Y, float Z) : x(X), y(Y), z(Z) {} |
co838_app56 | 3:1ab88130bb9d | 7 | Vector::Vector(const Vector ©) { *this = copy; } |
co838_app56 | 3:1ab88130bb9d | 8 | |
co838_app56 | 3:1ab88130bb9d | 9 | Vector &Vector::operator=(const Vector ©) |
co838_app56 | 3:1ab88130bb9d | 10 | { |
co838_app56 | 3:1ab88130bb9d | 11 | x = copy.x; |
co838_app56 | 3:1ab88130bb9d | 12 | y = copy.y; |
co838_app56 | 3:1ab88130bb9d | 13 | z = copy.z; |
co838_app56 | 3:1ab88130bb9d | 14 | return (*this); |
co838_app56 | 3:1ab88130bb9d | 15 | } |
co838_app56 | 3:1ab88130bb9d | 16 | |
co838_app56 | 3:1ab88130bb9d | 17 | bool Vector::operator!=(const Vector &other) const { return (!(*this == other)); } |
co838_app56 | 3:1ab88130bb9d | 18 | bool Vector::operator==(const Vector &other) const { return (other.x - x < FLT_MIN && other.y - y < FLT_MIN && other.z - z < FLT_MIN); } |
co838_app56 | 3:1ab88130bb9d | 19 | bool Vector::eq(const Vector &other, float prec) const { return (other.x - x < prec && other.y - y < prec && other.z - z < prec); } |