File tree 1 file changed +13
-12
lines changed
1 file changed +13
-12
lines changed Original file line number Diff line number Diff line change @@ -220,18 +220,19 @@ struct mEllipse {
220
220
// Ax^2 + Bxy + Cy^2 + Dx + Ey + F = 0
221
221
//
222
222
struct EllipseEquation {
223
- double coeff[7 ]; // coeff[1] = A
224
-
225
- EllipseEquation () {
226
- for (int i = 0 ; i<7 ; i++) coeff[i] = 0 ;
227
- }
228
-
229
- double A () { return coeff[1 ]; }
230
- double B () { return coeff[2 ]; }
231
- double C () { return coeff[3 ]; }
232
- double D () { return coeff[4 ]; }
233
- double E () { return coeff[5 ]; }
234
- double F () { return coeff[6 ]; }
223
+ static constexpr int COEFF_SIZE = 7 ;
224
+ double coeff[COEFF_SIZE]; // coeff[1] = A
225
+
226
+ // Constructor using an initialization list
227
+ EllipseEquation () : coeff{} {}
228
+
229
+ // Accessor functions marked as const
230
+ double A () const { return coeff[1 ]; }
231
+ double B () const { return coeff[2 ]; }
232
+ double C () const { return coeff[3 ]; }
233
+ double D () const { return coeff[4 ]; }
234
+ double E () const { return coeff[5 ]; }
235
+ double F () const { return coeff[6 ]; }
235
236
};
236
237
237
238
// ================================ CIRCLES ================================
You can’t perform that action at this time.
0 commit comments