rem ********************* 3PTCONIC.CDL *********************** rem Copy Right by International Technology Transfer Corp. rem revision 1.0 7/30/99 rem Conic with 3 points rem ************** Procedure ************************* rem 1. Define view for Conic (Do not forget) rem 2. Select 3 points rem 3. Create conic through 3 points clear defopt = 2 acc = 0.00001 :start getpos "Indicate 1st Point",defopt on (@key + 3) goto exit, start, defopt=@key wx1 = @xworld wy1 = @yworld wz1 = @zworld :second getpos "Indicate 2nd Point",defopt on (@key + 3) goto exit, start, second, defopt=@key wx2 = @xworld wy2 = @yworld wz2 = @zworld :third getpos "Indicate 3rd Point",defopt on (@key + 3) goto exit, second, third, defopt=@key wx3 = @xworld wy3 = @yworld wz3 = @zworld call xfwv,wx1,wy1,wz1,vx1,vy1,vz1 call xfwv,wx2,wy2,wz2,vx2,vy2,vz2 call xfwv,wx3,wy3,wz3,vx3,vy3,vz3 det = vx1 * vx2 * (vx1 - vx2) + vx2 * vx3 * (vx2 - vx3) + vx3 * vx1 * (vx3 - vx1) f1 = vx1 - vx2 g1 = vy1 - vy2 f2 = vx2 - vx3 g2 = vy2 - vy3 if (abs(det)>acc) goto next1 pause "Position is not correctiPress Return Key)" goto start :next1 if (abs(vy1-vy2)>acc || abs(vy2-vy3)>acc) goto next2 pause "Position is not correctiPress Return Key)" goto start :next2 if (abs(f1-f2)>acc || abs(g1-g2)>acc) goto next3 pause "Position is not correctiPress Return Key)" goto start :next3 a=((vy1-vy2)*(vx2-vx3)-(vy2-vy3)*(vx1-vx2))/(vx1-vx2)/(vx2-vx3)/(vx3-vx1) d=-(vy1-vy2)/(vx1-vx2)-(vx1+vx2)*a f=-(vx1*vx1*a+vx1*d+vy1) b = 0 c = 0 e = 1 conic a, b, c, d, e, f, vx1, vy1, vx3, vy3, vz1 goto start :exit