5 Answers, 1 is accepted
0
Hello Turian,
Petar Mladenov
the Telerik team
The RadDiagramShape.Bounds gives you a bounding rectangle of type Rect. The Rect type has Intersect() method which you can use in your scenario.
Regards,Petar Mladenov
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
0
Turian
Top achievements
Rank 1
answered on 26 Mar 2013, 12:54 PM
Thank you for the reply.
However, I don't want to use bound. I have polygon as RadDiagramShape. The polygon is not fully occupied the bound. Is there a way to check intersection of polygon instead of bound of polygon?
However, I don't want to use bound. I have polygon as RadDiagramShape. The polygon is not fully occupied the bound. Is there a way to check intersection of polygon instead of bound of polygon?
0
Hi Turian,
Petar Mladenov
the Telerik team
You can use the following methods from Telerik.Windows.Diagrams.Core:
- public static bool AreLinesIntersecting(Point a, Point b, Point c, Point d, ref Point crossingPoint)
- public static Point FindLinesIntersection(Point a, Point b, Point c, Point d, bool acceptNaN = false)
- public static bool IntersectionPointOnEllipse(Collection<Point> points, Point org, Point end, ref Point result)
- public static void IntersectionPointOnRectangle(Rect rectangle, Point pt1, Point pt2, ref Point intersectionPoint)
- public static bool Intersect(Point[] points)
- public static bool SegmentIntersect(Point s1, Point s2, Point l1, Point l2, ref Point p)
So if you know the polygon segments of your shape, probably these methods will be helpful.
Kind regards,Petar Mladenov
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
0
Artem
Top achievements
Rank 1
answered on 05 Nov 2016, 01:22 PM
could you pleas provide an example of how to use these methods to check overlapping?
0
Hello Artem,
The mentioned methods are coupled to shape types - if one of the two shapes is rectangle, and other is ellipse, you can foreach the sides of the rectangle in order to find IntersectionPointOnEllipse.
Instead of posting diagram specific code here, I will try to explain that the problem is more generic. Every shape in Diagram is pretty much a Path and every shape in Diagram has Geometry property of type System.Windows.Media.Geometry. So the generic problem is how to find that two Paths or two Geometries are intersecting ? I am sure many stackoverflow, msdn forums have some suggestions on how this can be achieved. For example this one:
Getting the intersection points of two [path] geometries in WPF
Regards,
Petar Mladenov
Telerik by Progress
The mentioned methods are coupled to shape types - if one of the two shapes is rectangle, and other is ellipse, you can foreach the sides of the rectangle in order to find IntersectionPointOnEllipse.
Instead of posting diagram specific code here, I will try to explain that the problem is more generic. Every shape in Diagram is pretty much a Path and every shape in Diagram has Geometry property of type System.Windows.Media.Geometry. So the generic problem is how to find that two Paths or two Geometries are intersecting ? I am sure many stackoverflow, msdn forums have some suggestions on how this can be achieved. For example this one:
Getting the intersection points of two [path] geometries in WPF
Regards,
Petar Mladenov
Telerik by Progress
Do you need help with upgrading your WPF project? Try the Telerik API Analyzer and share your thoughts!