Download Now

    Reference TPolylineSet

    Declared in Codebot.Physics.pas on line 1240

    TPolylineSet is a set of polylines, such as outlines traced from samples
      TPolylineSet = record
      public
        Ref: cpPolylineSet;
        class operator Implicit(const Value: TPolylineSet): cpPolylineSet; inline;
        class operator Implicit(const Value: cpPolylineSet): TPolylineSet; inline;
        { Create an empty polyline set }
        class function Create: TPolylineSet; static;
        { Create a set of convex hulls which match a concave polygon to within tol.
          The polygon is closed and its winding corrected if needed. }
        class function ConvexDecomposition(Polyline: TPolyline; Tol: Float): TPolylineSet; static;
        { Trace the anti-aliased contours of an image where the samples cross a
          threshold. The box is sampled in a grid of at least two samples in each
          direction. }
        class function MarchSoft(const Box: cpBB; XSamples, YSamples: Integer; Threshold: Float; Sample: TMarchSample): TPolylineSet; overload; static;
        { Trace outlines from samples, with smooth edges }
        class function MarchSoft(const Box: cpBB; XSamples, YSamples: Integer; Threshold: Float; Sample: cpMarchSampleFunc; Data: Pointer = nil): TPolylineSet; overload; static;
        { Trace the aliased contours of an image where the samples cross a threshold }
        class function MarchHard(const Box: cpBB; XSamples, YSamples: Integer; Threshold: Float; Sample: TMarchSample): TPolylineSet; overload; static;
        { Trace outlines from samples, with hard edges }
        class function MarchHard(const Box: cpBB; XSamples, YSamples: Integer; Threshold: Float; Sample: cpMarchSampleFunc; Data: Pointer = nil): TPolylineSet; overload; static;
        { Free the set and optionally the polylines it holds }
        procedure Free(FreeLines: Boolean = True);
        { True if this refers to nothing }
        function IsNil: Boolean; inline;
        { Add a segment which starts a new polyline, extends or joins polylines, or
          closes a polyline }
        procedure AddSegment(const A, B: TVec2);
        { Enumerates the polylines of the set }
        function GetEnumerator: TPolylineSetEnumerator;
        { The number of polylines }
        property Count: Integer read GetCount;
        { The polylines by index }
        property Line[Index: Integer]: TPolyline read GetLine; default;
      end;

    See also

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