On 04/11/10 8:58 AM, Miroslav wrote:
> thank you please write me solution procedure.
> I have these points in one plane
> A= [0.5000 0.5000 0.5000]
> B= [0.5000 1.0000 0.5000]
> C= [0.5000 0.5000 1.0000]
> D= [0.5000 1.0000 1.0000]
>
> how can i do quadrilateral without diagonal ?
>
>
> Walter Roberson <roberson@hushmail.com> wrote in message
> <tHyAo.15192$3f.2938@newsfe12.iad>...
>> On 04/11/10 7:54 AM, Miroslav wrote:
>> > I have 4 points in the plane, I need is some sort (by angle ?), that
>> > after the merger was a square (rectangle). thanks for the reply
>>
>> Consider using cart2pol()
[junk,phi(1)] = cart2sph(A(1),A(2),A(3));
[junk,phi(2)] = cart2sph(B(1),B(2),B(3));
[junk,phi(3)] = cart2sph(C(1),C(2),C(3));
[junk,phi(4)] = cart2sph(D(1),D(2),D(3));
[sortedphis, sortorder] = sort(phi);
sortorder will now contain a permutation of the integers 1 through 4,
with 1 corresponding to A, 2 corresponding to B, 3 corresponding to C,
and 4 corresponding to D. The permutation that is output will be one of
the possible counterclockwise orderings of the points.
Important note: this code is dependent upon the fact that your X values
are all the same, and that thus the ordering is expressible completely
in terms of phi values. If your plane did not happen to be exactly along
the X axis, then you would need to rotate the points to be either along
one of the axes before you could use a single angular output from
cart2sph() to order the points.
Additional note: the code would be *much* simpler to implement if your
coordinates were all stored in one variable instead of being in one
variable per point!
