Mercurial > hg > orthanc-stone
comparison OrthancStone/Sources/Scene2D/AnnotationsSceneLayer.cpp @ 2011:abd4ee1648de
Fix measurement of arcs
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 02 Dec 2022 18:44:11 +0100 |
parents | 1bb0a9716876 |
children | 07964689cb0b |
comparison
equal
deleted
inserted
replaced
2010:25d269c7b753 | 2011:abd4ee1648de |
---|---|
651 const double y1 = start_.GetY(); | 651 const double y1 = start_.GetY(); |
652 const double xc = middle_.GetX(); | 652 const double xc = middle_.GetX(); |
653 const double yc = middle_.GetY(); | 653 const double yc = middle_.GetY(); |
654 const double x2 = end_.GetX(); | 654 const double x2 = end_.GetX(); |
655 const double y2 = end_.GetY(); | 655 const double y2 = end_.GetY(); |
656 | 656 |
657 startAngle = atan2(y1 - yc, x1 - xc); | 657 double referenceAngle = atan2(y1 - yc, x1 - xc); |
658 endAngle = atan2(y2 - yc, x2 - xc); | 658 double secondAngle = atan2(y2 - yc, x2 - xc); |
659 | 659 |
660 secondAngle -= referenceAngle; | |
661 | |
662 while (secondAngle >= PI) | |
663 { | |
664 secondAngle -= 2.0 * PI; | |
665 } | |
666 | |
667 while (secondAngle <= -PI) | |
668 { | |
669 secondAngle += 2.0 * PI; | |
670 } | |
671 | |
672 if (secondAngle < 0) | |
673 { | |
674 startAngle = referenceAngle + secondAngle; | |
675 endAngle = referenceAngle; | |
676 } | |
677 else | |
678 { | |
679 startAngle = referenceAngle; | |
680 endAngle = referenceAngle + secondAngle; | |
681 } | |
682 | |
660 fullAngle = endAngle - startAngle; | 683 fullAngle = endAngle - startAngle; |
661 | |
662 while (fullAngle < -PI) | |
663 { | |
664 fullAngle += 2.0 * PI; | |
665 } | |
666 | |
667 while (fullAngle >= PI) | |
668 { | |
669 fullAngle -= 2.0 * PI; | |
670 } | |
671 } | 684 } |
672 | 685 |
673 public: | 686 public: |
674 Arc(Annotation& parentAnnotation, | 687 Arc(Annotation& parentAnnotation, |
675 const ScenePoint2D& start, | 688 const ScenePoint2D& start, |