rem AREA_PGN.CDL rem Copy Right by International Technology Transfer Corp. rem revision 1.0 7/30/99 rem Area of Triangle Polygon Mesh clear :start count = 0 s = 0 getmenu "Select Polygon","Single","Window","Polygon","All Dsp" on ( @key + 3 ) goto exit,start, selno=@key if (selno==4) selno=7 if (selno==3) selno=4 if (selno==2) selno=3 getentm selno,nument :polygon count=count+1 if (count>nument) goto hyouji getnext enttype,count if (enttype!=6) goto polygon if (@intdat[10]!=3) goto polygon wx1 = @fltdat[0] wy1 = @fltdat[1] wz1 = @fltdat[2] wx2 = @fltdat[3] wy2 = @fltdat[4] wz2 = @fltdat[5] wx3 = @fltdat[6] wy3 = @fltdat[7] wz3 = @fltdat[8] a = (wy2 - wy1) * (wz3 - wz1) - (wz2 - wz1) * (wy3 - wy1) b = (wz2 - wz1) * (wx3 - wx1) - (wx2 - wx1) * (wz3 - wz1) c = (wx2 - wx1) * (wy3 - wy1) - (wy2 - wy1) * (wx3 - wx1) s = sqrt(a * a + b * b + c * c) / 2 + s goto polygon :hyouji pause "Area of Triangle Polygon Mesh = %.3f", s :exit