Computer Graphics (2nd edition in Wanbo Shuo) 45th page of the Bresenham algorithm has errors

Source: Internet
Author: User

Computer Graphics (2nd edition in Wanbo Shuo) 45th page of the Bresenham algorithm has errors:

The book is supposed to be written in X as the step-by-step method, but he wrote a part of the Y is the step-by-step method (in fact, also write the wrong), and finally the X-step of the way to summarize.

The algorithm in the analysis book has to be:

L k Initial value <=0 draw is x=0;

L 0<k Initial value <1 draw a line of 1/k;

L k Initial value >=1 draw is y=x;

The following black lines are drawn using Moveto,lineto, the red ones are drawn on the book's program, the blue lines are my modified lines (with division), and the Purple ones are modified (no division).

The Green Line is the line that is 1/k when validating the 0<k initial value <1 (drawn with Moveto,lineto)

(500,-500), (0,0) k=-1 (0,0), (500,500) k=1 (0,0), (400,100) K=1/4

(0,0), (100,400) k=4

modified to: (Main display 0<=k<=1 )

(0,0), (400,100) K=1/4 (with multiplication)

(0,0), (400,100) K=1/4 (no multiplication)

No multiplication program:

Computer Graphics (2nd edition in Wanbo Shuo) 45th page of the Bresenham algorithm has errors

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.