Download Now

    Reference TPolygon

    Declared in Codebot.Physics.pas on line 208

    TPolygon is a convex polygon shape
      TPolygon = record
      public
        Ref: cpPolyShape;
        class operator Implicit(const Value: TPolygon): cpPolyShape; inline;
        class operator Implicit(const Value: cpPolyShape): TPolygon; inline;
        class operator Implicit(const Value: TPolygon): cpShape; inline;
        class operator Implicit(const Value: cpShape): TPolygon; inline;
        { Remove the polygon from its space and free it }
        procedure Free;
        { True if this refers to nothing }
        function IsNil: Boolean; inline;
        { Replace the vertices with a convex hull of verts }
        procedure Reshape(Verts: PVec2; Count: Integer; Transform: PMatrix2x3 = nil); overload;
        { Replace the vertices with a box centered on the body }
        procedure Reshape(const Width, Height: Float; Transform: PMatrix2x3 = nil); overload;
        { Replace the vertices without computing a convex hull. The vertices must be
          convex with a counter-clockwise winding. }
        procedure ReshapeRaw(Verts: PVec2; Count: Integer);
        { The radius of the rounded corners }
        property Border: Float read GetBorder write SetBorder;
        { The number of vertices }
        property VertCount: Integer read GetVertCount;
        { The vertices by index }
        property Vert[Index: Integer]: TVec2 read GetVert;
      end;

    See also

    Float in Codebot.System.pas
    TVec2 in Codebot.Geometry.pas