diff --git a/coresdk/src/coresdk/clipping.cpp b/coresdk/src/coresdk/clipping.cpp index dbe480fa..73c011b4 100644 --- a/coresdk/src/coresdk/clipping.cpp +++ b/coresdk/src/coresdk/clipping.cpp @@ -53,7 +53,6 @@ namespace splashkit_lib LOG(WARNING) << "Attempting to push clip rect to invalid window"; return; } - _push_clip(wnd->image, r); } @@ -119,7 +118,7 @@ namespace splashkit_lib if ( img.clip_stack.size() > 0 ) { - rectangle clip_rect = *img.clip_stack.end(); + rectangle clip_rect = img.clip_stack.back(); sk_set_clip_rect(&img.surface, clip_rect.x, clip_rect.y, clip_rect.width, clip_rect.height); } else @@ -158,7 +157,7 @@ namespace splashkit_lib rectangle _current_clip(const image_data &img) { if (img.clip_stack.size() > 0) - return *img.clip_stack.end(); + return img.clip_stack.back(); else return rectangle_from(0, 0, img.surface.width, img.surface.height); } diff --git a/coresdk/src/coresdk/point_geometry.cpp b/coresdk/src/coresdk/point_geometry.cpp index 04a5b2e1..06096b2a 100644 --- a/coresdk/src/coresdk/point_geometry.cpp +++ b/coresdk/src/coresdk/point_geometry.cpp @@ -107,7 +107,7 @@ namespace splashkit_lib v = (dot00 * dot12 - dot01 * dot02) * inv_denom; // Check if point is in triangle - return ((u > 0.0) and (v > 0.0) and (u + v < 1.0)); + return ((u >= 0) and (v >= 0) and (u + v <= 1)); } bool point_in_rectangle(const point_2d &pt, const rectangle &rect) diff --git a/coresdk/src/coresdk/vector_2d.cpp b/coresdk/src/coresdk/vector_2d.cpp index 930cfea5..6ba31bc6 100644 --- a/coresdk/src/coresdk/vector_2d.cpp +++ b/coresdk/src/coresdk/vector_2d.cpp @@ -116,7 +116,9 @@ namespace splashkit_lib double angle_between(const vector_2d &v1, const vector_2d &v2) { - return vector_angle( vector_subtract(v2, v1) ); + double dot = dot_product(v1, v2); + double det = v1.x * v2.y - v1.y * v2.x; + return rad_to_deg(atan2(det, dot)); } vector_2d vector_normal(const vector_2d &v)