Question

In: Computer Science

Using DDA algorithm, find the pixels for the line drawn from (8, 8) to (16, 14)..

Using DDA algorithm, find the pixels for the line drawn from (8, 8) to (16, 14)..

Solutions

Expert Solution

Procedure-

Given-

  • Starting coordinates = (X0, Y0)
  • Ending coordinates = (Xn, Yn)

The points generation using DDA Algorithm involves the following steps-

Step-01:

Calculate ΔX, ΔY and M from the given input.

These parameters are calculated as-

  • ΔX = Xn – X0
  • ΔY =Yn – Y0
  • M = ΔY / ΔX

Step-02:

Find the number of steps or points in between the starting and ending coordinates.

if (absolute (ΔX) > absolute (ΔY))

Steps = absolute (ΔX);

else

Steps = absolute (ΔY);

Step-03:

Suppose the current point is (Xp, Yp) and the next point is (Xp+1, Yp+1).

Find the next point by following the below three cases-

Step-04:

Keep repeating Step-03 until the end point is reached or the number of generated new points (including the starting and ending points) equals to the steps count.

solution

Given-

  • Starting coordinates = (X0, Y0) = (8,8)
  • Ending coordinates = (Xn, Yn) = (16,14)

step 1

  • Calculate ΔX, ΔY and M from the given input.

  • ΔX = Xn – X0 = 16-8 = 8
  • ΔY =Yn – Y0 = 14-8 = 6
  • M = ΔY / ΔX = 6 / 8 = 3/4=0.75=M

Step-02:

Calculate the number of steps.

As |ΔX| > |ΔY| = 8 > 6, so number of steps = ΔX = 8

Step-03:

As M < 1, so case-01 is satisfied.

Now, Step-03 is executed until Step-04 is satisfied.

Xp Yp Xp+1 Yp+1 Round off (Xp+1, Yp+1)
8 8 9 8.75 (9, 9)
10 9.5 (10, 10)
11 10.25 (11,10 )
12 11 (12, 11)
13 11.75 (13, 12)

14

12.5 (14,13)
15 13.25 (15, 13)
16 14 (16, 14)

Related Solutions

Find the GCD (5796852, 4585268) using the Euclidian Algorithm..
Find the GCD (5796852, 4585268) using the Euclidian Algorithm..
Find the GCD (5796852, 4585268) using the Euclidian Algorithm..
Find the GCD (5796852, 4585268) using the Euclidian Algorithm..
A simple random sample of size nequals 14 is drawn from a population that is normally...
A simple random sample of size nequals 14 is drawn from a population that is normally distributed. The sample mean is found to be x overbar equals 65 and the sample standard deviation is found to be sequals 16. Construct a 90 ​% confidence interval about the population mean. The lower bound is The upper bound is ​(Round to two decimal places as​ needed.)
A simple random sample of size n equals 16 is drawn from a population that is...
A simple random sample of size n equals 16 is drawn from a population that is normally distributed. The sample variance is found to be 13.7 Test whether the population variance is greater than 10 at the alpha equals 0.05 level of significance. I only need to find the test statistic and the p-value. Would you go through it step by step please.
A random sample of 14 items is drawn from a population whose standard deviation is unknown....
A random sample of 14 items is drawn from a population whose standard deviation is unknown. The sample mean is x¯ = 780 and the sample standard deviation is s = 5. Use Appendix D to find the values of Student’s t. (a) Construct an interval estimate of μ with 98% confidence. (Round your answers to 3 decimal places.) The 98% confidence interval is from _ to _ (b) Construct an interval estimate of μ with 98% confidence, assuming that...
A random sample of 16 values is drawn from a mound-shaped and symmetric distribution. The sample...
A random sample of 16 values is drawn from a mound-shaped and symmetric distribution. The sample mean is 12 and the sample standard deviation is 2. Use a level of significance of 0.05 to conduct a two-tailed test of the claim that the population mean is 11.5. (a) Is it appropriate to use a Student's t distribution? Explain. (Choose one of 5 listed below) Yes, because the x distribution is mound-shaped and symmetric and σ is unknown. No, the x...
A simple random sample of 16 adults drawn from a certain population of adults yielded a...
A simple random sample of 16 adults drawn from a certain population of adults yielded a mean weight of 63kg. Assume that weights in the population are approximately normally distributed with a variance of 49. Do the sample data provide sufficient evidence for us to conclude that the mean weight for the population is less than 70 kg? Let the probability of committing a type I error be .01. 1. Write the hypotheses, indicate the claim 2. find the critical...
A random sample of 16 values is drawn from a mound-shaped and symmetric distribution. The sample...
A random sample of 16 values is drawn from a mound-shaped and symmetric distribution. The sample mean is 8 and the sample standard deviation is 2. Use a level of significance of 0.05 to conduct a two-tailed test of the claim that the population mean is 7.5. (a) Is it appropriate to use a Student's t distribution? Explain. Yes, because the x distribution is mound-shaped and symmetric and σ is unknown.No, the x distribution is skewed left.      No, the x...
Strassen’s algorithm for matrix multiplication relies on using 7 multiplications (instead of 8 as in the...
Strassen’s algorithm for matrix multiplication relies on using 7 multiplications (instead of 8 as in the straightforward algorithm) to multiply a pair of 2 by 2 matrices. Explain why it is not possible to further reduce this number, 7, to anything less than 4, in multiplying a pair of 2 by 2 matrices.
Strassen’s algorithm for matrix multiplication relies on using 7 multiplications (instead of 8 as in the...
Strassen’s algorithm for matrix multiplication relies on using 7 multiplications (instead of 8 as in the straightforward algorithm) to multiply a pair of 2 by 2 matrices. Explain why it is not possible to further reduce this number, 7, to anything less than 4, in multiplying a pair of 2 by 2 matrices.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT