tag:blogger.com,1999:blog-8152247234598992686.post33880210096363411..comments2017-08-28T08:15:58.374-07:00Comments on Totologic: Accurate point in triangle testLogichttp://www.blogger.com/profile/10024617997824703986noreply@blogger.comBlogger35125tag:blogger.com,1999:blog-8152247234598992686.post-1688800052230944712017-08-07T23:46:23.794-07:002017-08-07T23:46:23.794-07:00Oops, to be much easy to verify; I updated the coo...Oops, to be much easy to verify; I updated the coordinate of Point P as below:<br />Point P = (MinX, MinY)<br /><br />Thus, P = (834186.3789, 820799.625)<br /><br />As long as P now is intercept point to hit edge AC, it should inside the triangle ABC.<br /><br />but still, with the logic mentioned on the above, it return a false.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8152247234598992686.post-27703579595468248682017-08-07T23:36:03.528-07:002017-08-07T23:36:03.528-07:00Dear Sir/Madam,
Hi, I am new to this topic, I hav...Dear Sir/Madam,<br /><br />Hi, I am new to this topic, I have tried your code but I cant get the expected result, below is some of the information:<br /><br />It is given that, I have the following coordinates:<br />MinX = (834186.3789)<br />MinY = (820799.625)<br />MaxX = (834910.8751)<br />MaxY = (821412.6876)<br /><br />Point A = (MaxX, 0)<br />Point B = (MinX, 0)<br />Point C = (0, MaxY)<br /><br />Point P = (834620, 821059)<br /><br />And form a Triangle ABC <br /><br />You can find that,the range of Px is between Ax and Bx; And Py is less than MaxY, thus, I expect that Point P should be in the Triangle ABC.<br /><br />but with the work it done; The program on the above return FALSE; which is not as expected.<br /><br />Can you please help me to have a look, is there any I misunderstood or misused your code?<br /><br />Many Thanks.<br /> Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8152247234598992686.post-45923899756211647782017-04-03T19:33:32.351-07:002017-04-03T19:33:32.351-07:00Unfortunately it doesn't work on a sphere. If ...Unfortunately it doesn't work on a sphere. If you flatten your local geometry to fit an euclidean 2D space, your triangle will be made from curves, that makes things a bit more complicated.Logichttps://www.blogger.com/profile/10024617997824703986noreply@blogger.comtag:blogger.com,1999:blog-8152247234598992686.post-57374614895514248292017-03-30T02:40:33.750-07:002017-03-30T02:40:33.750-07:00Hi!
Excellent article!
Will this work with lat,lng...Hi!<br />Excellent article!<br />Will this work with lat,lng coordinates (of earth, assuming perfect sphere)?Oren Ben-Dovhttps://www.blogger.com/profile/12766366566010072079noreply@blogger.comtag:blogger.com,1999:blog-8152247234598992686.post-34815497818819442822017-03-30T02:39:32.431-07:002017-03-30T02:39:32.431-07:00This comment has been removed by the author.Unknownhttps://www.blogger.com/profile/12766366566010072079noreply@blogger.comtag:blogger.com,1999:blog-8152247234598992686.post-34981296615419827192017-01-15T03:30:43.398-08:002017-01-15T03:30:43.398-08:00Hi.
You must "translate" my AS3 code in...Hi.<br /><br />You must "translate" my AS3 code into IDL code.<br /><br />It is not difficult because my code only use basic features (variable, function, if-else structure) and a few maths being common in all programming languages.<br /><br />At this point I have never worked with IDL so I can't help you more.Logichttps://www.blogger.com/profile/10024617997824703986noreply@blogger.comtag:blogger.com,1999:blog-8152247234598992686.post-26951142527882089802017-01-13T21:14:53.857-08:002017-01-13T21:14:53.857-08:00Hi! Your article is very helpful. I am a beginner ...Hi! Your article is very helpful. I am a beginner and I would like to know how to use these codes using IDL (Interactive Data Language). Thank you and more power. Khate Bayerhttps://www.blogger.com/profile/02662182394149683960noreply@blogger.comtag:blogger.com,1999:blog-8152247234598992686.post-47844688667774700652016-11-16T03:53:04.053-08:002016-11-16T03:53:04.053-08:00Thanks for you reply!Thanks for you reply!David Frogernoreply@blogger.comtag:blogger.com,1999:blog-8152247234598992686.post-88566685240408258892016-11-05T09:50:20.016-07:002016-11-05T09:50:20.016-07:00Well, for N<7 its not too bad, but the Delaunay...Well, for N<7 its not too bad, but the Delaunay procedure is certainly worth looking into. Can "CM" of the polygon, X=(sum Xi, i=1..N)/N, play a useful role in sorting vertices?Bob Terryhttps://www.blogger.com/profile/07137578798614253121noreply@blogger.comtag:blogger.com,1999:blog-8152247234598992686.post-51412245812533673712016-11-05T05:54:38.801-07:002016-11-05T05:54:38.801-07:00Take care how you build your list of triangles. Co...Take care how you build your list of triangles. Considering ALL possible triangles made from the vertices list is not efficient. On the other hand, trying to optimize your triangles list, you could miss one or several.<br /><br />You should consider to build a Delaunay triangulation from your n-vertices polygon.<br /><br />Or check for algorithms directly dedicated to n-sides polygons.Logichttps://www.blogger.com/profile/10024617997824703986noreply@blogger.comtag:blogger.com,1999:blog-8152247234598992686.post-72922427687502985752016-11-05T05:45:47.585-07:002016-11-05T05:45:47.585-07:00Winding number method is a powerful method for n-s...Winding number method is a powerful method for n-sides polygons. But applied and optimized to 3 sides polygons, it is equivalent to the "check sides" method I exposed ;)Logichttps://www.blogger.com/profile/10024617997824703986noreply@blogger.comtag:blogger.com,1999:blog-8152247234598992686.post-25290487292240862872016-11-04T08:54:36.049-07:002016-11-04T08:54:36.049-07:00Ok, suppose that we have a general convex polygon,...Ok, suppose that we have a general convex polygon, N vertices.<br /><br />We seek to place or reject a test point, P within the polygon.<br /><br />We select as many test triangles as possible, N points 3 at a time, and apply the test on each triangle.<br /><br />The test point is in the polygon if it rests within at least one of the [N,3] of the triangles.<br /><br />Right?Bob Terryhttps://www.blogger.com/profile/07137578798614253121noreply@blogger.comtag:blogger.com,1999:blog-8152247234598992686.post-34896437376936139282016-11-03T16:50:51.379-07:002016-11-03T16:50:51.379-07:00Hello, what about the winding number method [1] fo...Hello, what about the winding number method [1] for the step 2?<br /><br />thanks!<br /><br />[1] http://geomalgorithms.com/a03-_inclusion.htmlDavid Frogerhttps://github.com/dfrogernoreply@blogger.comtag:blogger.com,1999:blog-8152247234598992686.post-48590890937085933512016-06-06T12:51:03.264-07:002016-06-06T12:51:03.264-07:00Thank you very much.Thank you very much.lchtanhttps://www.blogger.com/profile/00405559574145155062noreply@blogger.comtag:blogger.com,1999:blog-8152247234598992686.post-72120007165923767602016-05-30T03:49:06.913-07:002016-05-30T03:49:06.913-07:00Very good article. Thanks a lot it was very useful...Very good article. Thanks a lot it was very usefull to me.MrLikeidontcarehttps://www.blogger.com/profile/12945519555943583864noreply@blogger.comtag:blogger.com,1999:blog-8152247234598992686.post-26812800670648337862015-11-24T17:54:38.396-08:002015-11-24T17:54:38.396-08:00Thank you.Thank you.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8152247234598992686.post-39086688179525623122015-11-10T04:17:07.498-08:002015-11-10T04:17:07.498-08:00If you are not sure that your triangle is safe, be...If you are not sure that your triangle is safe, better is to check it before perfoming calculation. Check if any 2 points don't overlap. But problems can still occur with points being too close from each other !<br /><br />That is why in my library (Daedalus Lib) I proceeded differently. I choosed to merge points that are too close each other. For that I checked if the distance is smaller than the epsilon value.Logichttps://www.blogger.com/profile/10024617997824703986noreply@blogger.comtag:blogger.com,1999:blog-8152247234598992686.post-38470013624272812472015-11-09T20:26:14.087-08:002015-11-09T20:26:14.087-08:00so first you have to test if the triangle is in fa...so first you have to test if the triangle is in fact a triangle?drecnoreply@blogger.comtag:blogger.com,1999:blog-8152247234598992686.post-50809424905754423802015-08-27T10:53:20.124-07:002015-08-27T10:53:20.124-07:00A graphical area is a semi-open interval - for con...A graphical area is a semi-open interval - for consistency this is usually done with lower bound inclusive, upper bound exclusive. A point on the boundary of two regions should not be in both; it should be in the region where the point is inclusive and excluded from the region where the point is exclusive. Very few graphics packages handle this issue properly - most have a fencepost error on the boundary. It should be possible to draw two squares from (0,0) to (10,10) and from (10,0) to (20,10) and have them abut exactly, as the pixels should be drawn from 0..9 and 10..19 - in which case a point such as (10,5) would belong to the (10,0) to (20,10) square only.Ghttps://www.blogger.com/profile/04079389970653405030noreply@blogger.comtag:blogger.com,1999:blog-8152247234598992686.post-60557344438161067292015-07-15T14:57:49.456-07:002015-07-15T14:57:49.456-07:00Yes from a computational point of view, they are v...Yes from a computational point of view, they are very close. But the concepts involved in the reasonings are different, that's why I found interesting to expose both.Logichttps://www.blogger.com/profile/10024617997824703986noreply@blogger.comtag:blogger.com,1999:blog-8152247234598992686.post-54773898368076641102015-07-15T13:58:04.779-07:002015-07-15T13:58:04.779-07:00Aren't the first and second methods the same t...Aren't the first and second methods the same thing? Joenoreply@blogger.comtag:blogger.com,1999:blog-8152247234598992686.post-2294873761870991802015-03-17T12:21:20.470-07:002015-03-17T12:21:20.470-07:00thanks a lotthanks a lotAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-8152247234598992686.post-57333204756537495442015-03-10T06:12:11.407-07:002015-03-10T06:12:11.407-07:00Awesome thank you very much for the help!
I will g...Awesome thank you very much for the help!<br />I will go ahead and implement it that way. Also thanks again for this great article! I will definitely come back to it, the next time I need a accurate triangle/point test! Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8152247234598992686.post-13471023143643321872015-03-09T22:06:55.372-07:002015-03-09T22:06:55.372-07:00If your purpose is to identify the quad the user h...If your purpose is to identify the quad the user has clicked on, you can use your method, I think you will not face problems.Logichttps://www.blogger.com/profile/10024617997824703986noreply@blogger.comtag:blogger.com,1999:blog-8152247234598992686.post-14037770457002438152015-03-08T12:36:20.635-07:002015-03-08T12:36:20.635-07:00Aha I see that makes sense!
What I am trying to do...Aha I see that makes sense!<br />What I am trying to do is a is-point-on-quad-test. The quad might be distorted in whatever way the user drags the corners. So my idea was to divide the quad into two triangles and simply test if the point is on either of those. There might be an arbitrary amount of quads, so I am a little cautious about computation time.<br />Since the trinagles share a border is it save to assume, that the barycentric test including Epsilon will not fail, if the point lies directly on the border?Anonymousnoreply@blogger.com