Question: #include using namespace std; int main() { int x1 = 4, y1 = 8; int x2 = 10, y2 = 12; int dx = x2
#include
using namespace std;
int main()
{
int x1 = 4, y1 = 8;
int x2 = 10, y2 = 12;
int dx = x2 - x1;
int dy = y2 - y1;
double m = (double)dy / dx;
cout
int Do = dy - dx / 2;
cout
if (Do > 0)
{
int pointx = x1 + 1;
int pointy = y1 + 1;
cout
Midpoint Line Drawing Algorithm Example-1: Draw line A(4, 8) and B(10, 12) using midpoint line drawing algorithm Solution: - Here starting point is (4.8) and ending point is (10, 12). We have = dx = X2 - Xi = dy = Y2 - Y = 10 - 4 = 12 - 8 = 6 = 4 = m = dy dx = 4/6 = 0.67 ::m 0 As do > 0, NE is chosen and the next pixel to be plotted will be Y+ 1) = (5,9) SCREENCAST MATIC cout
}
}
I want the same code, but with different syntax and commands, and it prints the same autobot for me to solve the midpoint issue.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
