Skip to content

Commit 1192d7e

Browse files
committed
Update edge_drawing_common.hpp
1 parent 8cc03d4 commit 1192d7e

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

modules/ximgproc/src/edge_drawing_common.hpp

+13-12
Original file line numberDiff line numberDiff line change
@@ -220,18 +220,19 @@ struct mEllipse {
220220
// Ax^2 + Bxy + Cy^2 + Dx + Ey + F = 0
221221
//
222222
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]; }
235236
};
236237

237238
// ================================ CIRCLES ================================

0 commit comments

Comments
 (0)