diff --git a/src/ofApp.cpp b/src/ofApp.cpp index ff0d0ec..29178eb 100644 --- a/src/ofApp.cpp +++ b/src/ofApp.cpp @@ -190,10 +190,16 @@ void ofApp::scaleTrapeze(void) { message = out.str(); ofDrawBitmapString(message, 100, 140); if (center_trapeze.x > middle) { - center_rect.x = center_trapeze.x - (((center_trapeze.y - cp_top_right.y) / right_pitch));// * (((cp_bottom_right.x - middle) - ((center_trapeze.y - cp_top_right.y) / right_pitch)) / (center_trapeze.x - middle))); + float mid_to_dot = center_trapeze.x - middle; + float distance_to_rect = ((cp_bottom_right.y - center_trapeze.y) / right_pitch); + float mid_to_max = (cp_bottom_right.x - middle) - distance_to_rect; + center_rect.x = center_trapeze.x + ((distance_to_rect) * ((mid_to_dot)/(mid_to_max))); } else { - center_rect.x = center_trapeze.x - (((center_trapeze.y - cp_top_left.y) / left_pitch));//* (((middle - cp_bottom_left.x) - ((center_trapeze.y - cp_top_left.y) / left_pitch)) / (middle - center_trapeze.x))); + float mid_to_dot = middle - center_trapeze.x; + float distance_to_rect = ((cp_bottom_left.y - center_trapeze.y) / left_pitch); + float mid_to_max = (middle - cp_bottom_left.x) - distance_to_rect; + center_rect.x = center_trapeze.x + ((distance_to_rect) * ((mid_to_dot)/(mid_to_max))); } }