Download Now

    Reference TPolyline

    Declared in Codebot.Physics.pas on line 1178

    TPolyline is a line through a list of points
      TPolyline = record
      public
        Ref: cpPolyline;
        class operator Implicit(const Value: TPolyline): cpPolyline; inline;
        class operator Implicit(const Value: cpPolyline): TPolyline; inline;
        { Create a polyline from points. When closed is true the first point is
          appended if it is not already the last point. }
        class function Create(const Points: array of TVec2; Closed: Boolean = False): TPolyline; static;
        { Free the polyline }
        procedure Free;
        { True if this refers to nothing }
        function IsNil: Boolean; inline;
        { Return a new copy of the polyline }
        function Copy: TPolyline;
        { Return a new polyline simplified using the Douglas-Peucker algorithm,
          which works well on smooth or gently curved shapes. The result is never
          farther than tol from the original. }
        function SimplifyCurves(Tol: Float): TPolyline;
        { Return a new polyline simplified by discarding flat vertices, which works
          well on straight edged or angular shapes. Tol is the minimum angle in
          radians of a vertex. }
        function SimplifyVertexes(Tol: Float): TPolyline;
        { Return a new closed polyline of the convex hull }
        function ToConvexHull(Tol: Float = 0): TPolyline;
        { Return a copy of the vertices }
        function ToArray: TArray<TVec2>;
        { The number of vertices }
        property Count: Integer read GetCount;
        { The vertices by index }
        property Vert[Index: Integer]: TVec2 read GetVert; default;
        { The address of the first vertex, which can be passed to NewPolygon }
        property Verts: PVec2 read GetVerts;
        { True if the last vertex joins the first }
        property Closed: Boolean read GetClosed;
      end;

    See also

    Float in Codebot.System.pas
    TArray<T> in Codebot.System.pas
    TVec2 in Codebot.Geometry.pas