On Tue, Apr 4, 2017 at 5:12 AM <[email protected]> wrote: > geometry.intersection doesn't work in this scenario > > In what sense in doesn't work? Is it broken? > > You can find if a circle is wholly inside a polygon in two steps: > 1) find if they intersect each other: > your_polygon = Polygon(Point(a, b), ...) > your_circle = Circle(Point(c, d), radius) > your_polygon.intersection(your_circle) > If you get empty list you know that circle is inside the polygon or > polygon is inside the circle. > > 2)Now you should check if random point from circle is enclosed by polygon: > your_ polygon.encloses_point(your_circle.random_point()) > If you get True, you know that circle is inside polygon. >
Won't this also pass sometimes if the polygon is inside the circle? I think you would need to pick random points in each until you find one that is in one and not the other. However, if the circle circumscribes the polygon and it is very convex (or the other way around), there may be a low probability of finding the desired point. So a more direct solution would be preferred. Aaron Meurer > > Szymon > > W dniu poniedziałek, 3 kwietnia 2017 23:53:03 UTC+2 użytkownik Bron Davies > napisał: > > How can I tell if a circle is wholly inside a polygon? geometry. > intersection doesn't work in this scenario > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/sympy. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sympy/f782bdff-56b5-42af-815c-3901bd807b60%40googlegroups.com > <https://groups.google.com/d/msgid/sympy/f782bdff-56b5-42af-815c-3901bd807b60%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAKgW%3D6L1GrJKqUv3Cex3hVWSCC%2BtnGmiR%2BDaX-5CZ6RFmVCSig%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
