Segment Rectangle rectangle intersects with Rectangle
Source: Internet
Author: User
[CSharp]View Plain copy print? /* Function: Determine whether the segment and the rectangle intersect first to determine whether the two endpoints of the line is within the rectangle, the inevitable intersection next to determine whether the bounding box of the segment and the rectangle intersect, do not intersect the line and the rectangle must not intersect the final judgment, the four top of the rectangle If the point is on either side of the line, it is bound to intersect, otherwise it does not intersect */
[CSharp]View Plain copy print?
[CSharp]View Plain copy print?
[CSharp] View plain copy print? using system; using system.collections.generic; using System.Linq; using system.text; namespace consoleapplication1 { class LineConverttoRectangleClass { public class Point { public point (float xx,float yy) { x = xx; y = yy;  &Nbsp; } public float x,y; } public class line { public line (POINT PP1, POINT PP2) { p1 = pp1; p2 = pp2; } public point p1; public Point p2; } public class rectangle { public rectangle (POINT PP1, POINT PP2) { p1 = pp1; p2 = pp2;
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.