annotate Samples/Common/MeasureToolsToolbox.h @ 651:62f6ff016085

Iteration in angle measuring tool. Text label is not ok and handles and arcs (and maybe angle sides) should not scale with zoom.
author Benjamin Golinvaux <bgo@osimis.io>
date Tue, 14 May 2019 09:48:14 +0200
parents 1e9ed656318e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
645
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
1 /**
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
2 * Stone of Orthanc
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
5 * Copyright (C) 2017-2019 Osimis S.A., Belgium
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
6 *
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
10 * the License, or (at your option) any later version.
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
11 *
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
15 * Affero General Public License for more details.
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
16 *
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
19 **/
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
20
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
21 #include <Framework/Scene2D/PolylineSceneLayer.h>
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
22 #include <Framework/Scene2D/Scene2D.h>
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
23
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
24 namespace OrthancStone
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
25 {
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
26
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
27 /**
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
28 This function will create a square around the center point supplied in
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
29 scene coordinates, with a side length given in canvas coordinates. The
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
30 square sides are parallel to the canvas boundaries.
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
31 */
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
32 void AddSquare(PolylineSceneLayer::Chain& chain,
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
33 const Scene2D& scene,
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
34 const ScenePoint2D& centerS,
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
35 const double& sideLength);
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
36
651
62f6ff016085 Iteration in angle measuring tool. Text label is not ok and handles and arcs
Benjamin Golinvaux <bgo@osimis.io>
parents: 645
diff changeset
37
645
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
38 /**
651
62f6ff016085 Iteration in angle measuring tool. Text label is not ok and handles and arcs
Benjamin Golinvaux <bgo@osimis.io>
parents: 645
diff changeset
39 Creates an arc centered on c that goes
62f6ff016085 Iteration in angle measuring tool. Text label is not ok and handles and arcs
Benjamin Golinvaux <bgo@osimis.io>
parents: 645
diff changeset
40 - from a point r1:
62f6ff016085 Iteration in angle measuring tool. Text label is not ok and handles and arcs
Benjamin Golinvaux <bgo@osimis.io>
parents: 645
diff changeset
41 - so that r1 belongs to the p1,c line
62f6ff016085 Iteration in angle measuring tool. Text label is not ok and handles and arcs
Benjamin Golinvaux <bgo@osimis.io>
parents: 645
diff changeset
42 - so that the distance from c to r1 equals radius
62f6ff016085 Iteration in angle measuring tool. Text label is not ok and handles and arcs
Benjamin Golinvaux <bgo@osimis.io>
parents: 645
diff changeset
43 - to a point r2:
62f6ff016085 Iteration in angle measuring tool. Text label is not ok and handles and arcs
Benjamin Golinvaux <bgo@osimis.io>
parents: 645
diff changeset
44 - so that r2 belongs to the p2,c line
62f6ff016085 Iteration in angle measuring tool. Text label is not ok and handles and arcs
Benjamin Golinvaux <bgo@osimis.io>
parents: 645
diff changeset
45 - so that the distance from c to r2 equals radius
62f6ff016085 Iteration in angle measuring tool. Text label is not ok and handles and arcs
Benjamin Golinvaux <bgo@osimis.io>
parents: 645
diff changeset
46 - that follows the shortest among the two possible paths
62f6ff016085 Iteration in angle measuring tool. Text label is not ok and handles and arcs
Benjamin Golinvaux <bgo@osimis.io>
parents: 645
diff changeset
47
62f6ff016085 Iteration in angle measuring tool. Text label is not ok and handles and arcs
Benjamin Golinvaux <bgo@osimis.io>
parents: 645
diff changeset
48 Warning: the existing chain content will be wiped out.
62f6ff016085 Iteration in angle measuring tool. Text label is not ok and handles and arcs
Benjamin Golinvaux <bgo@osimis.io>
parents: 645
diff changeset
49 */
62f6ff016085 Iteration in angle measuring tool. Text label is not ok and handles and arcs
Benjamin Golinvaux <bgo@osimis.io>
parents: 645
diff changeset
50 void AddShortestArc(
62f6ff016085 Iteration in angle measuring tool. Text label is not ok and handles and arcs
Benjamin Golinvaux <bgo@osimis.io>
parents: 645
diff changeset
51 PolylineSceneLayer::Chain& chain
62f6ff016085 Iteration in angle measuring tool. Text label is not ok and handles and arcs
Benjamin Golinvaux <bgo@osimis.io>
parents: 645
diff changeset
52 , const Scene2D& scene
62f6ff016085 Iteration in angle measuring tool. Text label is not ok and handles and arcs
Benjamin Golinvaux <bgo@osimis.io>
parents: 645
diff changeset
53 , const ScenePoint2D& p1
62f6ff016085 Iteration in angle measuring tool. Text label is not ok and handles and arcs
Benjamin Golinvaux <bgo@osimis.io>
parents: 645
diff changeset
54 , const ScenePoint2D& c
62f6ff016085 Iteration in angle measuring tool. Text label is not ok and handles and arcs
Benjamin Golinvaux <bgo@osimis.io>
parents: 645
diff changeset
55 , const ScenePoint2D& p2
62f6ff016085 Iteration in angle measuring tool. Text label is not ok and handles and arcs
Benjamin Golinvaux <bgo@osimis.io>
parents: 645
diff changeset
56 , const double& radiusS
62f6ff016085 Iteration in angle measuring tool. Text label is not ok and handles and arcs
Benjamin Golinvaux <bgo@osimis.io>
parents: 645
diff changeset
57 , const int subdivisionsCount = 63);
62f6ff016085 Iteration in angle measuring tool. Text label is not ok and handles and arcs
Benjamin Golinvaux <bgo@osimis.io>
parents: 645
diff changeset
58
62f6ff016085 Iteration in angle measuring tool. Text label is not ok and handles and arcs
Benjamin Golinvaux <bgo@osimis.io>
parents: 645
diff changeset
59 /**
62f6ff016085 Iteration in angle measuring tool. Text label is not ok and handles and arcs
Benjamin Golinvaux <bgo@osimis.io>
parents: 645
diff changeset
60 Creates an arc (open curve) with "numSubdivisions" (N + 1 points) from
62f6ff016085 Iteration in angle measuring tool. Text label is not ok and handles and arcs
Benjamin Golinvaux <bgo@osimis.io>
parents: 645
diff changeset
61 start angle to end angle, by following the shortest arc.
62f6ff016085 Iteration in angle measuring tool. Text label is not ok and handles and arcs
Benjamin Golinvaux <bgo@osimis.io>
parents: 645
diff changeset
62
62f6ff016085 Iteration in angle measuring tool. Text label is not ok and handles and arcs
Benjamin Golinvaux <bgo@osimis.io>
parents: 645
diff changeset
63 Warning: the existing chain content will be wiped out.
62f6ff016085 Iteration in angle measuring tool. Text label is not ok and handles and arcs
Benjamin Golinvaux <bgo@osimis.io>
parents: 645
diff changeset
64 */
62f6ff016085 Iteration in angle measuring tool. Text label is not ok and handles and arcs
Benjamin Golinvaux <bgo@osimis.io>
parents: 645
diff changeset
65 void AddShortestArc(
62f6ff016085 Iteration in angle measuring tool. Text label is not ok and handles and arcs
Benjamin Golinvaux <bgo@osimis.io>
parents: 645
diff changeset
66 PolylineSceneLayer::Chain& chain
62f6ff016085 Iteration in angle measuring tool. Text label is not ok and handles and arcs
Benjamin Golinvaux <bgo@osimis.io>
parents: 645
diff changeset
67 , const Scene2D& scene
62f6ff016085 Iteration in angle measuring tool. Text label is not ok and handles and arcs
Benjamin Golinvaux <bgo@osimis.io>
parents: 645
diff changeset
68 , const ScenePoint2D& centerS
62f6ff016085 Iteration in angle measuring tool. Text label is not ok and handles and arcs
Benjamin Golinvaux <bgo@osimis.io>
parents: 645
diff changeset
69 , const double& radiusS
62f6ff016085 Iteration in angle measuring tool. Text label is not ok and handles and arcs
Benjamin Golinvaux <bgo@osimis.io>
parents: 645
diff changeset
70 , const double startAngleRad
62f6ff016085 Iteration in angle measuring tool. Text label is not ok and handles and arcs
Benjamin Golinvaux <bgo@osimis.io>
parents: 645
diff changeset
71 , const double endAngleRad
62f6ff016085 Iteration in angle measuring tool. Text label is not ok and handles and arcs
Benjamin Golinvaux <bgo@osimis.io>
parents: 645
diff changeset
72 , const int subdivisionsCount = 63);
62f6ff016085 Iteration in angle measuring tool. Text label is not ok and handles and arcs
Benjamin Golinvaux <bgo@osimis.io>
parents: 645
diff changeset
73
62f6ff016085 Iteration in angle measuring tool. Text label is not ok and handles and arcs
Benjamin Golinvaux <bgo@osimis.io>
parents: 645
diff changeset
74 #if 0
62f6ff016085 Iteration in angle measuring tool. Text label is not ok and handles and arcs
Benjamin Golinvaux <bgo@osimis.io>
parents: 645
diff changeset
75 /**
62f6ff016085 Iteration in angle measuring tool. Text label is not ok and handles and arcs
Benjamin Golinvaux <bgo@osimis.io>
parents: 645
diff changeset
76 Creates an arc centered on c that goes
645
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
77 - from a point r1:
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
78 - so that r1 belongs to the p1,c line
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
79 - so that the distance from c to r1 equals radius
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
80 - to a point r2:
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
81 - so that r2 belongs to the p2,c line
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
82 - so that the distance from c to r2 equals radius
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
83
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
84 if clockwise is true, the arc is drawn from r1 to r2 with increasing
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
85 angle values. Otherwise, the angle values decrease.
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
86
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
87 Warning: the existing chain content will be wiped out.
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
88 */
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
89
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
90 void AddArc(
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
91 PolylineSceneLayer::Chain& chain
651
62f6ff016085 Iteration in angle measuring tool. Text label is not ok and handles and arcs
Benjamin Golinvaux <bgo@osimis.io>
parents: 645
diff changeset
92 , const Scene2D& scene
62f6ff016085 Iteration in angle measuring tool. Text label is not ok and handles and arcs
Benjamin Golinvaux <bgo@osimis.io>
parents: 645
diff changeset
93 , const ScenePoint2D& p1
62f6ff016085 Iteration in angle measuring tool. Text label is not ok and handles and arcs
Benjamin Golinvaux <bgo@osimis.io>
parents: 645
diff changeset
94 , const ScenePoint2D& c
62f6ff016085 Iteration in angle measuring tool. Text label is not ok and handles and arcs
Benjamin Golinvaux <bgo@osimis.io>
parents: 645
diff changeset
95 , const ScenePoint2D& p2
62f6ff016085 Iteration in angle measuring tool. Text label is not ok and handles and arcs
Benjamin Golinvaux <bgo@osimis.io>
parents: 645
diff changeset
96 , const double& radiusS
62f6ff016085 Iteration in angle measuring tool. Text label is not ok and handles and arcs
Benjamin Golinvaux <bgo@osimis.io>
parents: 645
diff changeset
97 , const bool clockwise
62f6ff016085 Iteration in angle measuring tool. Text label is not ok and handles and arcs
Benjamin Golinvaux <bgo@osimis.io>
parents: 645
diff changeset
98 , const int subdivisionsCount = 63);
62f6ff016085 Iteration in angle measuring tool. Text label is not ok and handles and arcs
Benjamin Golinvaux <bgo@osimis.io>
parents: 645
diff changeset
99
645
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
100 /**
651
62f6ff016085 Iteration in angle measuring tool. Text label is not ok and handles and arcs
Benjamin Golinvaux <bgo@osimis.io>
parents: 645
diff changeset
101 Creates an arc (open curve) with "numSubdivisions" (N + 1 points) from
62f6ff016085 Iteration in angle measuring tool. Text label is not ok and handles and arcs
Benjamin Golinvaux <bgo@osimis.io>
parents: 645
diff changeset
102 start angle to end angle with the supplied radius.
645
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
103
651
62f6ff016085 Iteration in angle measuring tool. Text label is not ok and handles and arcs
Benjamin Golinvaux <bgo@osimis.io>
parents: 645
diff changeset
104 if clockwise is true, the arc is drawn from start to end by increasing the
62f6ff016085 Iteration in angle measuring tool. Text label is not ok and handles and arcs
Benjamin Golinvaux <bgo@osimis.io>
parents: 645
diff changeset
105 angle values.
645
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
106
651
62f6ff016085 Iteration in angle measuring tool. Text label is not ok and handles and arcs
Benjamin Golinvaux <bgo@osimis.io>
parents: 645
diff changeset
107 Otherwise, the angle value decreases from start to end.
645
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
108
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
109 Warning: the existing chain content will be wiped out.
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
110 */
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
111 void AddArc(
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
112 PolylineSceneLayer::Chain& chain
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
113 , const Scene2D& scene
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
114 , const ScenePoint2D& centerS
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
115 , const double& radiusS
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
116 , const double startAngleRad
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
117 , const double endAngleRad
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
118 , const bool clockwise
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
119 , const int subdivisionsCount = 63);
651
62f6ff016085 Iteration in angle measuring tool. Text label is not ok and handles and arcs
Benjamin Golinvaux <bgo@osimis.io>
parents: 645
diff changeset
120 #endif
645
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
121 /**
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
122 Creates a circle (closed curve) with "numSubdivisions"
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
123 (N points)
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
124
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
125 Warning: the existing chain content will be wiped out.
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
126 */
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
127 void AddCircle(PolylineSceneLayer::Chain& chain,
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
128 const Scene2D& scene,
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
129 const ScenePoint2D& centerS,
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
130 const double& radiusS,
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
131 const int numSubdivisions = 63);
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
132
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
133 /**
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
134 Adds or subtracts 2*pi as many times as need to shift the specified
651
62f6ff016085 Iteration in angle measuring tool. Text label is not ok and handles and arcs
Benjamin Golinvaux <bgo@osimis.io>
parents: 645
diff changeset
135 angle to a value such as: -pi <= value < pi
645
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
136 */
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
137 double NormalizeAngle(double angle);
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
138
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
139 /**
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
140 Returns the angle magnitude between the p1,c and p2,c lines.
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
141 The returned angle is between 0 and 2*pi
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
142
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
143 If the angle is between 0 and pi, this means that the shortest arc
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
144 from p1 to p2 is clockwise.
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
145
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
146 If the angle is between pi and 2*pi, this means that the shortest arc
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
147 from p1 to p2 is COUNTERclockwise.
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
148
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
149 */
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
150 double MeasureAngle(
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
151 const ScenePoint2D& p1
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
152 , const ScenePoint2D& c
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
153 , const ScenePoint2D& p2);
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
154
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
155 /**
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
156 RadiansToDegrees
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
157 */
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
158 double RadiansToDegrees(double angleRad);
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
159
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
160 /**
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
161 This function will return the coordinates of a point that:
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
162 - belongs to the two bisecting lines of the p1 c p2 angle.
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
163 - is a distance d from c.
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
164 Among the four possible points, the one returned will be the one belonging
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
165 to the *smallest* half-plane defined by the [c,p1[ and [c,p2[ half-lines.
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
166 */
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
167 void GetPositionOnBisectingLine(
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
168 ScenePoint2D& result
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
169 , const ScenePoint2D& p1
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
170 , const ScenePoint2D& c
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
171 , const ScenePoint2D& p2
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
172 , const double d);
1e9ed656318e Merge + ongoing measure work
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
173 }