Re: Closed Polygons from List
- To: mathgroup at smc.vnet.net
- Subject: [mg33916] Re: Closed Polygons from List
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Tue, 23 Apr 2002 07:13:28 -0400 (EDT)
- Organization: Universitaet Leipzig
- References: <a9of57$dd0$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
- Sender: owner-wri-mathgroup at wolfram.com
Hi,
1)
you *dont* whant to male a ListPlot[] you whant:
Needs["DiscreteMath`ComputationalGeometry`"]
hull=ConvexHull[l1];
PlanarGraphPlot[l1, hull]
2) You have to make aparametric curve from the convex
hull, find the parameter values where x[t]==0 and than
comput the new hull with the intersection points.
len = Length[hull];
hullcurve =
Interpolation[#, InterpolationOrder -> 1][t] & /@
MapIndexed[{Last[#2 - 1]/len, #1} &,
Transpose[Append[#, First[#]] &[l1[[#]] & /@ hull]], {2}]
newpnts = (hullcurve /. FindRoot[hullcurve[[1]] == 0, {t, #}]) & /@
{0.25,
0.85}
now draw the left and the right point set
left = Join[newpnts, Select[l1[[#]] & /@ hull, First[#] < 0 &]];
lhull = ConvexHull[left];
PlanarGraphPlot[left, lhull];
right = Join[newpnts, Select[l1[[#]] & /@ hull, First[#] > 0 &]];
rhull = ConvexHull[right];
PlanarGraphPlot[right, rhull];
Regards
Jens
Moranresearch at aol.com wrote:
>
> I have a set of 8 {x,y} point:
> l1={{-4,-10},{-4,0},{-0.5,-10},{-0.5,0},{0.5,-10.5},{0.5,-0.5},{4,-14},{4,-4}}
>
> I wish to :
> 1. make a listplot with JoinedPlot -> True such that no line segments cross
> to produce a single closed polygon.
> 2. make a listplot with JoinedPlot -> True such that no line segments cross
> to produce a two closed polygon by imposing the conditions to generate two
> sets x < 0 and x>0.
> I need this to be ageneral solution not just for l1 above.
> Thank you.