From: patrick hull on
Given 'x' and 'y' data below, does anyone know how to connect the points without any lines crossing over, in other words create a single area? Polyarea often creates shapes with lines that cross-over each other.

x=[ 1.4459
4.2018
0.7925
0.1146
2.9969
3.2423
1.4459]

y=[ 2.4448
4.9663
2.5656
1.9146
2.7304
0.3700
2.4448]
From: John D'Errico on
"patrick hull" <pabaholic.nospam(a)yahoo.com> wrote in message <hogn1n$5pt$1(a)fred.mathworks.com>...
> Given 'x' and 'y' data below, does anyone know how to connect the points without any lines crossing over, in other words create a single area? Polyarea often creates shapes with lines that cross-over each other.
>
> x=[ 1.4459
> 4.2018
> 0.7925
> 0.1146
> 2.9969
> 3.2423
> 1.4459]
>
> y=[ 2.4448
> 4.9663
> 2.5656
> 1.9146
> 2.7304
> 0.3700
> 2.4448]

It is impossible to solve, since only you know how
those points are connected. There are multiple solutions
for polygons that do not self intersect here, so any of
those polygons will be valid in theory.

John
From: Bruno Luong on
"John D'Errico" <woodchips(a)rochester.rr.com> wrote in message <hogntr$hok$1(a)fred.mathworks.com>...

>
> It is impossible to solve, since only you know how
> those points are connected. There are multiple solutions
> for polygons that do not self intersect here, so any of
> those polygons will be valid in theory.
>

And I would add there is always at least one solution for any configuration of points. For example the one given by traveling saleman problem.

Bruno
From: pipa on
Not sure but I think u can use convex hull to see if that is what u were looking for.
Look into the documentation for help on convex hull.
From: Walter Roberson on
John D'Errico wrote:
> "patrick hull" <pabaholic.nospam(a)yahoo.com> wrote in message
> <hogn1n$5pt$1(a)fred.mathworks.com>...
>> Given 'x' and 'y' data below, does anyone know how to connect the
>> points without any lines crossing over, in other words create a single
>> area? Polyarea often creates shapes with lines that cross-over each
>> other.
>>
>> x=[ 1.4459
>> 4.2018
>> 0.7925
>> 0.1146
>> 2.9969
>> 3.2423
>> 1.4459]
>>
>> y=[ 2.4448
>> 4.9663
>> 2.5656
>> 1.9146
>> 2.7304
>> 0.3700
>> 2.4448]

> It is impossible to solve, since only you know how
> those points are connected.

I _speculate_ that the points are joined in the order specified, possibly with
closure back to the first point. And I _speculate_ that the original poster
wants the outline of the union of the areas. For example, the pentagram,

[x,y] = pol2cart(2*pi/5 .* [0 2 4 1 3 0], ones(1,6));
plot(x,y)

to be converted to the 10-sided concave polygon formed by the five triangles.

I would further _speculate_ that the original poster does not wish any "holes"
in the resulting polygon.

If it were an unordered list of points, then there would generally be multiple
solutions; I do not know if there is a single solution (down to the starting
point and travel direction) under the assumption that the list of points is
ordered,
 |  Next  |  Last
Pages: 1 2 3
Prev: need Source Code
Next: connection between Gui's