RE: Re: Closed Polygons from List
- To: mathgroup at smc.vnet.net
- Subject: [mg33955] RE: [mg33916] Re: Closed Polygons from List
- From: "DrBob" <majort at cox-internet.com>
- Date: Wed, 24 Apr 2002 01:22:21 -0400 (EDT)
- Reply-to: <drbob at bigfoot.com>
- Sender: owner-wri-mathgroup at wolfram.com
I'll just suggest Transpose[lst[[Append[hull,First[hull]]]]] in place of Transpose[Append[#,First[#]]&[lst[[#]] & /@ hull]] Bobby -----Original Message----- From: Jens-Peer Kuska [mailto:kuska at informatik.uni-leipzig.de] To: mathgroup at smc.vnet.net Subject: [mg33955] [mg33916] Re: Closed Polygons from List 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.