Aug 5, 2024
dda.cpp
main.cpp
dda.h
ddaline.ui
dda.cpp
or main.cpp
), where the function will be defined.void DDA(float x1, float y1, float x2, float y2)
int x1 = ui->textEdit->toPlainText().toInt();
image.setPixel(50, 50, qRgb(255,255,255));
label_5
).deltaX = x2 - x1
deltaY = y2 - y1
abs(deltaX)
or abs(deltaY)
to determine length
xIncrement = deltaX / length
yIncrement = deltaY / length
length
image.setPixel(x, y, qRgb(r, g, b))
xIncrement
and yIncrement
for (int i = 0; i < length; i++) {
image.setPixel(x, y, qRgb(255, 255, 255));
x += xIncrement;
y += yIncrement;
}
label_5
) used to display the drawn line.setPixel
to alter line color.