IntersectsEdge determines whether a rectangle touches the edge of another rectangle. In order to determine this, the two rectangles must intersect and the current rectangle cannot contain the second rectangle.
Parameters |
Description |
const Rect<T> & r |
A rectangle that is compared to a current rectangle to determine edge intersection. |
T leftw |
A value that the x1 component of the current rectangle is contracted by before determining whether the current rectangle contains the passed one. |
T topw |
A value that the y1 component of the current rectangle is contracted by before determining whether the current rectangle contains the passed one |
T rightw |
A value that the x2 component of the current rectangle is contracted by before determining whether the current rectangle contains the passed one. |
T bottomw |
A value that the y2 component of the current rectangle is contracted by before determining whether the current rectangle contains the passed one. |
A Boolean value of 1 (true) if edge intersection exists between two rectangles and 0 (false) if it does not.
Rect r1(0.0, 0.0, 7.0, 7.0); Rect r2(7.0, 0.0, 10.0, 7.0); Rect r3(0.0, 7.0, 3.0, 10.0); Rect r4(1.0, 1.0, 3.0, 3.0); r1.IntersectsEdge(r2, 1.0); // Returns 1 (true) because the edges of the two rectangles intersect and r1 does not contain r2. r1.IntersectsEdge(r2, 3.0); // Returns 1 (true) because the edges of the two rectangles intersect and r1 does not contain r2. // The sides of r1 are contracted by 3 on each side before determining whether it contains r2 r1.IntersectsEdge(r3, 1.0, 1.0, 1.0, 1.0); // Returns 1 (true) because the edges of the two rectangles intersect and r1 does not contain r3. r1.IntersectsEdge(r4, 1.0, 1.0, 1.0, 1.0); // Returns 0 (false) because r1 contains r4.