点坐标和矩形的4个点坐标我知道了

解决方案 »

  1.   

    if ptInRect(点坐标, 矩形Rect) then
      ShowMessage('点在矩形内')
    else
      ShowMessage('不在矩形内');
      

  2.   

    Indicates whether a specified point lies inside a specified rectangle.UnitTypesCategory:geometric routinesDelphi syntax:function PtInRect(const Rect: TRect; const P: TPoint): Boolean;C++ syntax:extern PACKAGE bool __fastcall PtInRect(const TRect Rect, const TPoint P);DescriptionPtInRect returns true if the point, P, lies inside the rectangle, Rect, and false if P is not in Rect.PtInRect does not consider a point inside a rectangle if the rectangle has a negative width or height. A point is considered inside a rectangle if it lies on the left or top edge, but not if it lies on the right or bottom edge.
      

  3.   

    procedure TForm1.Button1Click(Sender: TObject);
    var
      p:TPoint;
      r:TRect;
    begin
      p:=point(40,50);
      r:=Rect(0,0,100,100);
      if ptInRect(r,p) then
        showmessage('点在矩形范围内');
    end;
      

  4.   

    矩形和水平面不垂直 。。HELP
      

  5.   

    我有源码可以判断水平面内的矩形(可以平行X,Y轴,也可以不是)
    我在此只想公布算法,相信你自己写的出来
    1.如果矩形某边平行X或Y轴,这个简单,不说了
    2.如果矩形某边不平行X或Y轴(在计算机屏幕上就是斜的)
    假设矩形的某边与X轴的正向夹角为Angle(锐角或钝角都可以)
    矩形的四个顶点是A[0],A[1],A[2],A[3],待判断点是Point
    此时先计算矩形的中心点Center(x,y)
    然后将四个顶点和待判断点是Point同时绕Center(x,y)点顺时针Angle
    计算出四个顶点和判断点Point的新坐标,
    此时的新矩形已经转换成(1.)中的情况
    over
      

  6.   

    TO cll007(gazo)
    哦,了解了解。我以为有函数呢~
      

  7.   

    delphi里面没有这样的特殊函数
    不过ptInRect(r,p)这个api函数功能很强大,可以判断一个点是否在非规则图形里面