MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/FleX / EdgeDetect

Function EdgeDetect

core/sdf.cpp:52–68  ·  view source on GitHub ↗

returns true if point is on the surface

Source from the content-addressed store, hash-verified

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

Callers 1

MakeSDFFunction · 0.85

Calls 1

SampleFunction · 0.85

Tested by

no test coverage detected