Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!m.cs.uiuc.edu!roundup.crhc.uiuc.edu!ux1.cso.uiuc.edu!csrd.uiuc.edu!s5.csrd.uiuc.edu!neeman From: neeman@s5.csrd.uiuc.edu (Henry J. Neeman) Newsgroups: comp.graphics Subject: Re: newell plane equation Summary: too many points Keywords: graphics, plane eqation Message-ID: <1991Mar7.203947.27550@csrd.uiuc.edu> Date: 7 Mar 91 20:39:47 GMT References: <9283@exodus.Eng.Sun.COM> Sender: news@csrd.uiuc.edu (news) Organization: Univ of Illinois, Center for Supercomputing R&D, Urbana, IL Lines: 39 In article <9283@exodus.Eng.Sun.COM> stephenj@deblil.Eng.Sun.COM (Stephen Johnson) writes: >I have been using the Newell technique for computing the plane >equation in the form Ax + By + Cz + D = 0 >and I discovered that the plane defined by the following points is >computing incorrectly: (2,2,0), (12,2,0), (2,2,3), (12, 2, 3) >In the loops: if (i == n) j = 1 else j = i + 1 >A = SUM(y[i] - y[j]) * (z[i] + z[j]) for i = 1 to N >B = SUM(z[i] - z[j]) * (x[i] + x[j]) for i = 1 to N >C = SUM(x[i] - x[j]) * (y[i] + y[j]) for i = 1 to N >D = (A * x[0] + B * y[0] + C * z[0]) Actually, I think D = -(Ax[k] + By[k] + Cz[k]), for any k in 1..N. >Unfortunately, with the previously mentioned points: [A=B=C=0] >Oops, by inspection we can see that the equation for this plane is >y = -2. So, what's wrong? Has someone noticed this before and fixed >it. Actually, by inspection we see that y = 2, but I guess that's a typo. Anyway, your problem is that you're overdetermining your plane. A plane can be described by three points, and I'm guessing that Newell's technique takes advantage of that. Let's try it: (2,2,0), (12,2,0), (2,2,3) A=(2- 2)(0+ 0)+(2- 2)( 0+3)+(2-2)(3+0)= 0*0+ 0*3 +0*3= 0+ 0+ 0= * 0 * B=(0- 0)(2+12)+(0- 3)(12+2)+(3-0)(2+2)=0(-14) +(-3)*14+3*4= 0-42+12= * -30 * C=(2-12)(2+ 2)+(12-2)( 2+2)+(2-2)(2+2)=(-10)*4+ 10*4 +0*4=-40+40+ 0= * 0 * So, we have 0*x-30*y+0*z=-D. Plugging in (2,2,0), we get -30*2=-D or D=60. In other words, -30 * y + 60 = 0, or y = 2. I think it's safe to assume that we'll get the same results for any combination of three of your four points. Henry Neeman neeman@csrd.uiuc.edu