Re: Concentric contours about the centroid, having the same length, and interior to an initial contour.

*To*: mathgroup at smc.vnet.net*Subject*: [mg43990] Re: Concentric contours about the centroid, having the same length, and interior to an initial contour.*From*: Bill Rowe <readnewscix at mail.earthlink.net>*Date*: Thu, 16 Oct 2003 04:17:09 -0400 (EDT)*Sender*: owner-wri-mathgroup at wolfram.com

On 10/15/03 at 4:59 AM, gilmar.rodriguez at nwfwmd.state.fl.us (Gilmar Rodr?guez Pierluissi) wrote: > I have a basic contour defined by: <snip contour> > The centroid of the contour is given by: > In[4]: > centroid = N[Plus @@ contour/Length[contour]] Note, this is the mean of the x,y coordinates and may not be what you want. > How can I generate (say) five contours, so that: > (1.) Each contour (set) have the same length as the original contour > (in this case, each contour should contain 375 {x,y} points). > (2.) Each contour is equidistant, and concentric (with respect to > the centroid) to the previous contour. > (3.) The five contours are inside the original contour defined above? The following function will do what you want remap[x_List, org_List, s_] := Module[{r = Abs[Complex @@ (x - org)], theta = Arg[Complex @@ (x - org)]}, r s{Cos@theta, Sin@theta} + org] A new set of contours can be computed as remap[#, origin, scale]&/@contour What this does is convert the list of coordiantes to polar coordinates with origin as specified, rescales the radial component of these coordinates by s then converts them back to {x,y} coordinates refenced to the orign of the original data set. An alternative, might be to subtract a fixed amount from the radial component before converting back to the original coordinate system. But this would require some error checking to ensure the amount subtracted is not greater than the radial component. -- To reply via email subtract one hundred and nine