先把代码贴在这里
//判断当前图形是否为直线
function TForm1.prepare(myPoint,firstPoint,secondPoint:TPoint):boolean;
var
  lengthA,lengthB,lengthC:real;
  lengthX,lengthY:real;
begin
  lengthX:=abs(myPoint.X-firstPoint.X );
  lengthY:=abs(myPoint.Y-firstPoint.Y );
  lengthX:=sqr(lengthX);
  lengthY:=sqr(lengthY);
  lengthA:=sqrt(lengthX+lengthY);  lengthX:=abs(myPoint.X-secondPoint.X );
  lengthY:=abs(myPoint.Y-secondPoint.Y );
  lengthX:=sqr(lengthX);
  lengthY:=sqr(lengthY);
  lengthB:=sqrt(lengthX+lengthY);  lengthX:=abs(secondPoint.X-firstPoint.X );
  lengthY:=abs(secondPoint.Y-firstPoint.Y );
  lengthX:=sqr(lengthX);
  lengthY:=sqr(lengthY);
  lengthC:=sqrt(lengthX+lengthY);  if lengthA+lengthB<lengthC+1 then
    result:=true
  else
    result:=false;
end;//判断当前图形是否为矩形
function TForm1.prepareRect(myPoint,firstPoint,secondPoint:TPoint):boolean;
var
  bigX,smallX,bigY,smallY:integer;
begin
  if firstPoint.X >secondPoint.X then
  begin
     bigX:=firstPoint.X ;
     smallX:=secondPoint.X ;
  end
  else
  begin
     bigX:=secondPoint.X ;
     smallX:=firstPoint.X ;
  end;  if firstPoint.Y >secondPoint.Y then
  begin
    bigY:=firstPoint.Y ;
    smallY:=secondPoint.Y;
  end
  else
  begin
    bigY:=secondPoint.Y ;
    smallY:=firstPoint.Y ;
  end;  if (myPoint.X>smallX-5) and (myPoint.X<smallX+10) and (myPoint.Y>smallY-5) and (myPoint.Y<bigY+5) then
     result:=true
  else if (myPoint.X>smallX-5) and (myPoint.X<bigX+5) and (myPoint.Y>bigY-10) and (myPoint.Y<bigY+5) then
          result:=true
  else if (myPoint.X>bigX-10) and (myPoint.X<bigX+5) and (myPoint.Y>smallY-5) and (myPoint.Y<bigY+5) then
          result:=true
  else if (myPoint.X>smallX-5) and (myPoint.X<bigX+5) and (myPoint.Y>smallY-5) and (myPoint.Y<smallY+10) then
          result:=true
  else
     result:=false;
end;//判断当前图形是否为椭圆
function TForm1.prepareEllips(myPoint,firstPoint,secondPoint:TPoint):boolean;
var
  length2A,lengthA2,lengthB2,lengthC:real;
  lengthX,lengthY:real;
  deltaX2,deltaY2:real;
  myLength1,myLength2:real;
begin  lengthX:=abs(secondPoint.X-firstPoint.X )/2;
  lengthY:=abs(secondPoint.Y-firstPoint.Y )/2;  if lengthX>lengthY then
  begin
    lengthA2:=sqr(lengthX);
    lengthB2:=sqr(lengthY);
    lengthC:=sqrt(lengthA2-lengthB2);
    length2A:=2*lengthX ;
    deltaX2:=sqr((firstPoint.X+secondPoint.X)/2-lengthC-myPoint.X);
    deltaY2:=sqr((firstPoint.Y+secondPoint.Y)/2-myPoint.Y);
    myLength1:=sqrt(deltaX2+deltaY2);
    deltaX2:=sqr((firstPoint.X+secondPoint.X)/2+lengthC-myPoint.X);
    myLength2:=sqrt(deltaX2+deltaY2);
  end
  else
  begin
    lengthA2:=sqr(lengthY);
    lengthB2:=sqr(lengthX);
    lengthC:=sqrt(lengthA2-lengthB2);
    length2A:=2*lengthY;
    deltaX2:=sqr((firstPoint.x+secondPoint.x)/2-myPoint.x);
    deltaY2:=sqr((firstPoint.Y +secondPoint.Y )/2+lengthC-myPoint.Y );
    myLength1:=sqrt(deltaX2+deltaY2);
    deltaY2:=sqr((firstPoint.Y +secondPoint.Y )/2-lengthC-myPoint.Y );
    myLength2:=sqrt(deltaX2+deltaY2);
  end;  if (myLength1+myLength2<length2A+5)and (myLength1+myLength2>length2A-8)then
     result:=true
  else
     result:=false;
end;//判断当前图形是否为圆
function TForm1.prepareCircle(myPoint,centrePoint,edgePoint:TPoint):boolean;
var
  radius,lengthP:real;
  lengthX,lengthY:real;
begin
  lengthX:=abs(centrePoint.X -edgePoint.X );
  lengthY:=abs(centrePoint.Y -edgePoint.Y );
  lengthX:=sqr(lengthX);
  lengthY:=sqr(lengthY);
  radius:=sqrt(lengthX+lengthY);  lengthX:=abs(myPoint.X-centrePoint.X );
  lengthY:=abs(myPoint.Y-centrePoint.Y );
  lengthX:=sqr(lengthX);
  lengthY:=sqr(lengthY);
  lengthP:=sqrt(lengthX+lengthY);  if (lengthP<radius+6) and (lengthP>radius-8) then
     result:=true
  else
     result:=false;
end;能否帮我解释一下
1.判断直线的时候,最后的if语句为什么要lengthC+1 ,加一.
2.判断矩形和椭圆的思路是什么?以前学过关于椭圆的东西都忘记掉了5555555555555
3.判断圆的时候,最后的if语句(lengthP<radius+6) and (lengthP>radius-8) ,为什么要取这个范围??谢谢你帮忙啦~~*^_^*