From 70b60e2114b8964dad602dd51061775d52466542 Mon Sep 17 00:00:00 2001 From: Mark Oates Date: Sun, 22 May 2016 06:58:15 -0400 Subject: [PATCH] Fix camel case method names for vec3d --- include/allegro_flare/vec3d.h | 53 +++++++---------------------------- source/camera3d.cpp | 2 +- 2 files changed, 11 insertions(+), 44 deletions(-) diff --git a/include/allegro_flare/vec3d.h b/include/allegro_flare/vec3d.h index 0283f5325..705cecf0b 100644 --- a/include/allegro_flare/vec3d.h +++ b/include/allegro_flare/vec3d.h @@ -21,31 +21,22 @@ class vec3d : x( x ), y( y ), z( z ) {} - -// static inline vec2d PolarCoords( float angle, float magnitude ) { -// return vec2d( magnitude * std::cos( angle ), magnitude * std::sin( angle )); -// } - // METHODS // -// inline float GetAngle() const { -// return std::atan2( y, x ); -// } - - inline float GetMagnitude() const { - return std::sqrt( GetMagnitudeSquared() ); + inline float get_magnitude() const { + return std::sqrt( get_magnitude_squared() ); } - inline float GetMagnitudeSquared() const { + inline float get_magnitude_squared() const { return x * x + y * y + z * z; } - inline vec3d Normalized() const { - float magnitude = GetMagnitude(); + inline vec3d normalized() const { + float magnitude = get_magnitude(); // what if magnitude is 0? return vec3d( x / magnitude, y / magnitude, z / magnitude); } @@ -91,15 +82,15 @@ class vec3d return !(*this == other); } - inline std::string ToString(int precision=5) const { + inline std::string to_string(int precision=5) const { std::ostringstream str; str.precision(precision); str << "( " << std::fixed << x << ", " << std::fixed << y << ", " << std::fixed << z << " )"; return str.str(); } - inline std::string GetString() const { - return ToString(); + inline std::string get_string() const { + return to_string(); } }; @@ -150,32 +141,8 @@ inline vec3d operator - ( vec3d vec ) { // NORMALIZATION inline vec3d operator ~ ( vec3d vec ) { - return vec.Normalized(); -} - - -// TESTS - - -// Checks if the points are in counter clockwise order // - -/* -inline bool IsCounterClockwise( const vec2d first, const vec2d second, const vec2d third ) { - float dx1, dx2, dy1, dy2; - - dx1 = second.x - first.x; - dy1 = second.y - first.y; - dx2 = third.x - second.x; - dy2 = third.y - second.y; - - return dy1*dx2 < dy2*dx1; + return vec.normalized(); } -*/ - - - - - @@ -183,4 +150,4 @@ inline bool IsCounterClockwise( const vec2d first, const vec2d second, const vec -#endif \ No newline at end of file +#endif diff --git a/source/camera3d.cpp b/source/camera3d.cpp index 5144ec84d..20e6f0734 100644 --- a/source/camera3d.cpp +++ b/source/camera3d.cpp @@ -171,7 +171,7 @@ void Camera3D::set_frustum_as_camera(ALLEGRO_DISPLAY *d) void Camera3D::look_at(vec3d target) { - view_vector = (target - position).Normalized(); + view_vector = (target - position).normalized(); }