MCPcopy Index your code
hub / github.com/processing/processing / intersect

Method intersect

core/src/processing/core/PImage.java:1889–1919  ·  view source on GitHub ↗

Check to see if two rectangles intersect one another

(int sx1, int sy1, int sx2, int sy2,
                            int dx1, int dy1, int dx2, int dy2)

Source from the content-addressed store, hash-verified

1887 * Check to see if two rectangles intersect one another
1888 */
1889 private boolean intersect(int sx1, int sy1, int sx2, int sy2,
1890 int dx1, int dy1, int dx2, int dy2) {
1891 int sw = sx2 - sx1 + 1;
1892 int sh = sy2 - sy1 + 1;
1893 int dw = dx2 - dx1 + 1;
1894 int dh = dy2 - dy1 + 1;
1895
1896 if (dx1 < sx1) {
1897 dw += dx1 - sx1;
1898 if (dw > sw) {
1899 dw = sw;
1900 }
1901 } else {
1902 int w = sw + sx1 - dx1;
1903 if (dw > w) {
1904 dw = w;
1905 }
1906 }
1907 if (dy1 < sy1) {
1908 dh += dy1 - sy1;
1909 if (dh > sh) {
1910 dh = sh;
1911 }
1912 } else {
1913 int h = sh + sy1 - dy1;
1914 if (dh > h) {
1915 dh = h;
1916 }
1917 }
1918 return !(dw <= 0 || dh <= 0);
1919 }
1920
1921
1922 //////////////////////////////////////////////////////////////

Callers 1

blendMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected