|
8 | 8 | The class \tcode{arc} describes a path item that adds an arc path segment to a path. |
9 | 9 |
|
10 | 10 | \pnum |
11 | | -It has a \term{radius} of type \tcode{vector_2d}, a \term{rotation} of type \tcode{double}, and a \term{start angle} of type \tcode{double}. |
| 11 | +It has a \term{radius} of type \tcode{vector_2d}, a \term{rotation} of type \tcode{float}, and a \term{start angle} of type \tcode{float}. |
12 | 12 |
|
13 | 13 | \pnum |
14 | 14 | The rotation and start angle are in radians. The arc begins at its start angle and ends at the angle that is rotation radians from the start angle. |
|
34 | 34 | // \ref{\iotwod.arc.cons}, construct/copy/move/destroy: |
35 | 35 | constexpr arc() noexcept; |
36 | 36 | constexpr arc(const vector_2d& rad, |
37 | | - double rot, double sang) noexcept; |
| 37 | + float rot, float sang) noexcept; |
38 | 38 |
|
39 | 39 | // \ref{\iotwod.arc.modifiers}, modifiers: |
40 | 40 | constexpr void radius(const vector_2d& rad) noexcept; |
41 | | - constexpr void rotation(double rot) noexcept; |
42 | | - constexpr void start_angle(double radians) noexcept; |
| 41 | + constexpr void rotation(float rot) noexcept; |
| 42 | + constexpr void start_angle(float radians) noexcept; |
43 | 43 |
|
44 | 44 | // \ref{\iotwod.arc.observers}, observers: |
45 | 45 | constexpr vector_2d radius() const noexcept; |
46 | | - constexpr double rotation() const noexcept; |
47 | | - constexpr double start_angle() const noexcept; |
| 46 | + constexpr float rotation() const noexcept; |
| 47 | + constexpr float start_angle() const noexcept; |
48 | 48 | vector_2d center(const vector_2d& cpt, const matrix_2d& m = matrix_2d{}) |
49 | 49 | const noexcept; |
50 | 50 | vector_2d end_pt(const vector_2d& cpt, const matrix_2d& m = matrix_2d{}) |
|
67 | 67 | \begin{itemdescr} |
68 | 68 | \pnum |
69 | 69 | \effects |
70 | | -Equivalent to: \tcode{arc\{ vector_2d(10.0, 10.0), pi<double>, pi<double> \};}. |
| 70 | +Equivalent to: \tcode{arc\{ vector_2d(10.0f, 10.0f), pi<float>, pi<float> \};}. |
71 | 71 | \end{itemdescr} |
72 | 72 |
|
73 | 73 | \indexlibrary{\idxcode{arc}!constructor}% |
74 | 74 | \begin{itemdecl} |
75 | | -constexpr arc(const vector_2d& rad, double rot, |
76 | | - double start_angle = pi<double>) noexcept; |
| 75 | +constexpr arc(const vector_2d& rad, float rot, |
| 76 | + float start_angle = pi<float>) noexcept; |
77 | 77 | \end{itemdecl} |
78 | 78 | \begin{itemdescr} |
79 | 79 | \pnum |
|
104 | 104 |
|
105 | 105 | \indexlibrarymember{rotation}{arc}% |
106 | 106 | \begin{itemdecl} |
107 | | -constexpr void rotation(double rot) noexcept; |
| 107 | +constexpr void rotation(float rot) noexcept; |
108 | 108 | \end{itemdecl} |
109 | 109 | \begin{itemdescr} |
110 | 110 | \pnum |
|
114 | 114 |
|
115 | 115 | \indexlibrarymember{start_angle}{arc}% |
116 | 116 | \begin{itemdecl} |
117 | | -constexpr void start_angle(double sang) noexcept; |
| 117 | +constexpr void start_angle(float sang) noexcept; |
118 | 118 | \end{itemdecl} |
119 | 119 | \begin{itemdescr} |
120 | 120 | \pnum |
|
136 | 136 |
|
137 | 137 | \indexlibrarymember{rotation}{arc}% |
138 | 138 | \begin{itemdecl} |
139 | | -constexpr double rotation() const noexcept; |
| 139 | +constexpr float rotation() const noexcept; |
140 | 140 | \end{itemdecl} |
141 | 141 | \begin{itemdescr} |
142 | 142 | \pnum |
|
146 | 146 |
|
147 | 147 | \indexlibrarymember{start_angle}{arc}% |
148 | 148 | \begin{itemdecl} |
149 | | -constexpr double start_angle() const noexcept; |
| 149 | +constexpr float start_angle() const noexcept; |
150 | 150 | \end{itemdecl} |
151 | 151 | \begin{itemdescr} |
152 | 152 | \pnum |
|
165 | 165 | As-if: |
166 | 166 | \begin{codeblock} |
167 | 167 | auto lmtx = m; |
168 | | -lmtx.m20(0.0); lmtx.m21(0.0); // Eliminate translation. |
169 | | -auto centerOffset = point_for_angle(two_pi<double> - _Start_angle, _Radius); |
| 168 | +lmtx.m20(0.0f); lmtx.m21(0.0f); // Eliminate translation. |
| 169 | +auto centerOffset = point_for_angle(two_pi<float> - _Start_angle, _Radius); |
170 | 170 | centerOffset.y(-centerOffset.y()); |
171 | 171 | return cpt - centerOffset * lmtx; |
172 | 172 | \end{codeblock} |
|
184 | 184 | \begin{codeblock} |
185 | 185 | auto lmtx = m; |
186 | 186 | auto tfrm = matrix_2d::init_rotate(_Start_angle + _Rotation); |
187 | | -lmtx.m20(0.0); lmtx.m21(0.0); // Eliminate translation. |
| 187 | +lmtx.m20(0.0f); lmtx.m21(0.0f); // Eliminate translation. |
188 | 188 | auto pt = (_Radius * tfrm); |
189 | 189 | pt.y(-pt.y()); |
190 | 190 | return cpt + pt * lmtx; |
|
0 commit comments