Skip to content

Commit ac4f452

Browse files
committed
Fix camel case method names in vec2d
1 parent 22fc276 commit ac4f452

File tree

3 files changed

+10
-16
lines changed

3 files changed

+10
-16
lines changed

include/allegro_flare/vec2d.h

+5-11
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class vec2d
2121
: x( x ), y( y ) {}
2222

2323

24-
static inline vec2d PolarCoords( float angle, float magnitude ) {
24+
static inline vec2d polar_coords( float angle, float magnitude ) {
2525
return vec2d( magnitude * std::cos( angle ), magnitude * std::sin( angle ));
2626
}
2727

@@ -43,7 +43,7 @@ class vec2d
4343
}
4444

4545

46-
inline vec2d Normalized() const {
46+
inline vec2d normalized() const {
4747
float magnitude = get_magnitude();
4848

4949
return vec2d( x / magnitude, y / magnitude );
@@ -84,12 +84,6 @@ class vec2d
8484
str << "(" << x << ", " << y << ")";
8585
return str.str();
8686
}
87-
88-
/*
89-
inline std::string GetString() const {
90-
return ToString();
91-
}
92-
*/
9387
};
9488

9589

@@ -139,7 +133,7 @@ inline vec2d operator - ( vec2d vec ) {
139133
// NORMALIZATION
140134

141135
inline vec2d operator ~ ( vec2d vec ) {
142-
return vec.Normalized();
136+
return vec.normalized();
143137
}
144138

145139

@@ -148,7 +142,7 @@ inline vec2d operator ~ ( vec2d vec ) {
148142

149143
// Checks if the points are in counter clockwise order //
150144

151-
inline bool IsCounterClockwise( const vec2d first, const vec2d second, const vec2d third ) {
145+
inline bool is_counter_clockwise( const vec2d first, const vec2d second, const vec2d third ) {
152146
float dx1, dx2, dy1, dy2;
153147

154148
dx1 = second.x - first.x;
@@ -171,4 +165,4 @@ inline bool IsCounterClockwise( const vec2d first, const vec2d second, const vec
171165

172166

173167

174-
#endif
168+
#endif

source/skeleton.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Bone *Bone::__get_nth_child_recursive(int n)
4141
Bone::Bone(vec2d dir_vec, float length, float tau_range)
4242
: parent(NULL)
4343
, children()
44-
, midpoint_direction(dir_vec.Normalized())
44+
, midpoint_direction(dir_vec.normalized())
4545
, length(length)
4646
, position(0.5)
4747
, range(tau_range * TAU)
@@ -72,7 +72,7 @@ float Bone::get_angle()
7272

7373
vec2d Bone::get_direction()
7474
{
75-
return vec2d::PolarCoords(get_angle(), 1.0);
75+
return vec2d::polar_coords(get_angle(), 1.0);
7676
}
7777

7878

@@ -139,11 +139,11 @@ void Bone::__draw_recursive(Bone *bone, vec2d last_direction, vec2d pos, int ind
139139
child = &bone->children[i];
140140

141141
float direction_ang = last_direction.get_angle() + child->get_angle();
142-
direction = vec2d::PolarCoords(direction_ang, 1);
142+
direction = vec2d::polar_coords(direction_ang, 1);
143143

144144
vec2d start = pos;
145145
vec2d end = pos + direction * child->length;
146-
//direction = (end - start).Normalized();
146+
//direction = (end - start).normalized();
147147

148148
// draw the bone and the endpoints
149149
if (_index_count == index_to_hilight) al_draw_line(start.x, start.y, end.x, end.y, color::pink, 8.0);

source/useful.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ void draw_dashed_line(float x, float y, float x2, float y2, ALLEGRO_COLOR &col,
294294
float space = 6;
295295

296296
int segments = distance(x, y, x2, y2) / (dash+space);
297-
vec2d dir = vec2d(x2-x, y2-y).Normalized();
297+
vec2d dir = vec2d(x2-x, y2-y).normalized();
298298

299299
float dist_traveled = 0;
300300
for (int i=0; i<segments; i++)

0 commit comments

Comments
 (0)