Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Ranking points in the plane

Subject: Ranking points in the plane

From: Miroslav

Date: 4 Nov, 2010 12:54:03

Message: 1 of 5

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

Subject: Ranking points in the plane

From: Walter Roberson

Date: 4 Nov, 2010 13:38:33

Message: 2 of 5

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()

Subject: Ranking points in the plane

From: Miroslav

Date: 4 Nov, 2010 13:58:03

Message: 3 of 5

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()

Subject: Ranking points in the plane

From: Walter Roberson

Date: 4 Nov, 2010 14:23:29

Message: 4 of 5

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 counter-clockwise 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!

Subject: Ranking points in the plane

From: Miroslav

Date: 4 Nov, 2010 14:46:04

Message: 5 of 5

Walter Roberson <roberson@hushmail.com> wrote in message <ClzAo.8714$lL3.8007@newsfe08.iad>...
> 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 counter-clockwise 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!


Thank you ! I try this

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us