[dali_2.3.21] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-physics / third-party / chipmunk2d / include / chipmunk / cpMarch.h
1 // Copyright 2013 Howling Moon Software. All rights reserved.
2 // See http://chipmunk2d.net/legal.php for more information.
3
4 /// Function type used as a callback from the marching squares algorithm to sample an image function.
5 /// It passes you the point to sample and your context pointer, and you return the density.
6 typedef cpFloat (*cpMarchSampleFunc)(cpVect point, void *data);
7
8 /// Function type used as a callback from the marching squares algorithm to output a line segment.
9 /// It passes you the two endpoints and your context pointer.
10 typedef void (*cpMarchSegmentFunc)(cpVect v0, cpVect v1, void *data);
11
12 /// Trace an anti-aliased contour of an image along a particular threshold.
13 /// The given number of samples will be taken and spread across the bounding box area using the sampling function and context.
14 /// The segment function will be called for each segment detected that lies along the density contour for @c threshold.
15 CP_EXPORT void cpMarchSoft(
16   cpBB bb, unsigned long x_samples, unsigned long y_samples, cpFloat threshold,
17   cpMarchSegmentFunc segment, void *segment_data,
18   cpMarchSampleFunc sample, void *sample_data
19 );
20
21 /// Trace an aliased curve of an image along a particular threshold.
22 /// The given number of samples will be taken and spread across the bounding box area using the sampling function and context.
23 /// The segment function will be called for each segment detected that lies along the density contour for @c threshold.
24 CP_EXPORT void cpMarchHard(
25   cpBB bb, unsigned long x_samples, unsigned long y_samples, cpFloat threshold,
26   cpMarchSegmentFunc segment, void *segment_data,
27   cpMarchSampleFunc sample, void *sample_data
28 );