From 5aefc9c0b3c71975e5e1f21723ef37eba11fd59d Mon Sep 17 00:00:00 2001 From: poepelal78331 Date: Sat, 14 May 2022 19:35:21 +0200 Subject: [PATCH] trapezkorrektur implementiert --- src/ofApp.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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))); } }