diff --git a/examples/avr/display/dogm128/benchmark/main.cpp b/examples/avr/display/dogm128/benchmark/main.cpp index b8989c1dbe..6489192b54 100644 --- a/examples/avr/display/dogm128/benchmark/main.cpp +++ b/examples/avr/display/dogm128/benchmark/main.cpp @@ -129,8 +129,8 @@ introScreen() void drawSpinner(Point center, uint8_t pos) { - const uint8_t x = center.getX(); - const uint8_t y = center.getY(); + const uint8_t x = center.x(); + const uint8_t y = center.y(); switch(pos % 8) { diff --git a/examples/nucleo_f042k6/lis3mdl/main.cpp b/examples/nucleo_f042k6/lis3mdl/main.cpp index 461a11c476..2c1d95e5b6 100644 --- a/examples/nucleo_f042k6/lis3mdl/main.cpp +++ b/examples/nucleo_f042k6/lis3mdl/main.cpp @@ -58,9 +58,9 @@ main() if(success) { MODM_LOG_INFO << "Magnetic Vector:" << modm::endl; - MODM_LOG_INFO << "X: "<< magVector.x << " gauss" << modm::endl; - MODM_LOG_INFO << "Y: "<< magVector.y << " gauss" << modm::endl; - MODM_LOG_INFO << "Z: "<< magVector.z << " gauss" << modm::endl; + MODM_LOG_INFO << "X: "<< magVector.x() << " gauss" << modm::endl; + MODM_LOG_INFO << "Y: "<< magVector.y() << " gauss" << modm::endl; + MODM_LOG_INFO << "Z: "<< magVector.z() << " gauss" << modm::endl; MODM_LOG_INFO << modm::endl; } else diff --git a/examples/nucleo_f042k6/lsm6ds33/main.cpp b/examples/nucleo_f042k6/lsm6ds33/main.cpp index 0c839f9d24..9c9af231f8 100644 --- a/examples/nucleo_f042k6/lsm6ds33/main.cpp +++ b/examples/nucleo_f042k6/lsm6ds33/main.cpp @@ -54,15 +54,15 @@ main() if(accSuccess && gyroSuccess) { MODM_LOG_INFO << "Acceleration Vector:" << modm::endl; - MODM_LOG_INFO << "X: "<< accVector.x << " g" << modm::endl; - MODM_LOG_INFO << "Y: "<< accVector.y << " g" << modm::endl; - MODM_LOG_INFO << "Z: "<< accVector.z << " g" << modm::endl; + MODM_LOG_INFO << "X: "<< accVector.x() << " g" << modm::endl; + MODM_LOG_INFO << "Y: "<< accVector.y() << " g" << modm::endl; + MODM_LOG_INFO << "Z: "<< accVector.z() << " g" << modm::endl; MODM_LOG_INFO << modm::endl; MODM_LOG_INFO << "Spin Rates Vector:" << modm::endl; - MODM_LOG_INFO << "X: "<< gyroVector.x << " deg/s" << modm::endl; - MODM_LOG_INFO << "Y: "<< gyroVector.y << " deg/s" << modm::endl; - MODM_LOG_INFO << "Z: "<< gyroVector.z << " deg/s" << modm::endl; + MODM_LOG_INFO << "X: "<< gyroVector.x() << " deg/s" << modm::endl; + MODM_LOG_INFO << "Y: "<< gyroVector.y() << " deg/s" << modm::endl; + MODM_LOG_INFO << "Z: "<< gyroVector.z() << " deg/s" << modm::endl; MODM_LOG_INFO << modm::endl; } diff --git a/examples/nucleo_f429zi/pat9125el/main.cpp b/examples/nucleo_f429zi/pat9125el/main.cpp index 7a4ea3ea36..9ddb3c845c 100644 --- a/examples/nucleo_f429zi/pat9125el/main.cpp +++ b/examples/nucleo_f429zi/pat9125el/main.cpp @@ -57,7 +57,7 @@ class Thread : public modm::pt::Protothread position += sensor.getData(); Board::Leds::write(0b111); - MODM_LOG_INFO << "Position: " << position.x << ", " << position.y << modm::endl; + MODM_LOG_INFO << "Position: " << position << modm::endl; sensor.resetMoved(); } else { Board::Leds::write(0b000); diff --git a/examples/stm32_f4ve/gui/main.cpp b/examples/stm32_f4ve/gui/main.cpp index 29c27eecaa..a979e96173 100644 --- a/examples/stm32_f4ve/gui/main.cpp +++ b/examples/stm32_f4ve/gui/main.cpp @@ -169,23 +169,23 @@ static void drawCross(modm::ColorGraphicDisplay& display, modm::glcd::Point center) { display.setColor(html::Red); - display.drawLine(center.x - 15, center.y, center.x - 2, center.y); - display.drawLine(center.x + 2, center.y, center.x + 15, center.y); - display.drawLine(center.x, center.y - 15, center.x, center.y - 2); - display.drawLine(center.x, center.y + 2, center.x, center.y + 15); + display.drawLine(center.x() - 15, center.y(), center.x() - 2, center.y()); + display.drawLine(center.x() + 2, center.y(), center.x() + 15, center.y()); + display.drawLine(center.x(), center.y() - 15, center.x(), center.y() - 2); + display.drawLine(center.x(), center.y() + 2, center.x(), center.y() + 15); display.setColor(html::White); - display.drawLine(center.x - 15, center.y + 15, center.x - 7, center.y + 15); - display.drawLine(center.x - 15, center.y + 7, center.x - 15, center.y + 15); + display.drawLine(center.x() - 15, center.y() + 15, center.x() - 7, center.y() + 15); + display.drawLine(center.x() - 15, center.y() + 7, center.x() - 15, center.y() + 15); - display.drawLine(center.x - 15, center.y - 15, center.x - 7, center.y - 15); - display.drawLine(center.x - 15, center.y - 7, center.x - 15, center.y - 15); + display.drawLine(center.x() - 15, center.y() - 15, center.x() - 7, center.y() - 15); + display.drawLine(center.x() - 15, center.y() - 7, center.x() - 15, center.y() - 15); - display.drawLine(center.x + 7, center.y + 15, center.x + 15, center.y + 15); - display.drawLine(center.x + 15, center.y + 7, center.x + 15, center.y + 15); + display.drawLine(center.x() + 7, center.y() + 15, center.x() + 15, center.y() + 15); + display.drawLine(center.x() + 15, center.y() + 7, center.x() + 15, center.y() + 15); - display.drawLine(center.x + 7, center.y - 15, center.x + 15, center.y - 15); - display.drawLine(center.x + 15, center.y - 15, center.x + 15, center.y - 7); + display.drawLine(center.x() + 7, center.y() - 15, center.x() + 15, center.y() - 15); + display.drawLine(center.x() + 15, center.y() - 15, center.x() + 15, center.y() - 7); } static void @@ -211,7 +211,7 @@ calibrateTouchscreen(modm::ColorGraphicDisplay& display, modm::glcd::Point *fixe // wait until a valid sample can be taken } - MODM_LOG_DEBUG << "calibration point: (" << sample[i].x << " | " << sample[i].y << ")" << modm::endl; + MODM_LOG_DEBUG << "calibration point: (" << sample[i].x() << " | " << sample[i].y() << ")" << modm::endl; } touchscreen.calibrate(calibrationPoint, sample); @@ -227,14 +227,14 @@ void drawPoint(modm::GraphicDisplay& display, modm::glcd::Point point) { MODM_LOG_DEBUG << __PRETTY_FUNCTION__ << modm::endl; - if (point.x < 0 || point.y < 0) { + if (point.x() < 0 || point.y() < 0) { return; } - display.setPixel(point.x, point.y); - display.setPixel(point.x + 1, point.y); - display.setPixel(point.x, point.y + 1); - display.setPixel(point.x + 1, point.y + 1); + display.setPixel(point.x(), point.y()); + display.setPixel(point.x() + 1, point.y()); + display.setPixel(point.x(), point.y() + 1); + display.setPixel(point.x() + 1, point.y() + 1); } // ---------------------------------------------------------------------------- @@ -286,8 +286,8 @@ debounceTouch(modm::glcd::Point *out, modm::glcd::Point *old) // translate point according to calibration touchscreen.translate(&raw, &point); - if(abs(point.x - old->x) < TP_TOLERANCE && - abs(point.y - old->y) < TP_TOLERANCE + if(abs(point.x() - old->x()) < TP_TOLERANCE && + abs(point.y() - old->y()) < TP_TOLERANCE ) { // point is within area of last touch @@ -321,8 +321,8 @@ touchUp(void* data) modm::gui::InputEvent* ev = static_cast(data); MODM_LOG_DEBUG << "asynchronous UP-event:" << modm::endl; - MODM_LOG_DEBUG << "x: " << ev->coord.x << modm::endl; - MODM_LOG_DEBUG << "y: " << ev->coord.y << modm::endl; + MODM_LOG_DEBUG << "x: " << ev->coord.x() << modm::endl; + MODM_LOG_DEBUG << "y: " << ev->coord.y() << modm::endl; // queue UP-event as new input event input_queue.push(ev); @@ -351,8 +351,8 @@ gatherInput() auto async_ev = new modm::gui::AsyncEvent(500, &touchUp, (void*)(ev_up)); async_events.append(async_ev); - MODM_LOG_DEBUG << "touch down x: " << point.x << modm::endl; - MODM_LOG_DEBUG << "touch down y: " << point.y << modm::endl; + MODM_LOG_DEBUG << "touch down x: " << point.x() << modm::endl; + MODM_LOG_DEBUG << "touch down y: " << point.y() << modm::endl; } } @@ -492,11 +492,11 @@ main() /* * display an arbitrary image */ - // if(pixPos.x < 0 || (pixPos.x + pix[0]) > tft.getWidth()){ - // pixDeltaPos.x *= -1; + // if(pixPos.x() < 0 || (pixPos.x() + pix[0]) > tft.getWidth()){ + // pixDeltaPos.x() *= -1; // } - // if(pixPos.y < 0 || (pixPos.y + pix[1]) > tft.getHeight()){ - // pixDeltaPos.y *= -1; + // if(pixPos.y() < 0 || (pixPos.y() + pix[1]) > tft.getHeight()){ + // pixDeltaPos.y() *= -1; // } // pixPos += pixDeltaPos; // tft.drawImage(pixPos, pix); diff --git a/examples/stm32_f4ve/gui/touchscreen_calibrator.hpp b/examples/stm32_f4ve/gui/touchscreen_calibrator.hpp index 9fe858941a..f8fefd47be 100644 --- a/examples/stm32_f4ve/gui/touchscreen_calibrator.hpp +++ b/examples/stm32_f4ve/gui/touchscreen_calibrator.hpp @@ -56,34 +56,34 @@ modm::TouchscreenCalibrator::calibrate( modm::glcd::Point * display, modm::glcd::Point * sample) { // K��(X0��X2) (Y1��Y2)��(X1��X2) (Y0��Y2) - scale = ((sample[0].x - sample[2].x) * (sample[1].y - sample[2].y)) - - ((sample[1].x - sample[2].x) * (sample[0].y - sample[2].y)); + scale = ((sample[0].x() - sample[2].x()) * (sample[1].y() - sample[2].y())) - + ((sample[1].x() - sample[2].x()) * (sample[0].y() - sample[2].y())); if (scale == 0) { return false; } // A��((XD0��XD2) (Y1��Y2)��(XD1��XD2) (Y0��Y2))��K - An = ((display[0].x - display[2].x) * (sample[1].y - sample[2].y)) - - ((display[1].x - display[2].x) * (sample[0].y - sample[2].y)); + An = ((display[0].x() - display[2].x()) * (sample[1].y() - sample[2].y())) - + ((display[1].x() - display[2].x()) * (sample[0].y() - sample[2].y())); // B��((X0��X2) (XD1��XD2)��(XD0��XD2) (X1��X2))��K */ - Bn = ((sample[0].x - sample[2].x) * (display[1].x - display[2].x)) - - ((display[0].x - display[2].x) * (sample[1].x - sample[2].x)); + Bn = ((sample[0].x() - sample[2].x()) * (display[1].x() - display[2].x())) - + ((display[0].x() - display[2].x()) * (sample[1].x() - sample[2].x())); // C��(Y0(X2XD1��X1XD2)+Y1(X0XD2��X2XD0)+Y2(X1XD0��X0XD1))��K */ - Cn = (sample[2].x * display[1].x - sample[1].x * display[2].x) * sample[0].y + - (sample[0].x * display[2].x - sample[2].x * display[0].x) * sample[1].y + - (sample[1].x * display[0].x - sample[0].x * display[1].x) * sample[2].y; + Cn = (sample[2].x() * display[1].x() - sample[1].x() * display[2].x()) * sample[0].y() + + (sample[0].x() * display[2].x() - sample[2].x() * display[0].x()) * sample[1].y() + + (sample[1].x() * display[0].x() - sample[0].x() * display[1].x()) * sample[2].y(); // D��((YD0��YD2) (Y1��Y2)��(YD1��YD2) (Y0��Y2))��K */ - Dn = ((display[0].y - display[2].y) * (sample[1].y - sample[2].y)) - - ((display[1].y - display[2].y) * (sample[0].y - sample[2].y)); + Dn = ((display[0].y() - display[2].y()) * (sample[1].y() - sample[2].y())) - + ((display[1].y() - display[2].y()) * (sample[0].y() - sample[2].y())); // E��((X0��X2) (YD1��YD2)��(YD0��YD2) (X1��X2))��K */ - En = ((sample[0].x - sample[2].x) * (display[1].y - display[2].y)) - - ((display[0].y - display[2].y) * (sample[1].x - sample[2].x)); + En = ((sample[0].x() - sample[2].x()) * (display[1].y() - display[2].y())) - + ((display[0].y() - display[2].y()) * (sample[1].x() - sample[2].x())); // F��(Y0(X2YD1��X1YD2)+Y1(X0YD2��X2YD0)+Y2(X1YD0��X0YD1))��K */ - Fn = (sample[2].x * display[1].y - sample[1].x * display[2].y) * sample[0].y + - (sample[0].x * display[2].y - sample[2].x * display[0].y) * sample[1].y + - (sample[1].x * display[0].y - sample[0].x * display[1].y) * sample[2].y; + Fn = (sample[2].x() * display[1].y() - sample[1].x() * display[2].y()) * sample[0].y() + + (sample[0].x() * display[2].y() - sample[2].x() * display[0].y()) * sample[1].y() + + (sample[1].x() * display[0].y() - sample[0].x() * display[1].y()) * sample[2].y(); return true; } @@ -94,12 +94,12 @@ modm::TouchscreenCalibrator::translate(modm::glcd::Point * raw, modm::glcd::Poin if (scale != 0) { /* XD = AX+BY+C */ - translated->x = - ((An * raw->x) + - (Bn * raw->y) + Cn) / scale; + translated->x() = + ((An * raw->x()) + + (Bn * raw->y()) + Cn) / scale; /* YD = DX+EY+F */ - translated->y = - ((Dn * raw->x) + - (En * raw->y) + Fn) / scale; + translated->y() = + ((Dn * raw->x()) + + (En * raw->y()) + Fn) / scale; } } diff --git a/examples/stm32f4_discovery/open407v-d/gui/main.cpp b/examples/stm32f4_discovery/open407v-d/gui/main.cpp index 994beaf434..f1e97a8d03 100644 --- a/examples/stm32f4_discovery/open407v-d/gui/main.cpp +++ b/examples/stm32f4_discovery/open407v-d/gui/main.cpp @@ -178,23 +178,23 @@ static void drawCross(modm::ColorGraphicDisplay& display, modm::glcd::Point center) { display.setColor(Red); - display.drawLine(center.x - 15, center.y, center.x - 2, center.y); - display.drawLine(center.x + 2, center.y, center.x + 15, center.y); - display.drawLine(center.x, center.y - 15, center.x, center.y - 2); - display.drawLine(center.x, center.y + 2, center.x, center.y + 15); + display.drawLine(center.x() - 15, center.y(), center.x() - 2, center.y()); + display.drawLine(center.x() + 2, center.y(), center.x() + 15, center.y()); + display.drawLine(center.x(), center.y() - 15, center.x(), center.y() - 2); + display.drawLine(center.x(), center.y() + 2, center.x(), center.y() + 15); display.setColor(White); - display.drawLine(center.x - 15, center.y + 15, center.x - 7, center.y + 15); - display.drawLine(center.x - 15, center.y + 7, center.x - 15, center.y + 15); + display.drawLine(center.x() - 15, center.y() + 15, center.x() - 7, center.y() + 15); + display.drawLine(center.x() - 15, center.y() + 7, center.x() - 15, center.y() + 15); - display.drawLine(center.x - 15, center.y - 15, center.x - 7, center.y - 15); - display.drawLine(center.x - 15, center.y - 7, center.x - 15, center.y - 15); + display.drawLine(center.x() - 15, center.y() - 15, center.x() - 7, center.y() - 15); + display.drawLine(center.x() - 15, center.y() - 7, center.x() - 15, center.y() - 15); - display.drawLine(center.x + 7, center.y + 15, center.x + 15, center.y + 15); - display.drawLine(center.x + 15, center.y + 7, center.x + 15, center.y + 15); + display.drawLine(center.x() + 7, center.y() + 15, center.x() + 15, center.y() + 15); + display.drawLine(center.x() + 15, center.y() + 7, center.x() + 15, center.y() + 15); - display.drawLine(center.x + 7, center.y - 15, center.x + 15, center.y - 15); - display.drawLine(center.x + 15, center.y - 15, center.x + 15, center.y - 7); + display.drawLine(center.x() + 7, center.y() - 15, center.x() + 15, center.y() - 15); + display.drawLine(center.x() + 15, center.y() - 15, center.x() + 15, center.y() - 7); } static void @@ -219,7 +219,7 @@ calibrateTouchscreen(modm::ColorGraphicDisplay& display, modm::glcd::Point *fixe // wait until a valid sample can be taken } - MODM_LOG_DEBUG << "calibration point: (" << sample[i].x << " | " << sample[i].y << ")" << modm::endl; + MODM_LOG_DEBUG << "calibration point: (" << sample[i].x() << " | " << sample[i].y() << ")" << modm::endl; } touchscreen.calibrate(calibrationPoint, sample); @@ -234,14 +234,14 @@ calibrateTouchscreen(modm::ColorGraphicDisplay& display, modm::glcd::Point *fixe void drawPoint(modm::GraphicDisplay& display, modm::glcd::Point point) { - if (point.x < 0 || point.y < 0) { + if (point.x() < 0 || point.y() < 0) { return; } - display.setPixel(point.x, point.y); - display.setPixel(point.x + 1, point.y); - display.setPixel(point.x, point.y + 1); - display.setPixel(point.x + 1, point.y + 1); + display.setPixel(point.x(), point.y()); + display.setPixel(point.x() + 1, point.y()); + display.setPixel(point.x(), point.y() + 1); + display.setPixel(point.x() + 1, point.y() + 1); } // ---------------------------------------------------------------------------- @@ -293,8 +293,8 @@ debounceTouch(modm::glcd::Point *out, modm::glcd::Point *old) // translate point according to calibration touchscreen.translate(&raw, &point); - if(abs(point.x - old->x) < TP_TOLERANCE && - abs(point.y - old->y) < TP_TOLERANCE + if(abs(point.x() - old->x()) < TP_TOLERANCE && + abs(point.y() - old->y()) < TP_TOLERANCE ) { // point is within area of last touch @@ -327,8 +327,8 @@ touchUp(void* data) modm::gui::InputEvent* ev = static_cast(data); MODM_LOG_DEBUG << "asynchronous UP-event:" << modm::endl; - MODM_LOG_DEBUG << "x: " << ev->coord.x << modm::endl; - MODM_LOG_DEBUG << "y: " << ev->coord.y << modm::endl; + MODM_LOG_DEBUG << "x: " << ev->coord.x() << modm::endl; + MODM_LOG_DEBUG << "y: " << ev->coord.y() << modm::endl; // queue UP-event as new input event input_queue.push(ev); @@ -358,8 +358,8 @@ gatherInput() auto async_ev = new modm::gui::AsyncEvent(500, &touchUp, (void*)(ev_up)); async_events.append(async_ev); - MODM_LOG_DEBUG << "touch down x: " << point.x << modm::endl; - MODM_LOG_DEBUG << "touch down y: " << point.y << modm::endl; + MODM_LOG_DEBUG << "touch down x: " << point.x() << modm::endl; + MODM_LOG_DEBUG << "touch down y: " << point.y() << modm::endl; } } diff --git a/examples/stm32f4_discovery/open407v-d/gui/touchscreen_calibrator.hpp b/examples/stm32f4_discovery/open407v-d/gui/touchscreen_calibrator.hpp index 27c60664a9..3670852be2 100644 --- a/examples/stm32f4_discovery/open407v-d/gui/touchscreen_calibrator.hpp +++ b/examples/stm32f4_discovery/open407v-d/gui/touchscreen_calibrator.hpp @@ -59,34 +59,34 @@ modm::TouchscreenCalibrator::calibrate( modm::glcd::Point * display, modm::glcd::Point * sample) { // K��(X0��X2) (Y1��Y2)��(X1��X2) (Y0��Y2) - scale = ((sample[0].x - sample[2].x) * (sample[1].y - sample[2].y)) - - ((sample[1].x - sample[2].x) * (sample[0].y - sample[2].y)); + scale = ((sample[0].x() - sample[2].x()) * (sample[1].y() - sample[2].y())) - + ((sample[1].x() - sample[2].x()) * (sample[0].y() - sample[2].y())); if (scale == 0) { return false; } // A��((XD0��XD2) (Y1��Y2)��(XD1��XD2) (Y0��Y2))��K - An = ((display[0].x - display[2].x) * (sample[1].y - sample[2].y)) - - ((display[1].x - display[2].x) * (sample[0].y - sample[2].y)); + An = ((display[0].x() - display[2].x()) * (sample[1].y() - sample[2].y())) - + ((display[1].x() - display[2].x()) * (sample[0].y() - sample[2].y())); // B��((X0��X2) (XD1��XD2)��(XD0��XD2) (X1��X2))��K */ - Bn = ((sample[0].x - sample[2].x) * (display[1].x - display[2].x)) - - ((display[0].x - display[2].x) * (sample[1].x - sample[2].x)); + Bn = ((sample[0].x() - sample[2].x()) * (display[1].x() - display[2].x())) - + ((display[0].x() - display[2].x()) * (sample[1].x() - sample[2].x())); // C��(Y0(X2XD1��X1XD2)+Y1(X0XD2��X2XD0)+Y2(X1XD0��X0XD1))��K */ - Cn = (sample[2].x * display[1].x - sample[1].x * display[2].x) * sample[0].y + - (sample[0].x * display[2].x - sample[2].x * display[0].x) * sample[1].y + - (sample[1].x * display[0].x - sample[0].x * display[1].x) * sample[2].y; + Cn = (sample[2].x() * display[1].x() - sample[1].x() * display[2].x()) * sample[0].y() + + (sample[0].x() * display[2].x() - sample[2].x() * display[0].x()) * sample[1].y() + + (sample[1].x() * display[0].x() - sample[0].x() * display[1].x()) * sample[2].y(); // D��((YD0��YD2) (Y1��Y2)��(YD1��YD2) (Y0��Y2))��K */ - Dn = ((display[0].y - display[2].y) * (sample[1].y - sample[2].y)) - - ((display[1].y - display[2].y) * (sample[0].y - sample[2].y)); + Dn = ((display[0].y() - display[2].y()) * (sample[1].y() - sample[2].y())) - + ((display[1].y() - display[2].y()) * (sample[0].y() - sample[2].y())); // E��((X0��X2) (YD1��YD2)��(YD0��YD2) (X1��X2))��K */ - En = ((sample[0].x - sample[2].x) * (display[1].y - display[2].y)) - - ((display[0].y - display[2].y) * (sample[1].x - sample[2].x)); + En = ((sample[0].x() - sample[2].x()) * (display[1].y() - display[2].y())) - + ((display[0].y() - display[2].y()) * (sample[1].x() - sample[2].x())); // F��(Y0(X2YD1��X1YD2)+Y1(X0YD2��X2YD0)+Y2(X1YD0��X0YD1))��K */ - Fn = (sample[2].x * display[1].y - sample[1].x * display[2].y) * sample[0].y + - (sample[0].x * display[2].y - sample[2].x * display[0].y) * sample[1].y + - (sample[1].x * display[0].y - sample[0].x * display[1].y) * sample[2].y; + Fn = (sample[2].x() * display[1].y() - sample[1].x() * display[2].y()) * sample[0].y() + + (sample[0].x() * display[2].y() - sample[2].x() * display[0].y()) * sample[1].y() + + (sample[1].x() * display[0].y() - sample[0].x() * display[1].y()) * sample[2].y(); return true; } @@ -97,12 +97,12 @@ modm::TouchscreenCalibrator::translate(modm::glcd::Point * raw, modm::glcd::Poin if (scale != 0) { /* XD = AX+BY+C */ - translated->x = - ((An * raw->x) + - (Bn * raw->y) + Cn) / scale; + translated->x() = + ((An * raw->x()) + + (Bn * raw->y()) + Cn) / scale; /* YD = DX+EY+F */ - translated->y = - ((Dn * raw->x) + - (En * raw->y) + Fn) / scale; + translated->y() = + ((Dn * raw->x()) + + (En * raw->y()) + Fn) / scale; } } diff --git a/examples/stm32f4_discovery/open407v-d/touchscreen/main.cpp b/examples/stm32f4_discovery/open407v-d/touchscreen/main.cpp index c82fbdc9bb..7495adcb96 100644 --- a/examples/stm32f4_discovery/open407v-d/touchscreen/main.cpp +++ b/examples/stm32f4_discovery/open407v-d/touchscreen/main.cpp @@ -135,23 +135,23 @@ static void drawCross(modm::ColorGraphicDisplay& display, modm::glcd::Point center) { display.setColor(Red); - display.drawLine(center.x - 15, center.y, center.x - 2, center.y); - display.drawLine(center.x + 2, center.y, center.x + 15, center.y); - display.drawLine(center.x, center.y - 15, center.x, center.y - 2); - display.drawLine(center.x, center.y + 2, center.x, center.y + 15); + display.drawLine(center.x()- 15, center.y(), center.x()- 2, center.y()); + display.drawLine(center.x()+ 2, center.y(), center.x()+ 15, center.y()); + display.drawLine(center.x(), center.y() - 15, center.x(), center.y() - 2); + display.drawLine(center.x(), center.y() + 2, center.x(), center.y() + 15); display.setColor(White); - display.drawLine(center.x - 15, center.y + 15, center.x - 7, center.y + 15); - display.drawLine(center.x - 15, center.y + 7, center.x - 15, center.y + 15); + display.drawLine(center.x()- 15, center.y() + 15, center.x()- 7, center.y() + 15); + display.drawLine(center.x()- 15, center.y() + 7, center.x()- 15, center.y() + 15); - display.drawLine(center.x - 15, center.y - 15, center.x - 7, center.y - 15); - display.drawLine(center.x - 15, center.y - 7, center.x - 15, center.y - 15); + display.drawLine(center.x()- 15, center.y() - 15, center.x()- 7, center.y() - 15); + display.drawLine(center.x()- 15, center.y() - 7, center.x()- 15, center.y() - 15); - display.drawLine(center.x + 7, center.y + 15, center.x + 15, center.y + 15); - display.drawLine(center.x + 15, center.y + 7, center.x + 15, center.y + 15); + display.drawLine(center.x()+ 7, center.y() + 15, center.x()+ 15, center.y() + 15); + display.drawLine(center.x()+ 15, center.y() + 7, center.x()+ 15, center.y() + 15); - display.drawLine(center.x + 7, center.y - 15, center.x + 15, center.y - 15); - display.drawLine(center.x + 15, center.y - 15, center.x + 15, center.y - 7); + display.drawLine(center.x()+ 7, center.y() - 15, center.x()+ 15, center.y() - 15); + display.drawLine(center.x()+ 15, center.y() - 15, center.x()+ 15, center.y() - 7); } static void @@ -184,14 +184,14 @@ calibrateTouchscreen(modm::ColorGraphicDisplay& display) void drawPoint(modm::GraphicDisplay& display, modm::glcd::Point point) { - if (point.x < 0 || point.y < 0) { + if (point.x()< 0 || point.y() < 0) { return; } - display.setPixel(point.x, point.y); - display.setPixel(point.x + 1, point.y); - display.setPixel(point.x, point.y + 1); - display.setPixel(point.x + 1, point.y + 1); + display.setPixel(point.x(), point.y()); + display.setPixel(point.x()+ 1, point.y()); + display.setPixel(point.x(), point.y() + 1); + display.setPixel(point.x()+ 1, point.y() + 1); } // ---------------------------------------------------------------------------- diff --git a/examples/stm32f4_discovery/open407v-d/touchscreen/touchscreen_calibrator.hpp b/examples/stm32f4_discovery/open407v-d/touchscreen/touchscreen_calibrator.hpp index dacb51c44f..35a6ff26a6 100644 --- a/examples/stm32f4_discovery/open407v-d/touchscreen/touchscreen_calibrator.hpp +++ b/examples/stm32f4_discovery/open407v-d/touchscreen/touchscreen_calibrator.hpp @@ -58,34 +58,34 @@ modm::TouchscreenCalibrator::calibrate( modm::glcd::Point * display, modm::glcd::Point * sample) { // K��(X0��X2) (Y1��Y2)��(X1��X2) (Y0��Y2) - scale = ((sample[0].x - sample[2].x) * (sample[1].y - sample[2].y)) - - ((sample[1].x - sample[2].x) * (sample[0].y - sample[2].y)); + scale = ((sample[0].x() - sample[2].x()) * (sample[1].y() - sample[2].y())) - + ((sample[1].x() - sample[2].x()) * (sample[0].y() - sample[2].y())); if (scale == 0) { return false; } // A��((XD0��XD2) (Y1��Y2)��(XD1��XD2) (Y0��Y2))��K - An = ((display[0].x - display[2].x) * (sample[1].y - sample[2].y)) - - ((display[1].x - display[2].x) * (sample[0].y - sample[2].y)); + An = ((display[0].x() - display[2].x()) * (sample[1].y() - sample[2].y())) - + ((display[1].x() - display[2].x()) * (sample[0].y() - sample[2].y())); // B��((X0��X2) (XD1��XD2)��(XD0��XD2) (X1��X2))��K */ - Bn = ((sample[0].x - sample[2].x) * (display[1].x - display[2].x)) - - ((display[0].x - display[2].x) * (sample[1].x - sample[2].x)); + Bn = ((sample[0].x() - sample[2].x()) * (display[1].x() - display[2].x())) - + ((display[0].x() - display[2].x()) * (sample[1].x() - sample[2].x())); // C��(Y0(X2XD1��X1XD2)+Y1(X0XD2��X2XD0)+Y2(X1XD0��X0XD1))��K */ - Cn = (sample[2].x * display[1].x - sample[1].x * display[2].x) * sample[0].y + - (sample[0].x * display[2].x - sample[2].x * display[0].x) * sample[1].y + - (sample[1].x * display[0].x - sample[0].x * display[1].x) * sample[2].y; + Cn = (sample[2].x() * display[1].x() - sample[1].x() * display[2].x()) * sample[0].y() + + (sample[0].x() * display[2].x() - sample[2].x() * display[0].x()) * sample[1].y() + + (sample[1].x() * display[0].x() - sample[0].x() * display[1].x()) * sample[2].y(); // D��((YD0��YD2) (Y1��Y2)��(YD1��YD2) (Y0��Y2))��K */ - Dn = ((display[0].y - display[2].y) * (sample[1].y - sample[2].y)) - - ((display[1].y - display[2].y) * (sample[0].y - sample[2].y)); + Dn = ((display[0].y() - display[2].y()) * (sample[1].y() - sample[2].y())) - + ((display[1].y() - display[2].y()) * (sample[0].y() - sample[2].y())); // E��((X0��X2) (YD1��YD2)��(YD0��YD2) (X1��X2))��K */ - En = ((sample[0].x - sample[2].x) * (display[1].y - display[2].y)) - - ((display[0].y - display[2].y) * (sample[1].x - sample[2].x)); + En = ((sample[0].x() - sample[2].x()) * (display[1].y() - display[2].y())) - + ((display[0].y() - display[2].y()) * (sample[1].x() - sample[2].x())); // F��(Y0(X2YD1��X1YD2)+Y1(X0YD2��X2YD0)+Y2(X1YD0��X0YD1))��K */ - Fn = (sample[2].x * display[1].y - sample[1].x * display[2].y) * sample[0].y + - (sample[0].x * display[2].y - sample[2].x * display[0].y) * sample[1].y + - (sample[1].x * display[0].y - sample[0].x * display[1].y) * sample[2].y; + Fn = (sample[2].x() * display[1].y() - sample[1].x() * display[2].y()) * sample[0].y() + + (sample[0].x() * display[2].y() - sample[2].x() * display[0].y()) * sample[1].y() + + (sample[1].x() * display[0].y() - sample[0].x() * display[1].y()) * sample[2].y(); return true; } @@ -96,12 +96,12 @@ modm::TouchscreenCalibrator::translate(modm::glcd::Point * raw, modm::glcd::Poin if (scale != 0) { /* XD = AX+BY+C */ - translated->x = - ((An * raw->x) + - (Bn * raw->y) + Cn) / scale; + translated->x() = + ((An * raw->x()) + + (Bn * raw->y()) + Cn) / scale; /* YD = DX+EY+F */ - translated->y = - ((Dn * raw->x) + - (En * raw->y) + Fn) / scale; + translated->y() = + ((Dn * raw->x()) + + (En * raw->y()) + Fn) / scale; } } diff --git a/src/modm/driver/display/ili9341_impl.hpp b/src/modm/driver/display/ili9341_impl.hpp index d44ce85c69..07756489c5 100644 --- a/src/modm/driver/display/ili9341_impl.hpp +++ b/src/modm/driver/display/ili9341_impl.hpp @@ -209,7 +209,7 @@ Ili9341::drawHorizontalLine( BatchHandle h(*this); - setClipping(start.getX(), start.getY(), length, 1); + setClipping(start.x(), start.y(), length, 1); while (length > BufferSize) { this->writeData(buffer, BufferSize * 2); @@ -230,7 +230,7 @@ Ili9341::drawVerticalLine( BatchHandle h(*this); - setClipping(start.getX(), start.getY(), 1, length); + setClipping(start.x(), start.y(), 1, length); while (length > BufferSize) { this->writeData(buffer, BufferSize * 2); @@ -244,8 +244,8 @@ void Ili9341::fillRectangle( glcd::Point upperLeft, uint16_t width, uint16_t height) { - auto const x { upperLeft.getX() }; - auto const y { upperLeft.getY() }; + auto const x { upperLeft.x() }; + auto const y { upperLeft.y() }; std::size_t pixelCount { std::size_t(width) * std::size_t(height) }; uint16_t const pixelValue { modm::toBigEndian(foregroundColor.color) }; @@ -281,7 +281,7 @@ Ili9341::fillCircle( BatchHandle h(*this); - setClipping(center.getX() - radius, center.getY(), 2 * radius, 1); + setClipping(center.x() - radius, center.y(), 2 * radius, 1); for (std::size_t i = 0; i < 2 * radius; ++i) this->writeData(setColor, 2); @@ -297,16 +297,16 @@ Ili9341::fillCircle( ddF_x += 2; f += ddF_x + 1; - setClipping(center.getX() - x, center.getY() - y, 2 * x, 1); + setClipping(center.x() - x, center.y() - y, 2 * x, 1); for (std::size_t i = 0; i < 2 * x; ++i) this->writeData(setColor, 2); - setClipping(center.getX() - y, center.getY() - x, 2 * y, 1); + setClipping(center.x() - y, center.y() - x, 2 * y, 1); for (std::size_t i = 0; i < 2 * y; ++i) this->writeData(setColor, 2); - setClipping(center.getX() - x, center.getY() + y, 2 * x, 1); + setClipping(center.x() - x, center.y() + y, 2 * x, 1); for (std::size_t i = 0; i < 2 * x; ++i) this->writeData(setColor, 2); - setClipping(center.getX() - y, center.getY() + x, 2 * y, 1); + setClipping(center.x() - y, center.y() + x, 2 * y, 1); for (std::size_t i = 0; i < 2 * y; ++i) this->writeData(setColor, 2); } @@ -324,7 +324,7 @@ Ili9341::drawImageRaw(glcd::Point upper BatchHandle h(*this); - setClipping(upperLeft.getX(), upperLeft.getY(), width, height); + setClipping(upperLeft.x(), upperLeft.y(), width, height); uint8_t bit = 0x01; for (uint16_t r = 0; r < height; ++r) @@ -356,7 +356,7 @@ Ili9341::drawRaw(glcd::Point upperLeft, buffer[i] = modm::fromBigEndian(buffer[i]); } - setClipping(upperLeft.getX(), upperLeft.getY(), width, height); + setClipping(upperLeft.x(), upperLeft.y(), width, height); this->writeData((uint8_t*)buffer, width * height * 2); } @@ -428,7 +428,7 @@ Ili9341::drawBitmap(glcd::Point upperLe { BatchHandle h(*this); - setClipping(upperLeft.getX(), upperLeft.getY(), width, height); + setClipping(upperLeft.x(), upperLeft.y(), width, height); for (int i = 0; i < width * height; ++i) { buffer[0] = data[i*2+1]; buffer[1] = data[i*2]; diff --git a/src/modm/driver/inertial/bno055.hpp b/src/modm/driver/inertial/bno055.hpp index b4abbd387e..6bff7c18f4 100644 --- a/src/modm/driver/inertial/bno055.hpp +++ b/src/modm/driver/inertial/bno055.hpp @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include namespace modm diff --git a/src/modm/driver/inertial/lis3mdl.hpp b/src/modm/driver/inertial/lis3mdl.hpp index b042f664af..7cbd775b4f 100644 --- a/src/modm/driver/inertial/lis3mdl.hpp +++ b/src/modm/driver/inertial/lis3mdl.hpp @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include "lis3_transport.hpp" namespace modm diff --git a/src/modm/driver/inertial/lis3mdl_impl.hpp b/src/modm/driver/inertial/lis3mdl_impl.hpp index 6e038c4e22..5694905147 100644 --- a/src/modm/driver/inertial/lis3mdl_impl.hpp +++ b/src/modm/driver/inertial/lis3mdl_impl.hpp @@ -81,9 +81,7 @@ modm::Lis3mdl::readMagnetometerRaw(Vector3i& data) success = RF_CALL(this->read(static_cast(Register::OUT_X_L),reinterpret_cast(readBuffer),6)); if(success) { - data.x = readBuffer[0]; - data.y = readBuffer[1]; - data.z = readBuffer[2]; + data = readBuffer; } RF_END_RETURN(success); } @@ -102,9 +100,8 @@ modm::Lis3mdl::readMagnetometer(Vector3f& data) uint8_t scaleIndex = (static_cast(getScale()))>>5; float conversionValue = convTable[scaleIndex]; - data.x = static_cast(readBuffer[0]) * conversionValue; - data.y = static_cast(readBuffer[1]) * conversionValue; - data.z = static_cast(readBuffer[2]) * conversionValue; + data = readBuffer; + data *= conversionValue; } RF_END_RETURN(success); diff --git a/src/modm/driver/inertial/lsm6ds33.hpp b/src/modm/driver/inertial/lsm6ds33.hpp index 8cff8be54a..6ba6c1c779 100644 --- a/src/modm/driver/inertial/lsm6ds33.hpp +++ b/src/modm/driver/inertial/lsm6ds33.hpp @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include "lis3_transport.hpp" namespace modm diff --git a/src/modm/driver/inertial/lsm6ds33_impl.hpp b/src/modm/driver/inertial/lsm6ds33_impl.hpp index 5e6e458202..727d873cbf 100644 --- a/src/modm/driver/inertial/lsm6ds33_impl.hpp +++ b/src/modm/driver/inertial/lsm6ds33_impl.hpp @@ -51,11 +51,8 @@ modm::Lsm6ds33::readAccelerationRaw(Vector3i& acceleration) { RF_BEGIN(); success = RF_CALL(this->read(static_cast(Register::OUT_X_L_XL),reinterpret_cast(readBuffer),6)); - if(success) - { - acceleration.x = readBuffer[0]; - acceleration.y = readBuffer[1]; - acceleration.z = readBuffer[2]; + if(success) { + acceleration = readBuffer; } RF_END_RETURN(success); } @@ -66,11 +63,8 @@ modm::Lsm6ds33::readGyroscopeRaw(Vector3i& spinRates) { RF_BEGIN(); success = RF_CALL(this->read(static_cast(Register::OUT_X_L_G),reinterpret_cast(readBuffer),6)); - if(success) - { - spinRates.x = readBuffer[0]; - spinRates.y = readBuffer[1]; - spinRates.z = readBuffer[2]; + if(success) { + spinRates = readBuffer; } RF_END_RETURN(success); } @@ -102,9 +96,8 @@ modm::Lsm6ds33::readAcceleration(Vector3f& acceleration) uint8_t accScaleIndex = (static_cast(getAccelerationScale()))>>2; float conversionValue = accConvTable[accScaleIndex]; - acceleration.x = static_cast(readBuffer[0]) * conversionValue; - acceleration.y = static_cast(readBuffer[1]) * conversionValue; - acceleration.z = static_cast(readBuffer[2]) * conversionValue; + acceleration = readBuffer; + acceleration *= conversionValue; } RF_END_RETURN(success); @@ -133,9 +126,9 @@ modm::Lsm6ds33::readGyroscope(Vector3f& acceleration) conversionValue = gyroConvTable[gyroScaleIndex]; } - acceleration.x = static_cast(readBuffer[0]) * conversionValue; - acceleration.y = static_cast(readBuffer[1]) * conversionValue; - acceleration.z = static_cast(readBuffer[2]) * conversionValue; + acceleration.x() = static_cast(readBuffer[0]) * conversionValue; + acceleration.y() = static_cast(readBuffer[1]) * conversionValue; + acceleration.z() = static_cast(readBuffer[2]) * conversionValue; } RF_END_RETURN(success); diff --git a/src/modm/driver/motion/pat9125el.hpp b/src/modm/driver/motion/pat9125el.hpp index 24d2fad6df..ada839f20f 100644 --- a/src/modm/driver/motion/pat9125el.hpp +++ b/src/modm/driver/motion/pat9125el.hpp @@ -15,7 +15,7 @@ #include #include #include -#include +#include namespace modm { diff --git a/src/modm/driver/motion/pat9125el_impl.hpp b/src/modm/driver/motion/pat9125el_impl.hpp index 35766fe3eb..b76e6dae0b 100644 --- a/src/modm/driver/motion/pat9125el_impl.hpp +++ b/src/modm/driver/motion/pat9125el_impl.hpp @@ -111,8 +111,8 @@ Pat9125el::updateData() const int16_t y = (readBuffer[1] | ((readBuffer[2] & 0b00001111) << 8)); // convert 12-bit 2's complement data to 16-bit signed int - data.x = static_cast(x << 4) >> 4; - data.y = static_cast(y << 4) >> 4; + data.x() = static_cast(x << 4) >> 4; + data.y() = static_cast(y << 4) >> 4; moved = true; } diff --git a/src/modm/driver/touch/ads7843_impl.hpp b/src/modm/driver/touch/ads7843_impl.hpp index a8f1ef47fa..dddf5a5c53 100644 --- a/src/modm/driver/touch/ads7843_impl.hpp +++ b/src/modm/driver/touch/ads7843_impl.hpp @@ -79,7 +79,7 @@ modm::Ads7843::read(glcd::Point * point) if (count == 9) { glcd::Point p; - if (getAverage(bufferX, p.x) && getAverage(bufferY, p.y)) { + if (getAverage(bufferX, p.x()) && getAverage(bufferY, p.y())) { *point = p; return true; } diff --git a/src/modm/math/geometry/line_2d.hpp b/src/modm/math/geometry/line_2d.hpp index 6e8528cf58..05d9e8bcc9 100644 --- a/src/modm/math/geometry/line_2d.hpp +++ b/src/modm/math/geometry/line_2d.hpp @@ -38,10 +38,7 @@ namespace modm typedef typename GeometricTraits::FloatType FloatType; public: - /** - * \brief Default-Constructor - */ - Line2D(); + constexpr Line2D() = default; /** * \brief Construct a line @@ -49,7 +46,9 @@ namespace modm * \param point a point on the line * \param directionVector direction vector, the length doesn't matter */ - Line2D(const Vector& point, const Vector& directionVector); + constexpr Line2D(const Vector& point, const Vector& directionVector) + : point(point), directionVector(directionVector) + {} inline void diff --git a/src/modm/math/geometry/line_2d_impl.hpp b/src/modm/math/geometry/line_2d_impl.hpp index 96a88549f6..80e9cd55eb 100644 --- a/src/modm/math/geometry/line_2d_impl.hpp +++ b/src/modm/math/geometry/line_2d_impl.hpp @@ -15,19 +15,6 @@ #error "Don't include this file directly, use 'line_2d.hpp' instead!" #endif -// ---------------------------------------------------------------------------- -template -modm::Line2D::Line2D() : - point(), directionVector() -{ -} - -template -modm::Line2D::Line2D(const Vector& point, const Vector& direction) : - point(point), directionVector(direction) -{ -} - // ---------------------------------------------------------------------------- template inline void diff --git a/src/modm/math/geometry/line_segment_2d.hpp b/src/modm/math/geometry/line_segment_2d.hpp index eb57e020d3..9c22a5bca5 100644 --- a/src/modm/math/geometry/line_segment_2d.hpp +++ b/src/modm/math/geometry/line_segment_2d.hpp @@ -42,9 +42,11 @@ namespace modm typedef typename GeometricTraits::FloatType FloatType; public: - LineSegment2D(); + constexpr LineSegment2D() = default; - LineSegment2D(const Vector& start, const Vector& end); + constexpr LineSegment2D(const Vector& start, const Vector& end) + : startPoint(start), endPoint(end) + {} /// Set the starting point of the line segment diff --git a/src/modm/math/geometry/line_segment_2d_impl.hpp b/src/modm/math/geometry/line_segment_2d_impl.hpp index 1470abca25..7f9b6a1233 100644 --- a/src/modm/math/geometry/line_segment_2d_impl.hpp +++ b/src/modm/math/geometry/line_segment_2d_impl.hpp @@ -15,19 +15,6 @@ #error "Don't include this file directly, use 'line_segment_2d.hpp' instead!" #endif -// ---------------------------------------------------------------------------- -template -modm::LineSegment2D::LineSegment2D() : - startPoint(), endPoint() -{ -} - -template -modm::LineSegment2D::LineSegment2D(const Vector& start, const Vector& end) : - startPoint(start), endPoint(end) -{ -} - // ---------------------------------------------------------------------------- template inline void diff --git a/src/modm/math/geometry/quaternion.hpp b/src/modm/math/geometry/quaternion.hpp index 958262c921..922f40b0dc 100644 --- a/src/modm/math/geometry/quaternion.hpp +++ b/src/modm/math/geometry/quaternion.hpp @@ -19,11 +19,11 @@ namespace modm { // forward declaration - template + template requires (N > 0) class Vector; - template + template class Matrix; /** @@ -99,10 +99,7 @@ namespace modm void to3x3Matrix(Matrix *outMatrix); public: - T w; - T x; - T y; - T z; + T w, x, y, z; }; template diff --git a/src/modm/math/geometry/ray_2d.hpp b/src/modm/math/geometry/ray_2d.hpp index b566b1c8ef..6aadf3116e 100644 --- a/src/modm/math/geometry/ray_2d.hpp +++ b/src/modm/math/geometry/ray_2d.hpp @@ -47,9 +47,11 @@ namespace modm typedef typename GeometricTraits::FloatType FloatType; public: - Ray2D(); + constexpr Ray2D() = default; - Ray2D(const Vector& start, const Vector& direction); + constexpr Ray2D(const Vector& start, const Vector& direction) + : basePoint(start), direction(direction) + {} /// Set the starting point of the ray inline void diff --git a/src/modm/math/geometry/ray_2d_impl.hpp b/src/modm/math/geometry/ray_2d_impl.hpp index f148c7eafd..751dc12e26 100644 --- a/src/modm/math/geometry/ray_2d_impl.hpp +++ b/src/modm/math/geometry/ray_2d_impl.hpp @@ -13,19 +13,6 @@ #error "Don't include this file directly, use 'ray_2d.hpp' instead!" #endif -// ---------------------------------------------------------------------------- -template -modm::Ray2D::Ray2D() : - basePoint(), direction() -{ -} - -template -modm::Ray2D::Ray2D(const Vector& start, const Vector& direction) : - basePoint(start), direction(direction) -{ -} - // ---------------------------------------------------------------------------- template inline void diff --git a/src/modm/math/lu_decomposition_impl.hpp b/src/modm/math/lu_decomposition_impl.hpp index 4154c2fa1e..ecc9874657 100644 --- a/src/modm/math/lu_decomposition_impl.hpp +++ b/src/modm/math/lu_decomposition_impl.hpp @@ -40,7 +40,7 @@ modm::LUDecomposition::decompose( *u = matrix; *l = modm::Matrix::identityMatrix(); - return LUSubDecomposition::decomposeRecur(u->ptr(), l->ptr(), p->comps); + return LUSubDecomposition::decomposeRecur(u->ptr(), l->ptr(), p->data()); } template diff --git a/src/modm/ui/display/graphic_display.cpp b/src/modm/ui/display/graphic_display.cpp index 1c5727e66e..e5bd3df168 100644 --- a/src/modm/ui/display/graphic_display.cpp +++ b/src/modm/ui/display/graphic_display.cpp @@ -91,31 +91,31 @@ modm::GraphicDisplay::drawLine(int16_t x1, int16_t y1, int16_t x2, int16_t y2) void modm::GraphicDisplay::drawHorizontalLine(glcd::Point start, uint16_t length) { - for (int_fast16_t i = start.x; i < static_cast(start.x + length); ++i) + for (int_fast16_t i = start.x(); i < static_cast(start.x() + length); ++i) { - this->setPixel(i, start.y); + this->setPixel(i, start.y()); } } void modm::GraphicDisplay::drawVerticalLine(glcd::Point start, uint16_t length) { - for (int_fast16_t i = start.y; i < static_cast(start.y + length); ++i) + for (int_fast16_t i = start.y(); i < static_cast(start.y() + length); ++i) { - this->setPixel(start.x, i); + this->setPixel(start.x(), i); } } void modm::GraphicDisplay::drawRectangle(glcd::Point start, uint16_t width, uint16_t height) { - uint16_t x2 = start.x + width - 1; - uint16_t y2 = start.y + height - 1; + uint16_t x2 = start.x() + width - 1; + uint16_t y2 = start.y() + height - 1; this->drawHorizontalLine(start, width); - this->drawHorizontalLine(glcd::Point(start.x, y2), width); + this->drawHorizontalLine(glcd::Point(start.x(), y2), width); this->drawVerticalLine(start, height); - this->drawVerticalLine(glcd::Point(x2, start.y), height); + this->drawVerticalLine(glcd::Point(x2, start.y()), height); } void @@ -124,8 +124,8 @@ modm::GraphicDisplay::drawRoundedRectangle(glcd::Point start, uint16_t width, ui { if (radius == 0) { this->drawRectangle(start, width, height); } - const int16_t x = start.x; - const int16_t y = start.y; + const int16_t x = start.x(); + const int16_t y = start.y(); int16_t x1 = 0; int16_t y1 = radius; @@ -191,8 +191,8 @@ modm::GraphicDisplay::drawCircle(glcd::Point center, uint16_t radius) void modm::GraphicDisplay::drawCircle4(glcd::Point center, int16_t x, int16_t y) { - const int16_t cx = center.x; - const int16_t cy = center.y; + const int16_t cx = center.x(); + const int16_t cy = center.y(); this->setPixel(cx + x, cy + y); this->setPixel(cx - x, cy - y); @@ -281,9 +281,9 @@ modm::GraphicDisplay::drawImageRaw(glcd::Point start, uint16_t width, uint16_t h for (uint16_t j = 0; j < rowHeight; j++) { if (byte & 0x01) - this->setPixel(start.x + i, start.y + k * 8 + j); + this->setPixel(start.x() + i, start.y() + k * 8 + j); else - this->clearPixel(start.x + i, start.y + k * 8 + j); + this->clearPixel(start.x() + i, start.y() + k * 8 + j); byte >>= 1; } diff --git a/src/modm/ui/display/graphic_display.hpp b/src/modm/ui/display/graphic_display.hpp index a1c708f21c..92e28f9a15 100644 --- a/src/modm/ui/display/graphic_display.hpp +++ b/src/modm/ui/display/graphic_display.hpp @@ -117,7 +117,7 @@ class GraphicDisplay : public IOStream inline void setPixel(glcd::Point p) { - this->setPixel(p.x, p.y); + this->setPixel(p.x(), p.y()); } /** @@ -137,7 +137,7 @@ class GraphicDisplay : public IOStream inline void clearPixel(glcd::Point p) { - this->setPixel(p.x, p.y); + this->setPixel(p.x(), p.y()); } /** @@ -174,7 +174,7 @@ class GraphicDisplay : public IOStream inline void drawLine(glcd::Point start, glcd::Point end) { - this->drawLine(start.x, start.y, end.x, end.y); + this->drawLine(start.x(), start.y(), end.x(), end.y()); } /** @@ -349,7 +349,7 @@ class GraphicDisplay : public IOStream inline void setCursorX(int16_t x) { - this->cursor.x = x; + this->cursor.x() = x; } /** @@ -360,7 +360,7 @@ class GraphicDisplay : public IOStream inline void setCursorY(int16_t y) { - this->cursor.y = y; + this->cursor.y() = y; } inline glcd::Point diff --git a/src/modm/ui/display/graphic_display_fill.cpp b/src/modm/ui/display/graphic_display_fill.cpp index 389f8e8564..a7933784ee 100644 --- a/src/modm/ui/display/graphic_display_fill.cpp +++ b/src/modm/ui/display/graphic_display_fill.cpp @@ -19,8 +19,8 @@ void modm::GraphicDisplay::fillRectangle(glcd::Point start, uint16_t width, uint16_t height) { - for (uint16_t i = start.x; (i < start.x + width) && (i < getWidth()); ++i) - for (uint16_t k = start.y; (k < start.y + height) && (k < getHeight()); ++k) + for (uint16_t i = start.x(); (i < start.x() + width) && (i < getWidth()); ++i) + for (uint16_t k = start.y(); (k < start.y() + height) && (k < getHeight()); ++k) this->setPixel(i, k); } @@ -33,7 +33,7 @@ modm::GraphicDisplay::fillCircle(glcd::Point center, uint16_t radius) uint16_t x = 0; uint16_t y = radius; - this->drawVerticalLine(glcd::Point(center.x, center.y - radius), 2 * radius); + this->drawVerticalLine(glcd::Point(center.x(), center.y() - radius), 2 * radius); while(x < y) { @@ -47,9 +47,9 @@ modm::GraphicDisplay::fillCircle(glcd::Point center, uint16_t radius) ddF_x += 2; f += ddF_x + 1; - this->drawVerticalLine(glcd::Point(center.x + x, center.y - y), 2 * y); - this->drawVerticalLine(glcd::Point(center.x + y, center.y - x), 2 * x); - this->drawVerticalLine(glcd::Point(center.x - x, center.y - y), 2 * y); - this->drawVerticalLine(glcd::Point(center.x - y, center.y - x), 2 * x); + this->drawVerticalLine(glcd::Point(center.x() + x, center.y() - y), 2 * y); + this->drawVerticalLine(glcd::Point(center.x() + y, center.y() - x), 2 * x); + this->drawVerticalLine(glcd::Point(center.x() - x, center.y() - y), 2 * y); + this->drawVerticalLine(glcd::Point(center.x() - y, center.y() - x), 2 * x); } } diff --git a/src/modm/ui/display/graphic_display_text.cpp b/src/modm/ui/display/graphic_display_text.cpp index f1e6d1d68d..06a3c65a09 100644 --- a/src/modm/ui/display/graphic_display_text.cpp +++ b/src/modm/ui/display/graphic_display_text.cpp @@ -71,7 +71,8 @@ modm::GraphicDisplay::write(char c) const uint8_t vspace = font[5]; if (character == '\n') { - this->cursor.set(0, this->cursor.y + height + hspace); + this->cursor.x() = 0; + this->cursor.y() += height + hspace; return; } @@ -97,7 +98,7 @@ modm::GraphicDisplay::write(char c) this->drawImageRaw(cursor, width, height, accessor::asFlash(font.getPointer() + offset)); - cursor.setX(cursor.x + width); + cursor.x() += width; // all characters below 128 have whitespace afterwards (number given // by vspace). @@ -107,7 +108,7 @@ modm::GraphicDisplay::write(char c) //this->setColor(color::html::White); for (uint_fast8_t i = 0; i < vspace; ++i) { //this->drawVerticalLine(cursor, height); - cursor.setX(cursor.x + 1); + cursor.x()++; } // restore color diff --git a/src/modm/ui/display/monochrome_graphic_display_vertical_impl.hpp b/src/modm/ui/display/monochrome_graphic_display_vertical_impl.hpp index aefaeaec81..c88e6a4dc4 100644 --- a/src/modm/ui/display/monochrome_graphic_display_vertical_impl.hpp +++ b/src/modm/ui/display/monochrome_graphic_display_vertical_impl.hpp @@ -21,12 +21,12 @@ void modm::MonochromeGraphicDisplayVertical::drawHorizontalLine(glcd::Point start, uint16_t length) { - if (start.y >= 0 and start.y < Height) + if (start.y() >= 0 and start.y() < Height) { - const int16_t y = start.y / 8; + const int16_t y = start.y() / 8; - const uint8_t byte = 1 << (start.y % 8); - for (int_fast16_t x = start.x; x < static_cast(start.x + length); ++x) + const uint8_t byte = 1 << (start.y() % 8); + for (int_fast16_t x = start.x(); x < static_cast(start.x() + length); ++x) { if (x < Width) { this->buffer[y][x] |= byte; } } @@ -38,19 +38,19 @@ void modm::MonochromeGraphicDisplayVertical::drawVerticalLine(glcd::Point start, uint16_t length) { - if (start.x >= 0 and start.x < Width) + if (start.x() >= 0 and start.x() < Width) { - const int8_t end_y = start.y + length; + const int8_t end_y = start.y() + length; const uint8_t y_last = end_y / 8; - uint_fast8_t y = start.y / 8; + uint_fast8_t y = start.y() / 8; // Mask out start - uint_fast8_t byte = 0xFF << start.y % 8; + uint_fast8_t byte = 0xFF << start.y() % 8; while (y != y_last) { if (y < Height / 8) { - this->buffer[y][start.x] |= byte; + this->buffer[y][(start.x())] |= byte; byte = 0xFF; } y++; @@ -59,7 +59,7 @@ modm::MonochromeGraphicDisplayVertical::drawVerticalLine(glcd::Po if (y < Height / 8) { byte &= 0xFF >> (8 - end_y % 8); - this->buffer[y][start.x] |= byte; + this->buffer[y][start.x()] |= byte; } } } @@ -69,9 +69,9 @@ void modm::MonochromeGraphicDisplayVertical::drawImageRaw( glcd::Point start, uint16_t width, uint16_t height, modm::accessor::Flash data) { - if ((start.y % 8) == 0) + if ((start.y() % 8) == 0) { - uint16_t row = start.y / 8; + uint16_t row = start.y() / 8; uint16_t rowCount = (height + 7) / 8; // always round up if ((height % 8) == 0) @@ -80,7 +80,7 @@ modm::MonochromeGraphicDisplayVertical::drawImageRaw( { for (uint_fast16_t k = 0; k < rowCount; k++) { - uint16_t x = start.x + i; + uint16_t x = start.x() + i; uint16_t y = k + row; if (x < Width and y < Height) diff --git a/src/modm/ui/gui/view.cpp b/src/modm/ui/gui/view.cpp index 75c5389d8c..7abe67d31a 100644 --- a/src/modm/ui/gui/view.cpp +++ b/src/modm/ui/gui/view.cpp @@ -72,10 +72,10 @@ modm::gui::View::update() bool modm::gui::View::pack(Widget *w, const modm::glcd::Point &coord) { - if(coord.x >= this->dimension.width || - coord.y >= this->dimension.height || - coord.x < 0 || - coord.y < 0) + if(coord.x() >= this->dimension.width || + coord.y() >= this->dimension.height || + coord.x() < 0 || + coord.y() < 0) { return false; } diff --git a/src/modm/ui/gui/widgets/button.cpp b/src/modm/ui/gui/widgets/button.cpp index e4c2f2996c..1fa32a10e7 100644 --- a/src/modm/ui/gui/widgets/button.cpp +++ b/src/modm/ui/gui/widgets/button.cpp @@ -26,8 +26,8 @@ modm::gui::ButtonWidget::render(View* view) ColorPalette cp = this->color_palette; // position and dimensions - const uint16_t x = this->getPosition().x; - const uint16_t y = this->getPosition().y; + const uint16_t x = this->getPosition().x(); + const uint16_t y = this->getPosition().y(); const uint16_t width = this->getWidth(); const uint16_t height = this->getHeight(); @@ -80,8 +80,8 @@ modm::gui::ArrowButton::render(View* view) ColorPalette cp = this->color_palette; // position and dimensions - const uint16_t x = this->getPosition().x; - const uint16_t y = this->getPosition().y; + const uint16_t x = this->getPosition().x(); + const uint16_t y = this->getPosition().y(); const uint16_t width = this->getWidth(); const uint16_t height = this->getHeight(); @@ -130,8 +130,8 @@ modm::gui::FilledAreaButton::render(View* view) modm::ColorGraphicDisplay* out = &view->display(); // position and dimensions - const uint16_t x = this->getPosition().x; - const uint16_t y = this->getPosition().y; + const uint16_t x = this->getPosition().x(); + const uint16_t y = this->getPosition().y(); const uint16_t width = this->getWidth(); const uint16_t height = this->getHeight(); diff --git a/src/modm/ui/gui/widgets/checkbox.cpp b/src/modm/ui/gui/widgets/checkbox.cpp index 53a182ccb8..3985ef48fd 100644 --- a/src/modm/ui/gui/widgets/checkbox.cpp +++ b/src/modm/ui/gui/widgets/checkbox.cpp @@ -30,8 +30,8 @@ modm::gui::CheckboxWidget::render(View* view) const uint16_t box_width = this->dimension.width; const uint16_t box_height = this->dimension.height; - const uint16_t box_x = this->getPosition().x; - const uint16_t box_y = this->getPosition().y; + const uint16_t box_x = this->getPosition().x(); + const uint16_t box_y = this->getPosition().y(); // clear background out->setColor(cp[Color::BACKGROUND]); diff --git a/src/modm/ui/gui/widgets/label.cpp b/src/modm/ui/gui/widgets/label.cpp index 1527f1e965..305a19ac6d 100644 --- a/src/modm/ui/gui/widgets/label.cpp +++ b/src/modm/ui/gui/widgets/label.cpp @@ -30,6 +30,6 @@ modm::gui::Label::render(View* view) out->setFont(&(this->font)); } - out->setCursor(this->getPosition().x, this->getPosition().y); + out->setCursor(this->getPosition().x(), this->getPosition().y()); *out << this->label; } diff --git a/src/modm/ui/gui/widgets/numberfield.cpp b/src/modm/ui/gui/widgets/numberfield.cpp index d8b12fa972..816f2801f2 100644 --- a/src/modm/ui/gui/widgets/numberfield.cpp +++ b/src/modm/ui/gui/widgets/numberfield.cpp @@ -34,8 +34,8 @@ modm::gui::FloatField::render(View* view) const uint16_t box_width = this->dimension.width - 4; const uint16_t box_height = this->dimension.height; - const uint16_t box_x = this->getPosition().x + 2; - const uint16_t box_y = this->getPosition().y; + const uint16_t box_x = this->getPosition().x() + 2; + const uint16_t box_y = this->getPosition().y(); // clear background out->setColor(cp[Color::BACKGROUND]); diff --git a/src/modm/ui/gui/widgets/numberfield_impl.hpp b/src/modm/ui/gui/widgets/numberfield_impl.hpp index d6d02177a2..79f8e5a085 100644 --- a/src/modm/ui/gui/widgets/numberfield_impl.hpp +++ b/src/modm/ui/gui/widgets/numberfield_impl.hpp @@ -30,8 +30,8 @@ modm::gui::NumberField::render(View* view) const uint16_t box_width = this->dimension.width - 4; const uint16_t box_height = this->dimension.height; - const uint16_t box_x = this->getPosition().x + 2; - const uint16_t box_y = this->getPosition().y; + const uint16_t box_x = this->getPosition().x() + 2; + const uint16_t box_y = this->getPosition().y(); // clear background out->setColor(cp[Color::BACKGROUND]); diff --git a/src/modm/ui/gui/widgets/stringfield.cpp b/src/modm/ui/gui/widgets/stringfield.cpp index d3928862a7..14dcb22400 100644 --- a/src/modm/ui/gui/widgets/stringfield.cpp +++ b/src/modm/ui/gui/widgets/stringfield.cpp @@ -29,8 +29,8 @@ modm::gui::StringField::render(View* view) const uint16_t box_width = this->dimension.width - 4; const uint16_t box_height = this->dimension.height; - const uint16_t box_x = this->getPosition().x + 2; - const uint16_t box_y = this->getPosition().y; + const uint16_t box_x = this->getPosition().x() + 2; + const uint16_t box_y = this->getPosition().y(); // clear background out->setColor(cp[Color::BACKGROUND]); diff --git a/src/modm/ui/gui/widgets/widget.cpp b/src/modm/ui/gui/widgets/widget.cpp index 66a0e33b55..674be9ad10 100644 --- a/src/modm/ui/gui/widgets/widget.cpp +++ b/src/modm/ui/gui/widgets/widget.cpp @@ -17,7 +17,7 @@ bool modm::gui::WidgetGroup::pack(Widget* w, const modm::glcd::Point& coord) { - if(coord.x > (this->dimension.width - w->dimension.width ) || coord.y > (this->dimension.height - w->dimension.height) || coord.x < 0 || coord.y < 0) + if(coord.x() > (this->dimension.width - w->dimension.width ) || coord.y() > (this->dimension.height - w->dimension.height) || coord.x() < 0 || coord.y() < 0) return false; /* Widget needs to know its parent to calculate its real, absolute @@ -107,19 +107,19 @@ modm::gui::Widget::checkIntersection(Widget* w) /* coordinates of upper left and lower right corner of this widget */ auto upper_left = this->getPosition(); - auto lower_right = modm::glcd::Point(upper_left.x + this->getWidth(), upper_left.y + this->getHeight()); + auto lower_right = modm::glcd::Point(upper_left.x() + this->getWidth(), upper_left.y() + this->getHeight()); /* coordinates of upper left and lower right corner of the argument Widget* w */ auto upper_left2 = w->getPosition(); - auto lower_right2 = modm::glcd::Point(upper_left2.x + w->getWidth(), upper_left2.y + w->getHeight()); + auto lower_right2 = modm::glcd::Point(upper_left2.x() + w->getWidth(), upper_left2.y() + w->getHeight()); /* check if rectangles contituted by precedingly defined * coordinates DON'T overlap * */ - if(upper_left.x > lower_right2.x || - upper_left2.x > lower_right.x || - upper_left.y > lower_right2.y || - upper_left2.y > lower_right.y + if(upper_left.x() > lower_right2.x() || + upper_left2.x() > lower_right.x() || + upper_left.y() > lower_right2.y() || + upper_left2.y() > lower_right.y() ) { return false; @@ -135,10 +135,10 @@ modm::gui::Widget::handleInputEvent(const InputEvent* ev) auto position = this->getPosition(); /* check if event is within area */ - if((position.x < ev->coord.x) && - (position.y < ev->coord.y) && - ((position.x + this->getWidth()) > ev->coord.x) && - ((position.y + this->getHeight()) > ev->coord.y)) + if((position.x() < ev->coord.x()) && + (position.y() < ev->coord.y()) && + ((position.x() + this->getWidth()) > ev->coord.x()) && + ((position.y() + this->getHeight()) > ev->coord.y())) { /* check if widget has interaction */ if(this->isInteractive()) diff --git a/test/modm/math/geometry/quaternion_test.cpp b/test/modm/math/geometry/quaternion_test.cpp index 3f3b3edc99..083308c225 100644 --- a/test/modm/math/geometry/quaternion_test.cpp +++ b/test/modm/math/geometry/quaternion_test.cpp @@ -12,9 +12,10 @@ #include #include -#include "quaternion_test.hpp" #include +#include "quaternion_test.hpp" + void QuaternionTest::testConstructor() { diff --git a/test/modm/math/geometry/vector1_test.cpp b/test/modm/math/geometry/vector1_test.cpp index ea042914fe..1a9a4186b0 100644 --- a/test/modm/math/geometry/vector1_test.cpp +++ b/test/modm/math/geometry/vector1_test.cpp @@ -28,27 +28,27 @@ Vector1Test::testConstructor() modm::Vector1i c(a); TEST_ASSERT_EQUALS(c.x(), 100); - int16_t array[1] = {-4}; + /* int16_t array[1] = {-4}; modm::Matrix m(array); modm::Vector1i d(m); - TEST_ASSERT_EQUALS(d.x(), -4); + TEST_ASSERT_EQUALS(d.x(), -4); */ } void Vector1Test::testAssign() { modm::Vector1i a(42); - int16_t array[1] = {-42}; - modm::Matrix m(array); + /* int16_t array[1] = {-42}; + modm::Matrix m(array); */ modm::Vector1i b; b = a; TEST_ASSERT_EQUALS(b.x(), 42); - b = m; - TEST_ASSERT_EQUALS(b.x(), -42); + /* b = m; + TEST_ASSERT_EQUALS(b.x(), -42); */ } void @@ -85,7 +85,7 @@ void Vector1Test::testRawDataAccess() { modm::Vector1i a(2); - int16_t *pointer = a.ptr(); + int16_t *pointer = a.data(); TEST_ASSERT_EQUALS(a[0], 2); TEST_ASSERT_EQUALS(pointer[0], 2); diff --git a/test/modm/math/geometry/vector2_test.cpp b/test/modm/math/geometry/vector2_test.cpp index 47d7094b81..9e94020513 100644 --- a/test/modm/math/geometry/vector2_test.cpp +++ b/test/modm/math/geometry/vector2_test.cpp @@ -32,11 +32,11 @@ Vector2Test::testConstructor() TEST_ASSERT_EQUALS(c.x(), 20); TEST_ASSERT_EQUALS(c.y(), 30); - int16_t array[2] = {-4,5}; + /* int16_t array[2] = {-4,5}; modm::Matrix m(array); modm::Vector2i d(m); TEST_ASSERT_EQUALS(d.x(), -4); - TEST_ASSERT_EQUALS(d.y(), 5); + TEST_ASSERT_EQUALS(d.y(), 5); */ modm::Vector2i e(a); TEST_ASSERT_EQUALS(e.x(), 100); @@ -61,8 +61,8 @@ Vector2Test::testAssign() { modm::Vector2i a(42,-4); - int16_t array[2] = {-26,9}; - modm::Matrix m(array); + /* int16_t array[2] = {-26,9}; + modm::Matrix m(array); */ modm::Vector2i b; @@ -70,9 +70,9 @@ Vector2Test::testAssign() TEST_ASSERT_EQUALS(b.x(), 42); TEST_ASSERT_EQUALS(b.y(), -4); - b = m; + /* b = m; TEST_ASSERT_EQUALS(b.x(), -26); - TEST_ASSERT_EQUALS(b.y(), 9); + TEST_ASSERT_EQUALS(b.y(), 9); */ } void @@ -109,7 +109,7 @@ void Vector2Test::testRawDataAccess() { modm::Vector2i a(2,5); - int16_t *pointer = a.ptr(); + int16_t *pointer = a.data(); TEST_ASSERT_EQUALS(a[0], 2); TEST_ASSERT_EQUALS(a[1], 5); @@ -172,7 +172,7 @@ Vector2Test::testOperators() b /= 2; TEST_ASSERT_EQUALS(b.x(), 18/2); TEST_ASSERT_EQUALS(b.y(), -7/2); - ~b; + b = ~b; TEST_ASSERT_EQUALS(b.x(), -7/2); TEST_ASSERT_EQUALS(b.y(), -18/2); @@ -217,7 +217,7 @@ Vector2Test::testLength() TEST_ASSERT_EQUALS_FLOAT(a.scaled(2.5f).x(), 1.5f); TEST_ASSERT_EQUALS_FLOAT(a.scaled(2.5f).y(), 2.f); - + a.scale(2.f); TEST_ASSERT_EQUALS_FLOAT(a.x(), 1.2f); TEST_ASSERT_EQUALS_FLOAT(a.y(), 1.6f); diff --git a/test/modm/math/geometry/vector3_test.cpp b/test/modm/math/geometry/vector3_test.cpp index 411d334a56..deb68bff3e 100644 --- a/test/modm/math/geometry/vector3_test.cpp +++ b/test/modm/math/geometry/vector3_test.cpp @@ -21,7 +21,7 @@ Vector3Test::testConstructor() modm::Vector2i p2(1, 2); int16_t array[3] = {-4, 5, 7}; - modm::Matrix m(array); + /* modm::Matrix m(array); */ modm::Vector3i a; TEST_ASSERT_EQUALS(a.x(), 0); @@ -48,71 +48,70 @@ Vector3Test::testConstructor() TEST_ASSERT_EQUALS(d.y(), 4); TEST_ASSERT_EQUALS(d.z(), 4); - // TODO implement variadic constructor - // modm::Vector3i e(1,2,p1); - // TEST_ASSERT_EQUALS(e.x(), 1); - // TEST_ASSERT_EQUALS(e.y(), 2); - // TEST_ASSERT_EQUALS(e.z(), 3); - - // modm::Vector3i f(1,p1,2); - // TEST_ASSERT_EQUALS(f.x(), 1); - // TEST_ASSERT_EQUALS(f.y(), 3); - // TEST_ASSERT_EQUALS(f.z(), 2); - - // modm::Vector3i g(p1,2,1); - // TEST_ASSERT_EQUALS(g.x(), 3); - // TEST_ASSERT_EQUALS(g.y(), 2); - // TEST_ASSERT_EQUALS(g.z(), 1); - - // modm::Vector3i h(1,p1,p1); - // TEST_ASSERT_EQUALS(h.x(), 1); - // TEST_ASSERT_EQUALS(h.y(), 3); - // TEST_ASSERT_EQUALS(h.z(), 3); - - // modm::Vector3i i(p1,1,p1); - // TEST_ASSERT_EQUALS(i.x(), 3); - // TEST_ASSERT_EQUALS(i.y(), 1); - // TEST_ASSERT_EQUALS(i.z(), 3); - - // modm::Vector3i j(p1,p1,1); - // TEST_ASSERT_EQUALS(j.x(), 3); - // TEST_ASSERT_EQUALS(j.y(), 3); - // TEST_ASSERT_EQUALS(j.z(), 1); - - // modm::Vector3i k(p1,p1,p1); - // TEST_ASSERT_EQUALS(k.x(), 3); - // TEST_ASSERT_EQUALS(k.y(), 3); - // TEST_ASSERT_EQUALS(k.z(), 3); - - // modm::Vector3i l(2,p2); - // TEST_ASSERT_EQUALS(l.x(), 2); - // TEST_ASSERT_EQUALS(l.y(), 1); - // TEST_ASSERT_EQUALS(l.z(), 2); - - // modm::Vector3i r(p2,6); - // TEST_ASSERT_EQUALS(r.x(), 1); - // TEST_ASSERT_EQUALS(r.y(), 2); - // TEST_ASSERT_EQUALS(r.z(), 6); - - // modm::Vector3i n(p1,p2); - // TEST_ASSERT_EQUALS(n.x(), 3); - // TEST_ASSERT_EQUALS(n.y(), 1); - // TEST_ASSERT_EQUALS(n.z(), 2); - - // modm::Vector3i o(p2,p1); - // TEST_ASSERT_EQUALS(o.x(), 1); - // TEST_ASSERT_EQUALS(o.y(), 2); - // TEST_ASSERT_EQUALS(o.z(), 3); - - // modm::Vector3i p(a); - // TEST_ASSERT_EQUALS(p.x(), 100); - // TEST_ASSERT_EQUALS(p.y(), 9); - // TEST_ASSERT_EQUALS(p.z(), 4); - - // modm::Vector3i q(m); - // TEST_ASSERT_EQUALS(q.x(), -4); - // TEST_ASSERT_EQUALS(q.y(), 5); - // TEST_ASSERT_EQUALS(q.z(), 7); + modm::Vector3i e(1,2,p1); + TEST_ASSERT_EQUALS(e.x(), 1); + TEST_ASSERT_EQUALS(e.y(), 2); + TEST_ASSERT_EQUALS(e.z(), 3); + + modm::Vector3i f(1,p1,2); + TEST_ASSERT_EQUALS(f.x(), 1); + TEST_ASSERT_EQUALS(f.y(), 3); + TEST_ASSERT_EQUALS(f.z(), 2); + + modm::Vector3i g(p1,2,1); + TEST_ASSERT_EQUALS(g.x(), 3); + TEST_ASSERT_EQUALS(g.y(), 2); + TEST_ASSERT_EQUALS(g.z(), 1); + + modm::Vector3i h(1,p1,p1); + TEST_ASSERT_EQUALS(h.x(), 1); + TEST_ASSERT_EQUALS(h.y(), 3); + TEST_ASSERT_EQUALS(h.z(), 3); + + modm::Vector3i i(p1,1,p1); + TEST_ASSERT_EQUALS(i.x(), 3); + TEST_ASSERT_EQUALS(i.y(), 1); + TEST_ASSERT_EQUALS(i.z(), 3); + + modm::Vector3i j(p1,p1,1); + TEST_ASSERT_EQUALS(j.x(), 3); + TEST_ASSERT_EQUALS(j.y(), 3); + TEST_ASSERT_EQUALS(j.z(), 1); + + modm::Vector3i k(p1,p1,p1); + TEST_ASSERT_EQUALS(k.x(), 3); + TEST_ASSERT_EQUALS(k.y(), 3); + TEST_ASSERT_EQUALS(k.z(), 3); + + modm::Vector3i l(2,p2); + TEST_ASSERT_EQUALS(l.x(), 2); + TEST_ASSERT_EQUALS(l.y(), 1); + TEST_ASSERT_EQUALS(l.z(), 2); + + modm::Vector3i r(p2,6); + TEST_ASSERT_EQUALS(r.x(), 1); + TEST_ASSERT_EQUALS(r.y(), 2); + TEST_ASSERT_EQUALS(r.z(), 6); + + modm::Vector3i n(p1,p2); + TEST_ASSERT_EQUALS(n.x(), 3); + TEST_ASSERT_EQUALS(n.y(), 1); + TEST_ASSERT_EQUALS(n.z(), 2); + + modm::Vector3i o(p2,p1); + TEST_ASSERT_EQUALS(o.x(), 1); + TEST_ASSERT_EQUALS(o.y(), 2); + TEST_ASSERT_EQUALS(o.z(), 3); + + modm::Vector3i p(a); + TEST_ASSERT_EQUALS(p.x(), 100); + TEST_ASSERT_EQUALS(p.y(), 9); + TEST_ASSERT_EQUALS(p.z(), 4); + +/* modm::Vector3i q(m); + TEST_ASSERT_EQUALS(q.x(), -4); + TEST_ASSERT_EQUALS(q.y(), 5); + TEST_ASSERT_EQUALS(q.z(), 7); */ } void @@ -121,7 +120,7 @@ Vector3Test::testAssign() modm::Vector3i a(42,-4,3); int16_t array[3] = {-26,9,2}; - modm::Matrix m(array); + /* modm::Matrix m(array); */ modm::Vector3i b; @@ -130,10 +129,10 @@ Vector3Test::testAssign() TEST_ASSERT_EQUALS(b.y(), -4); TEST_ASSERT_EQUALS(b.z(), 3); - b = m; + /* b = m; TEST_ASSERT_EQUALS(b.x(), -26); TEST_ASSERT_EQUALS(b.y(), 9); - TEST_ASSERT_EQUALS(b.z(), 2); + TEST_ASSERT_EQUALS(b.z(), 2); */ } void @@ -170,7 +169,7 @@ void Vector3Test::testRawDataAccess() { modm::Vector3i a(0, 1, 2); - int16_t *pointer = a.ptr(); + int16_t *pointer = a.data(); TEST_ASSERT_EQUALS(a[0], 0); TEST_ASSERT_EQUALS(a[1], 1); diff --git a/test/modm/math/geometry/vector4_test.cpp b/test/modm/math/geometry/vector4_test.cpp index bdecbc06d4..8d1c3e283e 100644 --- a/test/modm/math/geometry/vector4_test.cpp +++ b/test/modm/math/geometry/vector4_test.cpp @@ -21,7 +21,7 @@ Vector4Test::testConstructor() modm::Vector3i p3(3, 3, 3); int16_t array[4] = {1, 2, 3, 4}; - modm::Matrix m(array); + /* modm::Matrix m(array); */ modm::Vector4i a; TEST_ASSERT_EQUALS(a.x(), 0); @@ -54,185 +54,185 @@ Vector4Test::testConstructor() TEST_ASSERT_EQUALS(d.w(), 4); // TODO implement variadic constructor - // modm::Vector4i e(p1,1,2,3); - // TEST_ASSERT_EQUALS(e.x(), 1); - // TEST_ASSERT_EQUALS(e.y(), 1); - // TEST_ASSERT_EQUALS(e.z(), 2); - // TEST_ASSERT_EQUALS(e.w(), 3); - - // modm::Vector4i f(1,p1,2,3); - // TEST_ASSERT_EQUALS(f.x(), 1); - // TEST_ASSERT_EQUALS(f.y(), 1); - // TEST_ASSERT_EQUALS(f.z(), 2); - // TEST_ASSERT_EQUALS(f.w(), 3); - - // // modm::Vector4i g(1,2,p1,3); - // // TEST_ASSERT_EQUALS(g.x(), 1); - // // TEST_ASSERT_EQUALS(g.y(), 2); - // // TEST_ASSERT_EQUALS(g.z(), 1); - // // TEST_ASSERT_EQUALS(g.w(), 3); - - // modm::Vector4i h(1,2,3,p1); - // TEST_ASSERT_EQUALS(h.x(), 1); - // TEST_ASSERT_EQUALS(h.y(), 2); - // TEST_ASSERT_EQUALS(h.z(), 3); - // TEST_ASSERT_EQUALS(h.w(), 1); - - // modm::Vector4i i(p1,p1,1,2); - // TEST_ASSERT_EQUALS(i.x(), 1); - // TEST_ASSERT_EQUALS(i.y(), 1); - // TEST_ASSERT_EQUALS(i.z(), 1); - // TEST_ASSERT_EQUALS(i.w(), 2); - - // modm::Vector4i j(p1,1,p1,2); - // TEST_ASSERT_EQUALS(j.x(), 1); - // TEST_ASSERT_EQUALS(j.y(), 1); - // TEST_ASSERT_EQUALS(j.z(), 1); - // TEST_ASSERT_EQUALS(j.w(), 2); - - // modm::Vector4i k(p1,1,2,p1); - // TEST_ASSERT_EQUALS(k.x(), 1); - // TEST_ASSERT_EQUALS(k.y(), 1); - // TEST_ASSERT_EQUALS(k.z(), 2); - // TEST_ASSERT_EQUALS(k.w(), 1); - - // modm::Vector4i l(1,p1,2,p1); - // TEST_ASSERT_EQUALS(l.x(), 1); - // TEST_ASSERT_EQUALS(l.y(), 1); - // TEST_ASSERT_EQUALS(l.z(), 2); - // TEST_ASSERT_EQUALS(l.w(), 1); - - // modm::Vector4i r(1,2,p1,p1); - // TEST_ASSERT_EQUALS(r.x(), 1); - // TEST_ASSERT_EQUALS(r.y(), 2); - // TEST_ASSERT_EQUALS(r.z(), 1); - // TEST_ASSERT_EQUALS(r.w(), 1); - - // modm::Vector4i n(1,p1,p1,2); - // TEST_ASSERT_EQUALS(n.x(), 1); - // TEST_ASSERT_EQUALS(n.y(), 1); - // TEST_ASSERT_EQUALS(n.z(), 1); - // TEST_ASSERT_EQUALS(n.w(), 2); - - - // modm::Vector4i o(p2,p1,p1); - // TEST_ASSERT_EQUALS(o.x(), 2); - // TEST_ASSERT_EQUALS(o.y(), 2); - // TEST_ASSERT_EQUALS(o.z(), 1); - // TEST_ASSERT_EQUALS(o.w(), 1); - - // modm::Vector4i s(p2,p1,1); - // TEST_ASSERT_EQUALS(s.x(), 2); - // TEST_ASSERT_EQUALS(s.y(), 2); - // TEST_ASSERT_EQUALS(s.z(), 1); - // TEST_ASSERT_EQUALS(s.w(), 1); - - // modm::Vector4i t(p2,1,p1); - // TEST_ASSERT_EQUALS(t.x(), 2); - // TEST_ASSERT_EQUALS(t.y(), 2); - // TEST_ASSERT_EQUALS(t.z(), 1); - // TEST_ASSERT_EQUALS(t.w(), 1); - - // modm::Vector4i u(p2,1,1); - // TEST_ASSERT_EQUALS(u.x(), 2); - // TEST_ASSERT_EQUALS(u.y(), 2); - // TEST_ASSERT_EQUALS(u.z(), 1); - // TEST_ASSERT_EQUALS(u.w(), 1); - - - // modm::Vector4i o2(p1,p2,p1); - // TEST_ASSERT_EQUALS(o2.x(), 1); - // TEST_ASSERT_EQUALS(o2.y(), 2); - // TEST_ASSERT_EQUALS(o2.z(), 2); - // TEST_ASSERT_EQUALS(o2.w(), 1); - - // modm::Vector4i s2(p1,p2,1); - // TEST_ASSERT_EQUALS(s2.x(), 1); - // TEST_ASSERT_EQUALS(s2.y(), 2); - // TEST_ASSERT_EQUALS(s2.z(), 2); - // TEST_ASSERT_EQUALS(s2.w(), 1); - - // modm::Vector4i t2(1,p2,p1); - // TEST_ASSERT_EQUALS(t2.x(), 1); - // TEST_ASSERT_EQUALS(t2.y(), 2); - // TEST_ASSERT_EQUALS(t2.z(), 2); - // TEST_ASSERT_EQUALS(t2.w(), 1); - - // modm::Vector4i u2(1,p2,1); - // TEST_ASSERT_EQUALS(u2.x(), 1); - // TEST_ASSERT_EQUALS(u2.y(), 2); - // TEST_ASSERT_EQUALS(u2.z(), 2); - // TEST_ASSERT_EQUALS(u2.w(), 1); - - - // modm::Vector4i o3(p1,p1,p2); - // TEST_ASSERT_EQUALS(o3.x(), 1); - // TEST_ASSERT_EQUALS(o3.y(), 1); - // TEST_ASSERT_EQUALS(o3.z(), 2); - // TEST_ASSERT_EQUALS(o3.w(), 2); - - // modm::Vector4i s3(p1,1,p2); - // TEST_ASSERT_EQUALS(s3.x(), 1); - // TEST_ASSERT_EQUALS(s3.y(), 1); - // TEST_ASSERT_EQUALS(s3.z(), 2); - // TEST_ASSERT_EQUALS(s3.w(), 2); - - // modm::Vector4i t3(1,p1,p2); - // TEST_ASSERT_EQUALS(t3.x(), 1); - // TEST_ASSERT_EQUALS(t3.y(), 1); - // TEST_ASSERT_EQUALS(t3.z(), 2); - // TEST_ASSERT_EQUALS(t3.w(), 2); - - // modm::Vector4i u3(1,1,p2); - // TEST_ASSERT_EQUALS(u3.x(), 1); - // TEST_ASSERT_EQUALS(u3.y(), 1); - // TEST_ASSERT_EQUALS(u3.z(), 2); - // TEST_ASSERT_EQUALS(u3.w(), 2); - - - // modm::Vector4i u4(p2,p2); - // TEST_ASSERT_EQUALS(u4.x(), 2); - // TEST_ASSERT_EQUALS(u4.y(), 2); - // TEST_ASSERT_EQUALS(u4.z(), 2); - // TEST_ASSERT_EQUALS(u4.w(), 2); - - - // modm::Vector4i u5(p3,p1); - // TEST_ASSERT_EQUALS(u5.x(), 3); - // TEST_ASSERT_EQUALS(u5.y(), 3); - // TEST_ASSERT_EQUALS(u5.z(), 3); - // TEST_ASSERT_EQUALS(u5.w(), 1); - - // modm::Vector4i u6(p1,p3); - // TEST_ASSERT_EQUALS(u6.x(), 1); - // TEST_ASSERT_EQUALS(u6.y(), 3); - // TEST_ASSERT_EQUALS(u6.z(), 3); - // TEST_ASSERT_EQUALS(u6.w(), 3); - - // modm::Vector4i u7(p3,1); - // TEST_ASSERT_EQUALS(u7.x(), 3); - // TEST_ASSERT_EQUALS(u7.y(), 3); - // TEST_ASSERT_EQUALS(u7.z(), 3); - // TEST_ASSERT_EQUALS(u7.w(), 1); - - // modm::Vector4i u8(1,p3); - // TEST_ASSERT_EQUALS(u8.x(), 1); - // TEST_ASSERT_EQUALS(u8.y(), 3); - // TEST_ASSERT_EQUALS(u8.z(), 3); - // TEST_ASSERT_EQUALS(u8.w(), 3); - - - // modm::Vector4i p(a); - // TEST_ASSERT_EQUALS(p.x(), 1); - // TEST_ASSERT_EQUALS(p.y(), 2); - // TEST_ASSERT_EQUALS(p.z(), 3); - // TEST_ASSERT_EQUALS(p.w(), 4); - - // modm::Vector4i q(m); - // TEST_ASSERT_EQUALS(q.x(), 1); - // TEST_ASSERT_EQUALS(q.y(), 2); - // TEST_ASSERT_EQUALS(q.z(), 3); - // TEST_ASSERT_EQUALS(q.w(), 4); + modm::Vector4i e(p1,1,2,3); + TEST_ASSERT_EQUALS(e.x(), 1); + TEST_ASSERT_EQUALS(e.y(), 1); + TEST_ASSERT_EQUALS(e.z(), 2); + TEST_ASSERT_EQUALS(e.w(), 3); + + modm::Vector4i f(1,p1,2,3); + TEST_ASSERT_EQUALS(f.x(), 1); + TEST_ASSERT_EQUALS(f.y(), 1); + TEST_ASSERT_EQUALS(f.z(), 2); + TEST_ASSERT_EQUALS(f.w(), 3); + + modm::Vector4i g(1,2,p1,3); + TEST_ASSERT_EQUALS(g.x(), 1); + TEST_ASSERT_EQUALS(g.y(), 2); + TEST_ASSERT_EQUALS(g.z(), 1); + TEST_ASSERT_EQUALS(g.w(), 3); + + modm::Vector4i h(1,2,3,p1); + TEST_ASSERT_EQUALS(h.x(), 1); + TEST_ASSERT_EQUALS(h.y(), 2); + TEST_ASSERT_EQUALS(h.z(), 3); + TEST_ASSERT_EQUALS(h.w(), 1); + + modm::Vector4i i(p1,p1,1,2); + TEST_ASSERT_EQUALS(i.x(), 1); + TEST_ASSERT_EQUALS(i.y(), 1); + TEST_ASSERT_EQUALS(i.z(), 1); + TEST_ASSERT_EQUALS(i.w(), 2); + + modm::Vector4i j(p1,1,p1,2); + TEST_ASSERT_EQUALS(j.x(), 1); + TEST_ASSERT_EQUALS(j.y(), 1); + TEST_ASSERT_EQUALS(j.z(), 1); + TEST_ASSERT_EQUALS(j.w(), 2); + + modm::Vector4i k(p1,1,2,p1); + TEST_ASSERT_EQUALS(k.x(), 1); + TEST_ASSERT_EQUALS(k.y(), 1); + TEST_ASSERT_EQUALS(k.z(), 2); + TEST_ASSERT_EQUALS(k.w(), 1); + + modm::Vector4i l(1,p1,2,p1); + TEST_ASSERT_EQUALS(l.x(), 1); + TEST_ASSERT_EQUALS(l.y(), 1); + TEST_ASSERT_EQUALS(l.z(), 2); + TEST_ASSERT_EQUALS(l.w(), 1); + + modm::Vector4i r(1,2,p1,p1); + TEST_ASSERT_EQUALS(r.x(), 1); + TEST_ASSERT_EQUALS(r.y(), 2); + TEST_ASSERT_EQUALS(r.z(), 1); + TEST_ASSERT_EQUALS(r.w(), 1); + + modm::Vector4i n(1,p1,p1,2); + TEST_ASSERT_EQUALS(n.x(), 1); + TEST_ASSERT_EQUALS(n.y(), 1); + TEST_ASSERT_EQUALS(n.z(), 1); + TEST_ASSERT_EQUALS(n.w(), 2); + + + modm::Vector4i o(p2,p1,p1); + TEST_ASSERT_EQUALS(o.x(), 2); + TEST_ASSERT_EQUALS(o.y(), 2); + TEST_ASSERT_EQUALS(o.z(), 1); + TEST_ASSERT_EQUALS(o.w(), 1); + + modm::Vector4i s(p2,p1,1); + TEST_ASSERT_EQUALS(s.x(), 2); + TEST_ASSERT_EQUALS(s.y(), 2); + TEST_ASSERT_EQUALS(s.z(), 1); + TEST_ASSERT_EQUALS(s.w(), 1); + + modm::Vector4i t(p2,1,p1); + TEST_ASSERT_EQUALS(t.x(), 2); + TEST_ASSERT_EQUALS(t.y(), 2); + TEST_ASSERT_EQUALS(t.z(), 1); + TEST_ASSERT_EQUALS(t.w(), 1); + + modm::Vector4i u(p2,1,1); + TEST_ASSERT_EQUALS(u.x(), 2); + TEST_ASSERT_EQUALS(u.y(), 2); + TEST_ASSERT_EQUALS(u.z(), 1); + TEST_ASSERT_EQUALS(u.w(), 1); + + + modm::Vector4i o2(p1,p2,p1); + TEST_ASSERT_EQUALS(o2.x(), 1); + TEST_ASSERT_EQUALS(o2.y(), 2); + TEST_ASSERT_EQUALS(o2.z(), 2); + TEST_ASSERT_EQUALS(o2.w(), 1); + + modm::Vector4i s2(p1,p2,1); + TEST_ASSERT_EQUALS(s2.x(), 1); + TEST_ASSERT_EQUALS(s2.y(), 2); + TEST_ASSERT_EQUALS(s2.z(), 2); + TEST_ASSERT_EQUALS(s2.w(), 1); + + modm::Vector4i t2(1,p2,p1); + TEST_ASSERT_EQUALS(t2.x(), 1); + TEST_ASSERT_EQUALS(t2.y(), 2); + TEST_ASSERT_EQUALS(t2.z(), 2); + TEST_ASSERT_EQUALS(t2.w(), 1); + + modm::Vector4i u2(1,p2,1); + TEST_ASSERT_EQUALS(u2.x(), 1); + TEST_ASSERT_EQUALS(u2.y(), 2); + TEST_ASSERT_EQUALS(u2.z(), 2); + TEST_ASSERT_EQUALS(u2.w(), 1); + + + modm::Vector4i o3(p1,p1,p2); + TEST_ASSERT_EQUALS(o3.x(), 1); + TEST_ASSERT_EQUALS(o3.y(), 1); + TEST_ASSERT_EQUALS(o3.z(), 2); + TEST_ASSERT_EQUALS(o3.w(), 2); + + modm::Vector4i s3(p1,1,p2); + TEST_ASSERT_EQUALS(s3.x(), 1); + TEST_ASSERT_EQUALS(s3.y(), 1); + TEST_ASSERT_EQUALS(s3.z(), 2); + TEST_ASSERT_EQUALS(s3.w(), 2); + + modm::Vector4i t3(1,p1,p2); + TEST_ASSERT_EQUALS(t3.x(), 1); + TEST_ASSERT_EQUALS(t3.y(), 1); + TEST_ASSERT_EQUALS(t3.z(), 2); + TEST_ASSERT_EQUALS(t3.w(), 2); + + modm::Vector4i u3(1,1,p2); + TEST_ASSERT_EQUALS(u3.x(), 1); + TEST_ASSERT_EQUALS(u3.y(), 1); + TEST_ASSERT_EQUALS(u3.z(), 2); + TEST_ASSERT_EQUALS(u3.w(), 2); + + + modm::Vector4i u4(p2,p2); + TEST_ASSERT_EQUALS(u4.x(), 2); + TEST_ASSERT_EQUALS(u4.y(), 2); + TEST_ASSERT_EQUALS(u4.z(), 2); + TEST_ASSERT_EQUALS(u4.w(), 2); + + + modm::Vector4i u5(p3,p1); + TEST_ASSERT_EQUALS(u5.x(), 3); + TEST_ASSERT_EQUALS(u5.y(), 3); + TEST_ASSERT_EQUALS(u5.z(), 3); + TEST_ASSERT_EQUALS(u5.w(), 1); + + modm::Vector4i u6(p1,p3); + TEST_ASSERT_EQUALS(u6.x(), 1); + TEST_ASSERT_EQUALS(u6.y(), 3); + TEST_ASSERT_EQUALS(u6.z(), 3); + TEST_ASSERT_EQUALS(u6.w(), 3); + + modm::Vector4i u7(p3,1); + TEST_ASSERT_EQUALS(u7.x(), 3); + TEST_ASSERT_EQUALS(u7.y(), 3); + TEST_ASSERT_EQUALS(u7.z(), 3); + TEST_ASSERT_EQUALS(u7.w(), 1); + + modm::Vector4i u8(1,p3); + TEST_ASSERT_EQUALS(u8.x(), 1); + TEST_ASSERT_EQUALS(u8.y(), 3); + TEST_ASSERT_EQUALS(u8.z(), 3); + TEST_ASSERT_EQUALS(u8.w(), 3); + + + modm::Vector4i p(a); + TEST_ASSERT_EQUALS(p.x(), 1); + TEST_ASSERT_EQUALS(p.y(), 2); + TEST_ASSERT_EQUALS(p.z(), 3); + TEST_ASSERT_EQUALS(p.w(), 4); + + /* modm::Vector4i q(m); + TEST_ASSERT_EQUALS(q.x(), 1); + TEST_ASSERT_EQUALS(q.y(), 2); + TEST_ASSERT_EQUALS(q.z(), 3); + TEST_ASSERT_EQUALS(q.w(), 4); */ // did I forget anything... } @@ -243,7 +243,7 @@ Vector4Test::testAssign() modm::Vector4i a(1,2,3,4); int16_t array[4] = {5,6,7,8}; - modm::Matrix m(array); + /* modm::Matrix m(array); */ modm::Vector4i b; @@ -253,11 +253,11 @@ Vector4Test::testAssign() TEST_ASSERT_EQUALS(b.z(), 3); TEST_ASSERT_EQUALS(b.w(), 4); - b = m; + /* b = m; TEST_ASSERT_EQUALS(b.x(), 5); TEST_ASSERT_EQUALS(b.y(), 6); TEST_ASSERT_EQUALS(b.z(), 7); - TEST_ASSERT_EQUALS(b.w(), 8); + TEST_ASSERT_EQUALS(b.w(), 8); */ } void @@ -294,7 +294,7 @@ void Vector4Test::testRawDataAccess() { modm::Vector4i a(0,1,2,3); - int16_t *pointer = a.comps; + int16_t *pointer = a.data(); TEST_ASSERT_EQUALS(a[0], 0); TEST_ASSERT_EQUALS(a[1], 1); diff --git a/test/modm/math/geometry/vector_test.cpp b/test/modm/math/geometry/vector_test.cpp index 758f555d64..0dab630ae2 100644 --- a/test/modm/math/geometry/vector_test.cpp +++ b/test/modm/math/geometry/vector_test.cpp @@ -17,7 +17,7 @@ void VectorTest::testConstructor() { int16_t array[2] = {1, 2}; - modm::Matrix m(array); +/* modm::Matrix m(array); */ modm::Vector a; TEST_ASSERT_EQUALS(a[0], 0); @@ -36,19 +36,18 @@ VectorTest::testConstructor() TEST_ASSERT_EQUALS(p[0], 1); TEST_ASSERT_EQUALS(p[1], 2); - modm::Vector q(m); +/* modm::Vector q(m); TEST_ASSERT_EQUALS(q[0], 1); - TEST_ASSERT_EQUALS(q[1], 2); + TEST_ASSERT_EQUALS(q[1], 2); */ } void VectorTest::testAssign() -{ - int16_t array1[4] = {1, 2, 3, 4}; - modm::Vector a(array1); +{; + modm::Vector a = {1, 2, 3, 4}; - int16_t array2[4] = {5, 6, 7, 8}; - modm::Matrix m(array2); + /* int16_t array2[4] = {5, 6, 7, 8}; + modm::Matrix m(array2); */ modm::Vector b; @@ -58,11 +57,11 @@ VectorTest::testAssign() TEST_ASSERT_EQUALS(b[2], 3); TEST_ASSERT_EQUALS(b[3], 4); - b = m; + /* b = m; TEST_ASSERT_EQUALS(b[0], 5); TEST_ASSERT_EQUALS(b[1], 6); TEST_ASSERT_EQUALS(b[2], 7); - TEST_ASSERT_EQUALS(b[3], 8); + TEST_ASSERT_EQUALS(b[3], 8); */ } void @@ -105,7 +104,7 @@ VectorTest::testRawDataAccess() { int16_t array[4] = {0, 1, 2, 3}; modm::Vector a(array); - int16_t *pointer = a.comps; + int16_t *pointer = a.data(); TEST_ASSERT_EQUALS(a[0], 0); TEST_ASSERT_EQUALS(a[1], 1); @@ -120,11 +119,9 @@ VectorTest::testRawDataAccess() void VectorTest::testOperators() { - int16_t array1[4] = {1, 2, 3, 4}; - modm::Vector a(array1); + modm::Vector a({1, 2, 3, 4}); - int16_t array2[4] = {4, 5, 6, 7}; - modm::Vector b(array2); + modm::Vector b({4, 5, 6, 7}); TEST_ASSERT_EQUALS((a + b)[0], 1+4); TEST_ASSERT_EQUALS((a + b)[1], 2+5); @@ -136,7 +133,7 @@ VectorTest::testOperators() TEST_ASSERT_EQUALS((a - b)[2], 3-6); TEST_ASSERT_EQUALS((a - b)[3], 4-7); - TEST_ASSERT_EQUALS((a * b), 1*4 + 2*5 + 3*6 + 4*7); + TEST_ASSERT_EQUALS((a.dot(b)), 1*4 + 2*5 + 3*6 + 4*7); TEST_ASSERT_EQUALS((a * 3)[0], 1*3); TEST_ASSERT_EQUALS((a * 3)[1], 2*3);