Skip to content

Commit

Permalink
Fix camel case method names for vec3d
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkOates committed May 22, 2016
1 parent ac4f452 commit 70b60e2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 44 deletions.
53 changes: 10 additions & 43 deletions include/allegro_flare/vec3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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();
}
};

Expand Down Expand Up @@ -150,37 +141,13 @@ 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();
}
*/












#endif
#endif
2 changes: 1 addition & 1 deletion source/camera3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}


Expand Down

0 comments on commit 70b60e2

Please sign in to comment.