AravindK
AravindK

Reputation: 151

Difference between ptSubject and ptClip in ClipperLib

when polygon1 and polygon2 contains the same Coordinates (10,10) (20,10) (20,20) (10,20)

Clipper c;
c.AddPaths(polygon1,ptSubject);
c.AddPaths(polygon2,ptClip);
c.Execute(ctUnion,polyUnion,pftNonZero,pftNonZero);

polygon1 and polygon2 are Closed loops How ptSubject and ptClip will perform?.

Upvotes: 4

Views: 706

Answers (1)

Angus Johnson
Angus Johnson

Reputation: 4643

For all clipping operations except for 'difference', subject and clip polygons can be interchanged without affecting the result, and in the case of 'union' they can both be 'clip' or both be 'subject'. However, only 'subject' paths may be open.

More info here: http://www.angusj.com/delphi/clipper/documentation/Docs/Units/ClipperLib/Classes/ClipperBase/Methods/AddPaths.htm

Initially, clipping referred to the process of excluding data (paths, images etc) that resided outside a rectangular clipping window. However, this process has been generalized to include non-rectangular clipping regions, and to include union, difference and XOR Boolean operations (where admittedly the 'subject' and clip' labels make less sense).

Upvotes: 4

Related Questions