Talk:Liang–Barsky algorithm

Latest comment: 13 years ago by 213.144.1.62 in topic Discuss: Removed code examples

Discuss: Removed code examples

edit

So what was wrong with those snippets? I took a look at the first Java implementation and couldn't find much wrong with it (beyond purely stylistic issues). I only suspect that the p == 0 check will fail for most real-world scenarios due to rounding errors; it's always hard to get a round zero when dealing with floating-point numbers. Declaring a small eps factor and checking |p| < eps would remedy this, though. Is there some fundamental flaw in the explanation of the algorithm, or something else I didn't notice? What were the examples on which the implementations were tested? —Preceding unsigned comment added by 213.144.1.62 (talk) 13:50, 10 March 2011 (UTC)Reply

Removed code examples

edit

There were previously 3 code examples for Liang-Barsky, 2 in Java and 1 in C#, all of which failed in the case of a line intersecting a rectangle parallel to one of the edges. A correct example in pseudo-code should be added, as per the guidelines in Wikipedia:WikiProject Computer science/Manual of style (computer science). I felt it was better to remove the examples entirely than leave misleading inormation on the page.

== step 2. is

  1. Numbered list item

incorrect ==

step 2 should be this: If for that k, qk < 0, the line is completely outside and can be eliminated.Zaghaghi (talk) 19:53, 21 November 2010 (UTC) Big textBig textBig textBig textReply