Properties
Category
English
Statistics
Comments
5
Participants
2
Subscribers
0
Votes
1
Views
1570
Share
IsPointInsidePolygon
Answered
Is there a predefined function to check whether a point is inside the (possibly nonconvex) polygon? If there isn't, how can I define it?
 GeoGebra
 Help
 Partners

Contact us
 Feedback & Questions
 This email address is being protected from spambots. You need JavaScript enabled to view it.
 +43 677 6137 2693
© 2021 International GeoGebra Institute
ideas:
1º) define isinsidetriangle[A,B,C,H] (could be using baricentre coords and solving the system or another processing)
2º) H is inside poly[A,B,C,D,E,F,G] when the number isinsidetriangle[A,B,C,H]+isinsidetriangle[A,C,D,H]+isinsidetriangle[A,D,E,H]+isinsidetriangle[A,E,F,H] + isinsidetriangle[A,F,G,H] is a odd number
i hope to be useful
saludos
new idea:
IsInsideTriangle[A,B,C,H]=polygon[A,B,C]==polygon[A,B,H]+polygon[B,C,H]+polygon[A,C,H]
saludos
I don't know barycentric coords, so I don't really have an idea how to do this.
But I did try to implement a PointInsideTriangle using the winding number method: the sum of angles ADB, BDC and CDB is 0 iff D is outside triangle ABC. This worked to some extent: if you changed the triangle orientation by moving one of the vertex points, the result came out wrong.
don't use baricentric coords
use the idea my last reply for point inside triangle
You're right, this works. In fact, I even tried something like this in my very first try but I must have mistyped something because I got wrong result in some cases.
However, it's not possible to define this as a function in a single line as above, is it? I do "t=If[poly1==poly2+poly3+poly4,1,0]" and then construct a macro...
Comments have been locked on this page!