returns true if point is on the surface
| 50 | |
| 51 | // returns true if point is on the surface |
| 52 | bool EdgeDetect(const uint32_t* img, uint32_t w, uint32_t h, int x, int y) |
| 53 | { |
| 54 | bool center = Sample(img, w, h, x, y) != 0; |
| 55 | |
| 56 | for (int j=y-1; j <= y+1; ++j) |
| 57 | { |
| 58 | for (int i=x-1; i <= x+1; ++i) |
| 59 | { |
| 60 | if ((0 != Sample(img, w, h, i, j)) != center) |
| 61 | { |
| 62 | return true; |
| 63 | } |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | return false; |
| 68 | } |
| 69 | |
| 70 | |
| 71 | // returns true if point is on the surface |