Re: some geometry questions. [message #48152] |
Fri, 31 March 2006 08:50  |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
David Fanning <davidf@dfanning.com> writes:
> qian writes:
>
>> If I have 4 random points (x0,y0) (x1,y1), (x3,y3), (x4,y4), is there a
>> simple way to decide whether one of them is inside of the triangle
>> formed by the other three points?
>>
>> If none of them is in the triangle by others, how can I connect them in
>> order to form a 4 edges polygon, instead of two head on triangles, when
>> using order 1-2-3-4-1?
>>
>> like this:
>> 1----2
>> \ \
>> 4\__\3
>>
>> not like this:
>> 1-----2
>> \ /
>> /\
>> / \
>> 3-----4
>
> You are looking for a "complex hull algorithm", such as this
> one:
>
> http://nms.csail.mit.edu/~aklmiu/6.838/convexhull/index.html
>
> In IDL you can find the convex hull of a set of points
> with the TRIANGULATE command:
>
> http://www.dfanning.com/tips/convex_hull.html
David, I'm surprised you didn't refer to your own page, "Is Point
Inside Polygon?"
http://www.dfanning.com/tips/point_in_polygon.html
I've been using the algorithm you printed there by Krane for several
years and it works well. It is vectorized.
Craig
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@REMOVEcow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
|
|
|