35 #include <visp3/core/vpConfig.h>
36 #include <visp3/core/vpImageCircle.h>
37 #include <visp3/core/vpMath.h>
38 #include <visp3/core/vpRect.h>
40 bool equal(
const float &actualVal,
const float &theoreticalVal)
43 return (std::abs(theoreticalVal - actualVal) < 1.f);
48 const float OFFSET = 5.f;
49 const float WIDTH = 640.f;
50 const float HEIGHT = 480.f;
51 const float RADIUS = std::min<float>(WIDTH, HEIGHT) / 10.f;
52 vpRect roi(OFFSET, OFFSET, WIDTH, HEIGHT);
53 const float WIDTH_SWITCHED = HEIGHT;
54 const float HEIGHT_SWITCHED = WIDTH;
55 vpRect switchedRoI(OFFSET, OFFSET, WIDTH_SWITCHED, HEIGHT_SWITCHED);
56 bool hasSucceeded =
true;
61 float arcLengthCircle = circle.computeArcLengthInRoI(roi);
62 float theoreticalValue = 2.f * M_PIf * RADIUS;
63 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
64 std::string statusTest;
66 statusTest =
"SUCCESS";
69 statusTest =
"FAILED";
71 std::cout <<
"Test no intersection." << std::endl;
72 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
73 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
74 std::cout <<
"\ttest status = " << statusTest << std::endl;
76 hasSucceeded &= isValueOK;
81 vpRect roiSquare(OFFSET, OFFSET, HEIGHT, HEIGHT);
83 float arcLengthCircle = circle.computeArcLengthInRoI(roi);
84 float theoreticalValue = 2.f * M_PIf * HEIGHT / 2.f;
85 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
86 std::string statusTest;
88 statusTest =
"SUCCESS";
91 statusTest =
"FAILED";
93 std::cout <<
"Test circle touching borders of the RoI." << std::endl;
94 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
95 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
96 std::cout <<
"\ttest status = " << statusTest << std::endl;
98 hasSucceeded &= isValueOK;
105 float uc = OFFSET + 24.f;
106 float vc = OFFSET + 100.f;
108 float arcLengthCircle = circle.computeArcLengthInRoI(roi);
109 float theoreticalValue = 4.f * M_PIf * RADIUS /3.f;
110 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
111 std::string statusTest;
113 statusTest =
"SUCCESS";
116 statusTest =
"FAILED";
118 std::cout <<
"Test intersection left border, more than half a circle visible." << std::endl;
119 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
120 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
121 std::cout <<
"\ttest status = " << statusTest << std::endl;
123 hasSucceeded &= isValueOK;
130 float uc = OFFSET - 24.f;
131 float vc = OFFSET + 100.f;
133 float arcLengthCircle = circle.computeArcLengthInRoI(roi);
134 float theoreticalValue = 2.f * M_PIf * RADIUS /3.f;
135 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
136 std::string statusTest;
138 statusTest =
"SUCCESS";
141 statusTest =
"FAILED";
143 std::cout <<
"Test intersection left border, less than half a circle visible." << std::endl;
144 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
145 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
146 std::cout <<
"\ttest status = " << statusTest << std::endl;
148 hasSucceeded &= isValueOK;
155 float uc = OFFSET + RADIUS;
156 float vc = OFFSET + 100.f;
158 float arcLengthCircle = circle.computeArcLengthInRoI(roi);
159 float theoreticalValue = 2.f * M_PIf * RADIUS;
160 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
161 std::string statusTest;
163 statusTest =
"SUCCESS";
166 statusTest =
"FAILED";
168 std::cout <<
"Test with circle touching the left border, all the circle is visible." << std::endl;
169 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
170 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
171 std::cout <<
"\ttest status = " << statusTest << std::endl;
173 hasSucceeded &= isValueOK;
180 float uc = OFFSET - RADIUS;
181 float vc = OFFSET - 100.f;
183 float arcLengthCircle = circle.computeArcLengthInRoI(roi);
184 float theoreticalValue = 0.f;
185 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
186 std::string statusTest;
188 statusTest =
"SUCCESS";
191 statusTest =
"FAILED";
193 std::cout <<
"Test with circle touching the left border, all the circle is hidden." << std::endl;
194 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
195 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
196 std::cout <<
"\ttest status = " << statusTest << std::endl;
198 hasSucceeded &= isValueOK;
205 float uc = OFFSET + 616.f;
206 float vc = OFFSET + 100.f;
208 float arcLengthCircle = circle.computeArcLengthInRoI(roi);
209 float theoreticalValue = 4.f * M_PIf * RADIUS /3.f;
210 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
211 std::string statusTest;
213 statusTest =
"SUCCESS";
216 statusTest =
"FAILED";
218 std::cout <<
"Test intersection right border, more than half a circle visible." << std::endl;
219 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
220 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
221 std::cout <<
"\ttest status = " << statusTest << std::endl;
223 hasSucceeded &= isValueOK;
230 float uc = OFFSET + 664.f;
231 float vc = OFFSET + 100.f;
233 float arcLengthCircle = circle.computeArcLengthInRoI(roi);
234 float theoreticalValue = 2.f * M_PIf * RADIUS /3.f;
235 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
236 std::string statusTest;
238 statusTest =
"SUCCESS";
241 statusTest =
"FAILED";
243 std::cout <<
"Test intersection right border, less than half a circle visible." << std::endl;
244 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
245 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
246 std::cout <<
"\ttest status = " << statusTest << std::endl;
248 hasSucceeded &= isValueOK;
255 float uc = OFFSET + WIDTH - RADIUS;
256 float vc = OFFSET + 100.f;
258 float arcLengthCircle = circle.computeArcLengthInRoI(roi);
259 float theoreticalValue = 2.f * M_PIf * RADIUS;
260 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
261 std::string statusTest;
263 statusTest =
"SUCCESS";
266 statusTest =
"FAILED";
268 std::cout <<
"Test with circle touching the right border, all the circle is visible." << std::endl;
269 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
270 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
271 std::cout <<
"\ttest status = " << statusTest << std::endl;
273 hasSucceeded &= isValueOK;
280 float uc = OFFSET + WIDTH + RADIUS;
281 float vc = OFFSET + 100.f;
283 float arcLengthCircle = circle.computeArcLengthInRoI(roi);
284 float theoreticalValue = 0.f;
285 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
286 std::string statusTest;
288 statusTest =
"SUCCESS";
291 statusTest =
"FAILED";
293 std::cout <<
"Test with circle touching the right border, all the circle is hidden." << std::endl;
294 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
295 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
296 std::cout <<
"\ttest status = " << statusTest << std::endl;
298 hasSucceeded &= isValueOK;
305 float theta = M_PIf / 3.f;
306 float uc = OFFSET + 100.f;
307 float vc = OFFSET + RADIUS * sin(theta);
309 float arcLengthCircle = circle.computeArcLengthInRoI(roi);
310 float theoreticalValue = 5.f * M_PIf * RADIUS /3.f;
311 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
312 std::string statusTest;
314 statusTest =
"SUCCESS";
317 statusTest =
"FAILED";
319 std::cout <<
"Test intersection top border, more than half a circle visible." << std::endl;
320 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
321 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
322 std::cout <<
"\ttest status = " << statusTest << std::endl;
324 hasSucceeded &= isValueOK;
331 float theta = -2.f * M_PIf/3.f;
332 float uc = OFFSET + 100.f;
333 float vc = OFFSET + RADIUS * std::sin(theta);
335 float arcLengthCircle = circle.computeArcLengthInRoI(roi);
336 float theoreticalValue = M_PIf * RADIUS /3.f;
337 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
338 std::string statusTest;
340 statusTest =
"SUCCESS";
343 statusTest =
"FAILED";
345 std::cout <<
"Test intersection top border, less than half a circle visible." << std::endl;
346 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
347 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
348 std::cout <<
"\ttest status = " << statusTest << std::endl;
350 hasSucceeded &= isValueOK;
357 float theta = M_PI_2f;
358 float uc = OFFSET + 100.f;
359 float vc = OFFSET + RADIUS * sin(theta);
361 float arcLengthCircle = circle.computeArcLengthInRoI(roi);
362 float theoreticalValue = 2.f * M_PIf * RADIUS;
363 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
364 std::string statusTest;
366 statusTest =
"SUCCESS";
369 statusTest =
"FAILED";
371 std::cout <<
"Test with circle touching the top border, all the circle is visible." << std::endl;
372 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
373 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
374 std::cout <<
"\ttest status = " << statusTest << std::endl;
376 hasSucceeded &= isValueOK;
383 float theta = -M_PI_2f;
384 float uc = OFFSET + 100.f;
385 float vc = OFFSET + RADIUS * sin(theta);
387 float arcLengthCircle = circle.computeArcLengthInRoI(roi);
388 float theoreticalValue = 0.f;
389 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
390 std::string statusTest;
392 statusTest =
"SUCCESS";
395 statusTest =
"FAILED";
397 std::cout <<
"Test with circle touching the top border, all the circle is hidden." << std::endl;
398 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
399 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
400 std::cout <<
"\ttest status = " << statusTest << std::endl;
402 hasSucceeded &= isValueOK;
409 float theta = -M_PIf / 3.f;
410 float uc = OFFSET + 100.f;
411 float vc = OFFSET + HEIGHT + RADIUS * std::sin(theta);
413 float arcLengthCircle = circle.computeArcLengthInRoI(roi);
414 float theoreticalValue = 5.f * M_PIf * RADIUS /3.f;
415 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
416 std::string statusTest;
418 statusTest =
"SUCCESS";
421 statusTest =
"FAILED";
423 std::cout <<
"Test intersection bottom border, more than half a circle visible." << std::endl;
424 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
425 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
426 std::cout <<
"\ttest status = " << statusTest << std::endl;
428 hasSucceeded &= isValueOK;
435 float theta = M_PIf / 3.f;
436 float uc = OFFSET + 100.f;
437 float vc = OFFSET + HEIGHT + RADIUS * std::sin(theta);
439 float arcLengthCircle = circle.computeArcLengthInRoI(roi);
440 float theoreticalValue = M_PIf * RADIUS /3.f;
441 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
442 std::string statusTest;
444 statusTest =
"SUCCESS";
447 statusTest =
"FAILED";
449 std::cout <<
"Test intersection bottom border, less than half a circle visible." << std::endl;
450 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
451 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
452 std::cout <<
"\ttest status = " << statusTest << std::endl;
454 hasSucceeded &= isValueOK;
460 float uc = OFFSET + 100.f;
461 float vc = OFFSET + HEIGHT - RADIUS;
463 float arcLengthCircle = circle.computeArcLengthInRoI(roi);
464 float theoreticalValue = 2.f * M_PIf * RADIUS;
465 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
466 std::string statusTest;
468 statusTest =
"SUCCESS";
471 statusTest =
"FAILED";
473 std::cout <<
"Test with circle touching the bottom border, all the circle is visible." << std::endl;
474 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
475 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
476 std::cout <<
"\ttest status = " << statusTest << std::endl;
478 hasSucceeded &= isValueOK;
484 float uc = OFFSET + 100.f;
485 float vc = OFFSET + HEIGHT + RADIUS;
487 float arcLengthCircle = circle.computeArcLengthInRoI(roi);
488 float theoreticalValue = 0.f;
489 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
490 std::string statusTest;
492 statusTest =
"SUCCESS";
495 statusTest =
"FAILED";
497 std::cout <<
"Test with circle touching the bottom border, all the circle is hidden." << std::endl;
498 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
499 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
500 std::cout <<
"\ttest status = " << statusTest << std::endl;
502 hasSucceeded &= isValueOK;
514 float arcLengthCircle = circle.computeArcLengthInRoI(roi);
515 float theoreticalValue = M_PI_2f * RADIUS;
516 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
517 std::string statusTest;
519 statusTest =
"SUCCESS";
522 statusTest =
"FAILED";
524 std::cout <<
"Test with intersections with the top and the left border, crossing each axis once in the RoI." << std::endl;
525 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
526 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
527 std::cout <<
"\ttest status = " << statusTest << std::endl;
529 hasSucceeded &= isValueOK;
541 float theta_v_min = M_PIf / 4.f;
542 float uc = OFFSET - RADIUS * std::cos(theta_v_min);
543 float vc = OFFSET + RADIUS * std::sin(theta_v_min) + 1.f;
544 vc = std::max<float>(vc, OFFSET + RADIUS * std::sin(-theta_v_min) + 1.f);
546 float arcLengthCircle = circle.computeArcLengthInRoI(roi);
547 float theoreticalValue = M_PI_2f * RADIUS;
548 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
549 std::string statusTest;
551 statusTest =
"SUCCESS";
554 statusTest =
"FAILED";
556 std::cout <<
"Test with intersections with the top and the left border but crossing only the left axis in the RoI." << std::endl;
557 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
558 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
559 std::cout <<
"\ttest status = " << statusTest << std::endl;
561 hasSucceeded &= isValueOK;
575 float theta_u_top_min = -1.1f * M_PI_2f;
576 float uc = OFFSET - RADIUS * std::cos(theta_u_top_min) + 1.f;
577 uc = std::max<float>(uc, OFFSET - RADIUS * std::cos(M_PIf - theta_u_top_min) + 1.f);
578 float vc = OFFSET + RADIUS * std::sin(theta_u_top_min);
580 float arcLengthCircle = circle.computeArcLengthInRoI(roi);
581 float theoreticalValue = 0.2f * M_PI_2f * RADIUS;
582 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
583 std::string statusTest;
585 statusTest =
"SUCCESS";
588 statusTest =
"FAILED";
590 std::cout <<
"Test with intersections with the top and the left border but crossing only the top axis in the RoI." << std::endl;
591 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
592 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
593 std::cout <<
"\ttest status = " << statusTest << std::endl;
595 hasSucceeded &= isValueOK;
611 float theta_u_top_min = 5.f * M_PIf / 8.f;
612 float theta_u_top_max = M_PIf - theta_u_top_min;
613 float uc = OFFSET - RADIUS * std::cos(theta_u_top_min) + 1.f;
614 uc = std::max<float>(uc, OFFSET - RADIUS * std::cos(M_PIf - theta_u_top_min) + 1.f);
615 float vc = OFFSET + RADIUS * std::sin(theta_u_top_min);
616 float theta_v_min = std::acos((OFFSET - uc)/RADIUS);
618 float theta_v_max = -theta_v_min;
619 if (theta_v_max < 0) {
620 float temp = theta_v_max;
621 theta_v_max = theta_v_min;
625 float arcLengthCircle = circle.computeArcLengthInRoI(roi);
626 float theoreticalValue = ((theta_v_max - theta_u_top_min) + (theta_u_top_max - theta_v_min)) * RADIUS;
627 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
628 std::string statusTest;
630 statusTest =
"SUCCESS";
633 statusTest =
"FAILED";
635 std::cout <<
"Test with intersections with the top and the left border crossing twice each axis ." << std::endl;
636 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
637 std::cout <<
"\ttheoretical length = " << theoreticalValue << std::endl;
638 std::cout <<
"\ttest status = " << statusTest << std::endl;
640 hasSucceeded &= isValueOK;
654 float theta_u_top_min = 2.f * M_PIf / 3.f;
655 float theta_v_max = -M_PI_2f;
656 float uc = OFFSET + WIDTH - RADIUS * std::cos(theta_v_max);
657 float vc = OFFSET + RADIUS * std::sin(theta_u_top_min);;
659 float arcLengthCircle = circle.computeArcLengthInRoI(roi);
660 float theoreticalValue = (M_PI_2f + M_PIf / 3.f) * RADIUS;
661 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
662 std::string statusTest;
664 statusTest =
"SUCCESS";
667 statusTest =
"FAILED";
669 std::cout <<
"Test with intersections with the top and the right border, crossing each axis once in the RoI." << std::endl;
670 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
671 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
672 std::cout <<
"\ttest status = " << statusTest << std::endl;
674 hasSucceeded &= isValueOK;
689 float theta_v_max = -7.f * M_PIf / 8.f;
690 float theta_v_min = -theta_v_max;
691 float uc = OFFSET + WIDTH - RADIUS * std::cos(theta_v_max);
692 float vc = RADIUS * std::sin(std::acos((OFFSET + WIDTH - uc)/RADIUS)) + OFFSET + 1.f;
694 float arcLengthCircle = circle.computeArcLengthInRoI(roi);
695 float theoreticalValue = (2.f * M_PIf - (theta_v_min - theta_v_max)) * RADIUS;
696 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
697 std::string statusTest;
699 statusTest =
"SUCCESS";
702 statusTest =
"FAILED";
704 std::cout <<
"Test with intersections with the top and the right border, but crossing only the right border in the RoI." << std::endl;
705 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
706 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
707 std::cout <<
"\ttest status = " << statusTest << std::endl;
709 hasSucceeded &= isValueOK;
724 float theta_u_top_min = -0.9f * M_PI_2f;
725 float theta_u_top_max = M_PIf - theta_u_top_min;
727 float vc = OFFSET + RADIUS * std::sin(theta_u_top_min);
728 float theta_v_min = std::asin((vc - OFFSET)/RADIUS) + 1.f;
729 float uc = OFFSET + WIDTH - RADIUS * std::cos(theta_v_min);
731 float arcLengthCircle = circle.computeArcLengthInRoI(roi);
732 float theoreticalValue = std::abs(theta_u_top_min - theta_u_top_max) * RADIUS;
733 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
734 std::string statusTest;
736 statusTest =
"SUCCESS";
739 statusTest =
"FAILED";
741 std::cout <<
"Test with intersections with the top and the right border, but crossing only the top border in the RoI." << std::endl;
742 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
743 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
744 std::cout <<
"\ttest status = " << statusTest << std::endl;
746 hasSucceeded &= isValueOK;
762 float theta_u_top_min = 5.f * M_PIf / 8.f;
763 float theta_u_top_max = M_PIf - theta_u_top_min;
764 float uc = OFFSET + WIDTH - RADIUS * std::cos(theta_u_top_min) - 1.f;
765 uc = std::min<float>(uc, OFFSET + WIDTH - RADIUS * std::cos(M_PIf - theta_u_top_min) - 1.f);
766 float vc = OFFSET + RADIUS * std::sin(theta_u_top_min);
767 float theta_v_min = std::acos((OFFSET + WIDTH - uc)/RADIUS);
769 float theta_v_max = -theta_v_min;
770 if (theta_v_min < 0) {
771 float temp = theta_v_min;
772 theta_v_min = theta_v_max;
776 float arcLengthCircle = circle.computeArcLengthInRoI(roi);
777 float theoreticalValue = (2.f * M_PIf - ((theta_u_top_min - theta_u_top_max) + (theta_v_min - theta_v_max))) * RADIUS;
778 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
779 std::string statusTest;
781 statusTest =
"SUCCESS";
784 statusTest =
"FAILED";
786 std::cout <<
"Test with intersections with the top and the left border crossing twice each axis ." << std::endl;
787 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
788 std::cout <<
"\ttheoretical length = " << theoreticalValue << std::endl;
789 std::cout <<
"\ttest status = " << statusTest << std::endl;
791 hasSucceeded &= isValueOK;
805 float theta_v_min = M_PI_2f;
806 float theta_u_bot_max = -M_PIf / 3.f;
807 float uc = OFFSET - RADIUS * std::cos(theta_v_min);
808 float vc = OFFSET + HEIGHT + RADIUS * std::sin(theta_u_bot_max);;
810 float arcLengthCircle = circle.computeArcLengthInRoI(roi);
811 float theoreticalValue = (M_PI_2f + M_PIf / 3.f) * RADIUS;
812 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
813 std::string statusTest;
815 statusTest =
"SUCCESS";
818 statusTest =
"FAILED";
820 std::cout <<
"Test with intersections with the bottom and the left border, crossing each axis once in the RoI." << std::endl;
821 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
822 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
823 std::cout <<
"\ttest status = " << statusTest << std::endl;
825 hasSucceeded &= isValueOK;
841 float theta_v_min = M_PI_4f / 2.f;
842 float theta_v_max = -theta_v_min;
843 float uc = OFFSET - RADIUS * std::cos(theta_v_min);
844 float vc = std::min<float>(OFFSET + HEIGHT + RADIUS * std::sin(theta_v_min) - 1.f, OFFSET + HEIGHT + RADIUS * std::sin(theta_v_max) - 1.f);
846 float arcLengthCircle = circle.computeArcLengthInRoI(roi);
847 float theoreticalValue = (2.f * theta_v_min) * RADIUS;
848 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
849 std::string statusTest;
851 statusTest =
"SUCCESS";
854 statusTest =
"FAILED";
856 std::cout <<
"Test with intersections with the bottom and the left border, but crossing only the left border in the RoI." << std::endl;
857 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
858 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
859 std::cout <<
"\ttest status = " << statusTest << std::endl;
861 hasSucceeded &= isValueOK;
877 float theta_u_bot_min = 5.f * M_PI_4f / 2.f;
878 float theta_u_bot_max = M_PIf - theta_u_bot_min;
879 float vc = OFFSET + HEIGHT + RADIUS * std::sin(theta_u_bot_min);
880 float uc = std::max<float>(OFFSET - RADIUS * std::cos(theta_u_bot_min) + 1.f, OFFSET - RADIUS * std::cos(theta_u_bot_max) + 1.f);
882 float arcLengthCircle = circle.computeArcLengthInRoI(roi);
883 float theoreticalValue = (theta_u_bot_min - theta_u_bot_max) * RADIUS;
884 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
885 std::string statusTest;
887 statusTest =
"SUCCESS";
890 statusTest =
"FAILED";
892 std::cout <<
"Test with intersections with the bottom and the left border, but crossing only the bottom border in the RoI." << std::endl;
893 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
894 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
895 std::cout <<
"\ttest status = " << statusTest << std::endl;
897 hasSucceeded &= isValueOK;
913 float theta_u_bot_min = -5.f * M_PIf / 8.f;
914 float theta_u_bot_max = M_PIf - theta_u_bot_min;
916 float theta_v_min = 7.f * M_PIf / 8.f;
917 float theta_v_max = -theta_v_min;
918 float vc = OFFSET + HEIGHT + RADIUS * std::sin(theta_u_bot_min);
919 float uc = OFFSET - RADIUS * std::cos(theta_v_min);
921 float arcLengthCircle = circle.computeArcLengthInRoI(roi);
922 float theoreticalValue = ((theta_v_min - theta_u_bot_max) + (theta_u_bot_min - theta_v_max)) * RADIUS;
923 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
924 std::string statusTest;
926 statusTest =
"SUCCESS";
929 statusTest =
"FAILED";
931 std::cout <<
"Test with intersections with the bottom and the left border, crossing each axis twice in the RoI." << std::endl;
932 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
933 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
934 std::cout <<
"\ttest status = " << statusTest << std::endl;
936 hasSucceeded &= isValueOK;
950 float theta_u_bot_min = -2.f * M_PIf / 3.f;
951 float theta_v_min = M_PI_2f;
952 float uc = OFFSET + WIDTH - RADIUS * std::cos(theta_v_min);
953 float vc = OFFSET + HEIGHT + RADIUS * std::sin(theta_u_bot_min);;
955 float arcLengthCircle = circle.computeArcLengthInRoI(roi);
956 float theoreticalValue = (M_PI_2f + M_PIf / 3.f) * RADIUS;
957 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
958 std::string statusTest;
960 statusTest =
"SUCCESS";
963 statusTest =
"FAILED";
965 std::cout <<
"Test with intersections with the bottom and the right border, crossing each axis once in the RoI." << std::endl;
966 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
967 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
968 std::cout <<
"\ttest status = " << statusTest << std::endl;
970 hasSucceeded &= isValueOK;
985 float theta_v_min = 5.f * M_PIf / 6.f;
986 float uc = OFFSET + WIDTH - RADIUS * std::cos(theta_v_min);
987 float vc = std::min<float>(OFFSET + HEIGHT + RADIUS * std::sin(theta_v_min) - 1.f, OFFSET + HEIGHT + RADIUS * std::sin(-theta_v_min) - 1.f);
989 float arcLengthCircle = circle.computeArcLengthInRoI(roi);
990 float theoreticalValue = (M_PIf / 3.f) * RADIUS;
991 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
992 std::string statusTest;
994 statusTest =
"SUCCESS";
997 statusTest =
"FAILED";
999 std::cout <<
"Test with intersections with the bottom and the right border, crossing only the right axis in the RoI in the RoI." << std::endl;
1000 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
1001 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
1002 std::cout <<
"\ttest status = " << statusTest << std::endl;
1004 hasSucceeded &= isValueOK;
1019 float theta_u_bot_min = 4.f * M_PIf / 6.f;
1020 float vc = OFFSET + HEIGHT + RADIUS * std::sin(theta_u_bot_min);
1021 float uc = std::min<float>(OFFSET + WIDTH - RADIUS * std::cos(theta_u_bot_min) - 1.f, OFFSET + WIDTH - RADIUS * std::cos(M_PIf -theta_u_bot_min) - 1.f);
1023 float arcLengthCircle = circle.computeArcLengthInRoI(roi);
1024 float theoreticalValue = (M_PIf / 3.f) * RADIUS;
1025 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
1026 std::string statusTest;
1028 statusTest =
"SUCCESS";
1031 statusTest =
"FAILED";
1033 std::cout <<
"Test with intersections with the bottom and the right border, crossing only the bottom axis in the RoI in the RoI." << std::endl;
1034 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
1035 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
1036 std::cout <<
"\ttest status = " << statusTest << std::endl;
1038 hasSucceeded &= isValueOK;
1054 float theta_u_bot_min = -7.f * M_PIf / 8.f;
1055 float theta_u_bot_max = M_PIf - theta_u_bot_min;
1057 float theta_v_max = -3.f * M_PIf / 8.f;
1058 float theta_v_min = -theta_v_max;
1059 float vc = OFFSET + HEIGHT + RADIUS * std::sin(theta_u_bot_min);
1060 float uc = OFFSET - RADIUS * std::cos(theta_v_min);
1062 float arcLengthCircle = circle.computeArcLengthInRoI(roi);
1063 float theoreticalValue = (2.f * M_PIf - ((theta_v_min - theta_v_max) + (theta_u_bot_max - theta_u_bot_min))) * RADIUS;
1064 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
1065 std::string statusTest;
1067 statusTest =
"SUCCESS";
1070 statusTest =
"FAILED";
1072 std::cout <<
"Test with intersections with the bottom and the right border, crossing each axis twice in the RoI." << std::endl;
1073 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
1074 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
1075 std::cout <<
"\ttest status = " << statusTest << std::endl;
1077 hasSucceeded &= isValueOK;
1092 float theta_u_top_min = 5.f * M_PIf / 8.f;
1093 float theta_u_top_max = 3.f * M_PIf / 8.f;
1094 float theta_v_min = 7.f * M_PIf / 8.f;
1095 float theta_v_max = -theta_v_min;
1096 float theta_u_bottom_min = -5.f * M_PIf / 8.f;
1097 float theta_u_bottom_max = -3.f * M_PIf / 8.f;
1098 float vc = OFFSET + HEIGHT / 2.f;
1099 float radius = -(OFFSET - vc)/ std::sin(theta_u_top_min);
1100 float uc = OFFSET - radius * std::cos(theta_v_min);
1102 float arcLengthCircle = circle.computeArcLengthInRoI(roi);
1103 float theoreticalValue = ((theta_v_min - theta_u_top_min) + (theta_u_top_max - theta_u_bottom_max) + (theta_u_bottom_min - theta_v_max)) * radius;
1104 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
1105 std::string statusTest;
1107 statusTest =
"SUCCESS";
1110 statusTest =
"FAILED";
1112 std::cout <<
"Test with intersections with the top, bottom and the left border, crossing each axis twice in the RoI." << std::endl;
1113 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
1114 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
1115 std::cout <<
"\ttest status = " << statusTest << std::endl;
1117 hasSucceeded &= isValueOK;
1132 float theta_u_top_max = M_PIf / 6.f;
1133 float theta_u_top_min = M_PIf - theta_u_top_max;
1134 float theta_v_min = M_PIf / 3.f;
1135 float theta_u_bottom_max = -theta_u_top_max;
1136 float radius = HEIGHT;
1137 float vc = OFFSET + radius * std::sin(theta_u_top_min);
1138 float uc = OFFSET - radius * std::cos(theta_v_min);
1140 float arcLengthCircle = circle.computeArcLengthInRoI(roi);
1141 float theoreticalValue = (theta_u_top_max - theta_u_bottom_max) * radius;
1142 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
1143 std::string statusTest;
1145 statusTest =
"SUCCESS";
1148 statusTest =
"FAILED";
1150 std::cout <<
"Test with intersections with the top, bottom and the left border, crossing only the top and bottom axes in the RoI." << std::endl;
1151 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
1152 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
1153 std::cout <<
"\ttest status = " << statusTest << std::endl;
1155 hasSucceeded &= isValueOK;
1170 float theta_u_top_min = 4.f * M_PIf / 6.f;
1171 float theta_u_top_max = M_PIf - theta_u_top_min;
1172 float theta_v_min = M_PIf;
1173 float theta_u_bottom_min = -theta_u_top_min;
1174 float theta_u_bottom_max = -theta_u_top_max;
1175 float radius = HEIGHT / (2.f * std::sin(theta_u_top_min));
1176 float vc = OFFSET + radius * std::sin(theta_u_top_min);
1177 float uc = OFFSET - radius * std::cos(theta_v_min);
1179 float arcLengthCircle = circle.computeArcLengthInRoI(roi);
1180 float theoreticalValue = (2.f * M_PIf - ((theta_u_top_min - theta_u_top_max) + (theta_u_bottom_max - theta_u_bottom_min))) * radius;
1181 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
1182 std::string statusTest;
1184 statusTest =
"SUCCESS";
1187 statusTest =
"FAILED";
1189 std::cout <<
"Test with intersections with the top, bottom and the left border, crossing the top and bottom axes and touching the left axis in the RoI." << std::endl;
1190 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
1191 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
1192 std::cout <<
"\ttest status = " << statusTest << std::endl;
1194 hasSucceeded &= isValueOK;
1209 float theta_u_top_min = M_PI_2f;
1210 float theta_v_min = M_PI_4f;
1211 float theta_v_max = -theta_v_min;
1212 float radius = HEIGHT / 2.f;
1213 float vc = OFFSET + radius * std::sin(theta_u_top_min);
1214 float uc = OFFSET - radius * std::cos(theta_v_min);
1216 float arcLengthCircle = circle.computeArcLengthInRoI(roi);
1217 float theoreticalValue = (theta_v_min - theta_v_max) * radius;
1218 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
1219 std::string statusTest;
1221 statusTest =
"SUCCESS";
1224 statusTest =
"FAILED";
1226 std::cout <<
"Test with intersections with the top, bottom and the left border, crossing only the left axis in the RoI." << std::endl;
1227 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
1228 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
1229 std::cout <<
"\ttest status = " << statusTest << std::endl;
1231 hasSucceeded &= isValueOK;
1246 float theta_u_top_min = M_PI_2f;
1247 float theta_v_min = 3.f * M_PI_4f;
1248 float theta_v_max = -theta_v_min;
1249 float radius = HEIGHT / 2.f;
1250 float vc = OFFSET + radius * std::sin(theta_u_top_min);
1251 float uc = OFFSET - radius * std::cos(theta_v_min);
1253 float arcLengthCircle = circle.computeArcLengthInRoI(roi);
1254 float theoreticalValue = (theta_v_min - theta_v_max) * radius;
1255 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
1256 std::string statusTest;
1258 statusTest =
"SUCCESS";
1261 statusTest =
"FAILED";
1263 std::cout <<
"Test with intersections with the top, bottom and the left border, crossing the left axis and touching the two others in the RoI." << std::endl;
1264 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
1265 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
1266 std::cout <<
"\ttest status = " << statusTest << std::endl;
1268 hasSucceeded &= isValueOK;
1283 float theta_u_top_max = 0.f;
1284 float theta_u_bot_max = -M_PIf / 3.f;
1285 float theta_v_max = -M_PIf / 6.f;
1286 float radius = HEIGHT / (std::sin(theta_u_top_max) - std::sin(theta_u_bot_max));
1287 float uc = OFFSET - radius * std::cos(theta_v_max);
1288 float vc = OFFSET + radius * std::sin(theta_u_top_max);
1290 float arcLengthCircle = circle.computeArcLengthInRoI(roi);
1291 float theoreticalValue = (theta_u_top_max - theta_v_max) * radius;
1292 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
1293 std::string statusTest;
1295 statusTest =
"SUCCESS";
1298 statusTest =
"FAILED";
1300 std::cout <<
"Test with intersections with the top, bottom and the left border, crossing only the top and left axes once in the RoI." << std::endl;
1301 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
1302 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
1303 std::cout <<
"\ttest status = " << statusTest << std::endl;
1305 hasSucceeded &= isValueOK;
1320 float theta_u_top_max = M_PIf / 3.f;
1321 float theta_u_bot_max = 0.f;
1322 float theta_v_min = M_PIf / 6.f;
1323 float radius = HEIGHT / (std::sin(theta_u_top_max) - std::sin(theta_u_bot_max));
1324 float uc = OFFSET - radius * std::cos(theta_v_min);
1325 float vc = OFFSET + radius * std::sin(theta_u_top_max);
1327 float arcLengthCircle = circle.computeArcLengthInRoI(roi);
1328 float theoreticalValue = (theta_v_min - theta_u_bot_max) * radius;
1329 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
1330 std::string statusTest;
1332 statusTest =
"SUCCESS";
1335 statusTest =
"FAILED";
1337 std::cout <<
"Test with intersections with the top, bottom and the left border, crossing the bottom and left axis once in the RoI." << std::endl;
1338 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
1339 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
1340 std::cout <<
"\ttest status = " << statusTest << std::endl;
1342 hasSucceeded &= isValueOK;
1357 float theta_u_top_min = 5.f * M_PIf / 8.f;
1358 float theta_u_top_max = 3.f * M_PIf / 8.f;
1359 float theta_v_min = 1.f * M_PIf / 8.f;
1360 float theta_v_max = -theta_v_min;
1361 float theta_u_bottom_min = -5.f * M_PIf / 8.f;
1362 float theta_u_bottom_max = -3.f * M_PIf / 8.f;
1363 float vc = OFFSET + HEIGHT / 2.f;
1364 float radius = -(OFFSET - vc)/ std::sin(theta_u_top_min);
1365 float uc = OFFSET + WIDTH - radius * std::cos(theta_v_min);
1367 float arcLengthCircle = circle.computeArcLengthInRoI(roi);
1368 float theoreticalValue = (2.f * M_PIf - ((theta_u_top_min - theta_u_top_max) + (theta_v_min - theta_v_max) + (theta_u_bottom_max - theta_u_bottom_min))) * radius;
1369 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
1370 std::string statusTest;
1372 statusTest =
"SUCCESS";
1375 statusTest =
"FAILED";
1377 std::cout <<
"Test with intersections with the top, bottom and the right border, crossing each axis twice in the RoI." << std::endl;
1378 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
1379 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
1380 std::cout <<
"\ttest status = " << statusTest << std::endl;
1382 hasSucceeded &= isValueOK;
1397 float theta_u_top_min = 5.f * M_PIf / 6.f;
1398 float theta_v_min = 2.f * M_PIf / 3.f;
1399 float theta_u_bottom_min = -theta_u_top_min;
1400 float radius = HEIGHT;
1401 float vc = OFFSET + radius * std::sin(theta_u_top_min);
1402 float uc = OFFSET + WIDTH - radius * std::cos(theta_v_min);
1404 float arcLengthCircle = circle.computeArcLengthInRoI(roi);
1405 float theoreticalValue = (2.f * M_PIf - (theta_u_top_min - theta_u_bottom_min)) * radius;
1406 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
1407 std::string statusTest;
1409 statusTest =
"SUCCESS";
1412 statusTest =
"FAILED";
1414 std::cout <<
"Test with intersections with the top, bottom and the right border, crossing only the top and bottom axes in the RoI." << std::endl;
1415 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
1416 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
1417 std::cout <<
"\ttest status = " << statusTest << std::endl;
1419 hasSucceeded &= isValueOK;
1434 float theta_u_top_min = 4.f * M_PIf / 6.f;
1435 float theta_u_top_max = M_PIf - theta_u_top_min;
1436 float theta_v_min = 0;
1437 float theta_u_bottom_min = -theta_u_top_min;
1438 float theta_u_bottom_max = -theta_u_top_max;
1439 float radius = HEIGHT / (2.f * std::sin(theta_u_top_min));
1440 float vc = OFFSET + radius * std::sin(theta_u_top_min);
1441 float uc = OFFSET + WIDTH - radius * std::cos(theta_v_min);
1443 float arcLengthCircle = circle.computeArcLengthInRoI(roi);
1444 float theoreticalValue = (2.f * M_PIf - ((theta_u_top_min - theta_u_top_max) + (theta_u_bottom_max - theta_u_bottom_min))) * radius;
1445 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
1446 std::string statusTest;
1448 statusTest =
"SUCCESS";
1451 statusTest =
"FAILED";
1453 std::cout <<
"Test with intersections with the top, bottom and the right border, crossing the top and bottom axes and touching the right axis in the RoI." << std::endl;
1454 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
1455 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
1456 std::cout <<
"\ttest status = " << statusTest << std::endl;
1458 hasSucceeded &= isValueOK;
1473 float theta_u_top_min = M_PI_2f;
1474 float theta_v_min = 3.f * M_PI_4f;
1475 float theta_v_max = -theta_v_min;
1476 float radius = HEIGHT / 2.f;
1477 float vc = OFFSET + radius * std::sin(theta_u_top_min);
1478 float uc = OFFSET + WIDTH - radius * std::cos(theta_v_min);
1480 float arcLengthCircle = circle.computeArcLengthInRoI(roi);
1481 float theoreticalValue = (2.f * M_PIf - (theta_v_min - theta_v_max)) * radius;
1482 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
1483 std::string statusTest;
1485 statusTest =
"SUCCESS";
1488 statusTest =
"FAILED";
1490 std::cout <<
"Test with intersections with the top, bottom and the right border, crossing only the right axis in the RoI." << std::endl;
1491 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
1492 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
1493 std::cout <<
"\ttest status = " << statusTest << std::endl;
1495 hasSucceeded &= isValueOK;
1510 float theta_u_top_min = M_PI_2f;
1511 float theta_v_min = M_PI_4f;
1512 float theta_v_max = -theta_v_min;
1513 float radius = HEIGHT / 2.f;
1514 float vc = OFFSET + radius * std::sin(theta_u_top_min);
1515 float uc = OFFSET + WIDTH - radius * std::cos(theta_v_min);
1517 float arcLengthCircle = circle.computeArcLengthInRoI(roi);
1518 float theoreticalValue = (2.f * M_PIf - (theta_v_min - theta_v_max)) * radius;
1519 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
1520 std::string statusTest;
1522 statusTest =
"SUCCESS";
1525 statusTest =
"FAILED";
1527 std::cout <<
"Test with intersections with the top, bottom and the right border, crossing the right axis and touching the two others in the RoI." << std::endl;
1528 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
1529 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
1530 std::cout <<
"\ttest status = " << statusTest << std::endl;
1532 hasSucceeded &= isValueOK;
1547 float theta_u_top_min = M_PIf;
1548 float theta_u_bot_min = -2.f * M_PIf / 3.f;
1549 float theta_v_max = -5.f * M_PIf / 6.f;
1550 float radius = HEIGHT / (std::sin(theta_u_top_min) - std::sin(theta_u_bot_min));
1551 float uc = OFFSET + WIDTH - radius * std::cos(theta_v_max);
1552 float vc = OFFSET + radius * std::sin(theta_u_top_min);
1554 float arcLengthCircle = circle.computeArcLengthInRoI(roi);
1555 float theoreticalValue = (2.f * M_PIf - (theta_u_top_min - theta_v_max)) * radius;
1556 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
1557 std::string statusTest;
1559 statusTest =
"SUCCESS";
1562 statusTest =
"FAILED";
1564 std::cout <<
"Test with intersections with the top, bottom and the right border, crossing the top and right axis once in the RoI." << std::endl;
1565 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
1566 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
1567 std::cout <<
"\ttest status = " << statusTest << std::endl;
1569 hasSucceeded &= isValueOK;
1584 float theta_u_top_min = 2.f * M_PIf / 3.f;
1585 float theta_u_bot_min = M_PIf;
1586 float theta_v_min = 5.f * M_PIf / 6.f;
1587 float radius = HEIGHT / (std::sin(theta_u_top_min) - std::sin(theta_u_bot_min));
1588 float uc = OFFSET + WIDTH - radius * std::cos(theta_v_min);
1589 float vc = OFFSET + radius * std::sin(theta_u_top_min);
1591 float arcLengthCircle = circle.computeArcLengthInRoI(roi);
1592 float theoreticalValue = (theta_u_bot_min - theta_v_min) * radius;
1593 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
1594 std::string statusTest;
1596 statusTest =
"SUCCESS";
1599 statusTest =
"FAILED";
1601 std::cout <<
"Test with intersections with the top, bottom and the right border, crossing the bottom and right axis once in the RoI." << std::endl;
1602 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
1603 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
1604 std::cout <<
"\ttest status = " << statusTest << std::endl;
1606 hasSucceeded &= isValueOK;
1623 float theta_v_left_min = 7.f * M_PIf / 8.f;
1624 float theta_v_left_max = -theta_v_left_min;
1625 float theta_v_right_min = M_PIf / 8.f;
1626 float theta_v_right_max = -theta_v_right_min;
1627 float theta_u_top_min = 5.f * M_PIf / 8.f;
1628 float theta_u_top_max = M_PIf - theta_u_top_min;
1629 float radius = WIDTH_SWITCHED / (std::cos(theta_v_right_min) - std::cos(theta_v_left_min));
1630 float uc = OFFSET + WIDTH_SWITCHED - radius * std::cos(theta_v_right_min);
1631 float vc = OFFSET + radius * std::sin(theta_u_top_min);
1633 float arcLengthCircle = circle.computeArcLengthInRoI(switchedRoI);
1634 float theoreticalValue = ((theta_v_left_min - theta_u_top_min) + (theta_u_top_max - theta_v_right_min) + (theta_v_right_max - theta_v_left_max)) * radius;
1635 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
1636 std::string statusTest;
1638 statusTest =
"SUCCESS";
1641 statusTest =
"FAILED";
1643 std::cout <<
"Test with intersections with the top, left and the right border, crossing each axis twice in the RoI." << std::endl;
1644 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
1645 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
1646 std::cout <<
"\ttest status = " << statusTest << std::endl;
1648 hasSucceeded &= isValueOK;
1664 float theta_u_top_min = -2.f * M_PIf / 3.f;
1665 float uc = OFFSET + WIDTH_SWITCHED/2.f;
1666 float vc = OFFSET + RADIUS * std::sin(theta_u_top_min);
1668 float arcLengthCircle = circle.computeArcLengthInRoI(switchedRoI);
1669 float theoreticalValue = (M_PIf/3.f) * RADIUS;
1670 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
1671 std::string statusTest;
1673 statusTest =
"SUCCESS";
1676 statusTest =
"FAILED";
1678 std::cout <<
"Test with intersections with the top, left and the right border, crossing only the top axis." << std::endl;
1679 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
1680 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
1681 std::cout <<
"\ttest status = " << statusTest << std::endl;
1683 hasSucceeded &= isValueOK;
1700 float theta_v_left_max = -5.f * M_PIf / 8.f;
1701 float theta_v_right_max = -3.f *M_PIf / 8.f;
1702 float theta_u_top_min = -7.f * M_PIf / 8.f;
1703 float radius = WIDTH_SWITCHED / (std::cos(theta_v_right_max) - std::cos(theta_v_left_max));
1704 float uc = OFFSET - radius * std::cos(theta_v_left_max);
1705 float vc = OFFSET + radius * std::sin(theta_u_top_min);
1707 float arcLengthCircle = circle.computeArcLengthInRoI(switchedRoI);
1708 float theoreticalValue = (theta_v_right_max - theta_v_left_max) * radius;
1709 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
1710 std::string statusTest;
1712 statusTest =
"SUCCESS";
1715 statusTest =
"FAILED";
1717 std::cout <<
"Test with intersections with the top, left and the right border, crossing only left right in the RoI." << std::endl;
1718 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
1719 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
1720 std::cout <<
"\ttest status = " << statusTest << std::endl;
1722 hasSucceeded &= isValueOK;
1739 float theta_u_top_max = -M_PIf / 3.f;
1740 float theta_v_right_max = 0.f;
1741 float theta_v_left_max = -M_PI_2f;
1742 float radius = WIDTH_SWITCHED / (std::cos(theta_v_right_max) - std::cos(theta_v_left_max));
1744 float vc = OFFSET + radius * std::sin(theta_u_top_max);
1746 float arcLengthCircle = circle.computeArcLengthInRoI(switchedRoI);
1747 float theoreticalValue = (theta_u_top_max - theta_v_left_max) * radius;
1748 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
1749 std::string statusTest;
1751 statusTest =
"SUCCESS";
1754 statusTest =
"FAILED";
1756 std::cout <<
"Test with intersections with the top, left and the right border, crossing only the top and left axes." << std::endl;
1757 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
1758 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
1759 std::cout <<
"\ttest status = " << statusTest << std::endl;
1761 hasSucceeded &= isValueOK;
1778 float theta_u_top_min = -2.f * M_PIf / 3.f;
1779 float theta_v_left_max = M_PIf;
1780 float theta_v_right_max = -M_PI_2f;
1781 float radius = WIDTH_SWITCHED / (std::cos(theta_v_right_max) - std::cos(theta_v_left_max));
1782 float uc = OFFSET + WIDTH_SWITCHED;
1783 float vc = OFFSET + radius * std::sin(theta_u_top_min);
1785 float arcLengthCircle = circle.computeArcLengthInRoI(switchedRoI);
1786 float theoreticalValue = (theta_v_right_max - theta_u_top_min) * radius;
1787 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
1788 std::string statusTest;
1790 statusTest =
"SUCCESS";
1793 statusTest =
"FAILED";
1795 std::cout <<
"Test with intersections with the top, left and the right border, crossing only the top and right axes." << std::endl;
1796 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
1797 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
1798 std::cout <<
"\ttest status = " << statusTest << std::endl;
1800 hasSucceeded &= isValueOK;
1817 float theta_v_left_min = 7.f * M_PIf / 8.f;
1818 float theta_v_left_max = -theta_v_left_min;
1819 float theta_v_right_min = M_PIf / 8.f;
1820 float theta_v_right_max = -theta_v_right_min;
1821 float theta_u_bot_min = -5.f * M_PIf / 8.f;
1822 float theta_u_bot_max = -M_PIf - theta_u_bot_min;
1823 float radius = WIDTH_SWITCHED / (std::cos(theta_v_right_min) - std::cos(theta_v_left_min));
1824 float uc = OFFSET + WIDTH_SWITCHED - radius * std::cos(theta_v_right_min);
1825 float vc = OFFSET + HEIGHT_SWITCHED + radius * std::sin(theta_u_bot_min);
1827 float arcLengthCircle = circle.computeArcLengthInRoI(switchedRoI);
1828 float theoreticalValue = ((theta_v_left_min - theta_v_right_min) + (theta_v_right_max - theta_u_bot_max) + (theta_u_bot_min - theta_v_left_max)) * radius;
1829 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
1830 std::string statusTest;
1832 statusTest =
"SUCCESS";
1835 statusTest =
"FAILED";
1837 std::cout <<
"Test with intersections with the bottom, left and the right border, crossing each axis twice in the RoI." << std::endl;
1838 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
1839 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
1840 std::cout <<
"\ttest status = " << statusTest << std::endl;
1842 hasSucceeded &= isValueOK;
1858 float theta_u_bot_min = 2.f * M_PIf / 3.f;
1859 float theta_u_bot_max = M_PIf - theta_u_bot_min;
1860 float theta_v_left_min = 5.f * M_PIf / 6.f;
1861 float theta_v_right_min = M_PIf / 6.f;
1862 float radius = WIDTH_SWITCHED / (std::cos(theta_v_right_min) - std::cos(theta_v_left_min));
1863 float uc = OFFSET + WIDTH_SWITCHED - radius * std::cos(theta_v_right_min);
1864 float vc = OFFSET + HEIGHT_SWITCHED + radius * std::sin(theta_u_bot_min);
1866 float arcLengthCircle = circle.computeArcLengthInRoI(switchedRoI);
1867 float theoreticalValue = ((theta_u_bot_min - theta_u_bot_max)) * radius;
1868 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
1869 std::string statusTest;
1871 statusTest =
"SUCCESS";
1874 statusTest =
"FAILED";
1876 std::cout <<
"Test with intersections with the bottom, left and the right border, crossing only the bottom one in the RoI." << std::endl;
1877 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
1878 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
1879 std::cout <<
"\ttest status = " << statusTest << std::endl;
1881 hasSucceeded &= isValueOK;
1897 float theta_u_bot_min = 7.f * M_PIf / 8.f;
1898 float theta_v_left_min = 5.f * M_PIf / 8.f;
1899 float theta_v_right_min = 3.f * M_PIf / 8.f;
1900 float radius = WIDTH_SWITCHED / (std::cos(theta_v_right_min) - std::cos(theta_v_left_min));
1901 float uc = OFFSET + WIDTH_SWITCHED - radius * std::cos(theta_v_right_min);
1902 float vc = OFFSET + HEIGHT_SWITCHED + radius * std::sin(theta_u_bot_min);
1904 float arcLengthCircle = circle.computeArcLengthInRoI(switchedRoI);
1905 float theoreticalValue = ((theta_v_left_min - theta_v_right_min)) * radius;
1906 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
1907 std::string statusTest;
1909 statusTest =
"SUCCESS";
1912 statusTest =
"FAILED";
1914 std::cout <<
"Test with intersections with the bottom, left and the right border, crossing only the left and right in the RoI." << std::endl;
1915 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
1916 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
1917 std::cout <<
"\ttest status = " << statusTest << std::endl;
1919 hasSucceeded &= isValueOK;
1935 float theta_u_bot_max = M_PIf / 3.f;
1936 float theta_v_left_min = M_PI_2f;
1937 float theta_v_right_min = 0.f;
1938 float radius = WIDTH_SWITCHED / (std::cos(theta_v_right_min) - std::cos(theta_v_left_min));
1940 float vc = OFFSET + HEIGHT_SWITCHED + radius * std::sin(theta_u_bot_max);
1942 float arcLengthCircle = circle.computeArcLengthInRoI(switchedRoI);
1943 float theoreticalValue = ((theta_v_left_min - theta_u_bot_max)) * radius;
1944 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
1945 std::string statusTest;
1947 statusTest =
"SUCCESS";
1950 statusTest =
"FAILED";
1952 std::cout <<
"Test with intersections with the bottom, left and the right border, crossing only the left and bottom in the RoI." << std::endl;
1953 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
1954 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
1955 std::cout <<
"\ttest status = " << statusTest << std::endl;
1957 hasSucceeded &= isValueOK;
1973 float theta_u_bot_min = 2.f * M_PIf / 3.f;
1974 float theta_v_right_min = M_PI_2f;
1975 float theta_v_left_min = M_PIf;
1976 float radius = WIDTH_SWITCHED / (std::cos(theta_v_right_min) - std::cos(theta_v_left_min));
1977 float uc = OFFSET + WIDTH_SWITCHED;
1978 float vc = OFFSET + HEIGHT_SWITCHED + radius * std::sin(theta_u_bot_min);
1980 float arcLengthCircle = circle.computeArcLengthInRoI(switchedRoI);
1981 float theoreticalValue = ((theta_u_bot_min - theta_v_right_min)) * radius;
1982 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
1983 std::string statusTest;
1985 statusTest =
"SUCCESS";
1988 statusTest =
"FAILED";
1990 std::cout <<
"Test with intersections with the bottom, left and the right border, crossing only the right and bottom in the RoI." << std::endl;
1991 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
1992 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
1993 std::cout <<
"\ttest status = " << statusTest << std::endl;
1995 hasSucceeded &= isValueOK;
2007 float theta_u_top_min = 2.f * M_PIf / 3.f;
2008 float theta_u_top_max = M_PIf / 3.f;
2009 float theta_u_bottom_min = -2.f * M_PIf / 3.f;
2010 float theta_u_bottom_max = -M_PIf / 3.f;
2011 float uc = OFFSET + WIDTH / 2.f;
2012 float vc = OFFSET + HEIGHT / 2.f;
2013 float radius = -(OFFSET - vc)/ std::sin(theta_u_top_min);
2016 float arcLengthCircle = circle.computeArcLengthInRoI(roi);
2017 float theoreticalValue = (2.f * M_PIf - ((theta_u_top_min - theta_u_top_max) + (theta_u_bottom_max - theta_u_bottom_min))) * radius;
2018 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
2019 std::string statusTest;
2021 statusTest =
"SUCCESS";
2024 statusTest =
"FAILED";
2026 std::cout <<
"Test with intersections with the top and bottom borders only, crossing each axis twice in the RoI." << std::endl;
2027 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
2028 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
2029 std::cout <<
"\ttest status = " << statusTest << std::endl;
2031 hasSucceeded &= isValueOK;
2043 float theta_v_left_min = 5.f * M_PIf / 6.f;
2044 float theta_v_left_max = -theta_v_left_min;
2045 float theta_v_right_min = M_PIf / 6.f;
2046 float theta_v_right_max = -theta_v_right_min;
2047 float uc = OFFSET + HEIGHT / 2.f;
2048 float vc = OFFSET + WIDTH / 2.f;
2049 float radius = (OFFSET - uc)/ std::cos(theta_v_left_min);
2052 float arcLengthCircle = circle.computeArcLengthInRoI(switchedRoI);
2053 float theoreticalValue = ((theta_v_left_min - theta_v_right_min) + (theta_v_right_max - theta_v_left_max)) * radius;
2054 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
2055 std::string statusTest;
2057 statusTest =
"SUCCESS";
2060 statusTest =
"FAILED";
2062 std::cout <<
"Test with intersections with the right and left borders only, crossing each axis twice in the RoI." << std::endl;
2063 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
2064 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
2065 std::cout <<
"\ttest status = " << statusTest << std::endl;
2067 hasSucceeded &= isValueOK;
2074 vpRect squareRoI(OFFSET, OFFSET, HEIGHT, HEIGHT);
2075 float theta_v_left_min = 7.f * M_PIf / 8.f;
2076 float uc = OFFSET + HEIGHT / 2.f;
2077 float vc = OFFSET + HEIGHT / 2.f;
2078 float radius = (OFFSET - uc) / std::cos(theta_v_left_min);
2081 float arcLengthCircle = circle.computeArcLengthInRoI(squareRoI);
2082 float theoreticalValue = M_PIf * radius;
2083 bool isValueOK = equal(arcLengthCircle, theoreticalValue);
2084 std::string statusTest;
2086 statusTest =
"SUCCESS";
2089 statusTest =
"FAILED";
2091 std::cout <<
"Test with intersections with the top and bottom borders only, crossing each axis twice in the RoI." << std::endl;
2092 std::cout <<
"\tarc length =" << arcLengthCircle << std::endl;
2093 std::cout <<
"\ttheoretical length =" << theoreticalValue << std::endl;
2094 std::cout <<
"\ttest status = " << statusTest << std::endl;
2096 hasSucceeded &= isValueOK;
2100 std::cout <<
"testImageCircle overall result: SUCCESS" << std::endl;
2101 return EXIT_SUCCESS;
2104 std::cout <<
"testImageCircle overall result: FAILED" << std::endl;
2105 return EXIT_FAILURE;
Class that defines a 2D circle in an image.
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
static float getAngleBetweenMinPiAndPi(const float &theta)
Defines a rectangle in the plane.