Re: Non-Linear Graphics Scaling
- To: mathgroup at smc.vnet.net
- Subject: [mg86507] Re: Non-Linear Graphics Scaling
- From: dh <dh at metrohm.ch>
- Date: Wed, 12 Mar 2008 05:29:19 -0500 (EST)
- References: <fr7ona$373$1@smc.vnet.net>
Hi Januk, a non-linear function will map lines to curves. Therefore, you e.g. may replace every line by many lines, approximating the curve. E.g.: graphics /. Line[{{x01_,y01_},{x02_,y02_}}]:>(calculate x1..n,y1..n;Line[{{x1,y1},..,{xn,yn}}] If you have more complicated graphics you must also deal with the case: Line[{pt1,pt2,..ptn}]. Finally you could extend this scheme to geometric shapes like Circle e.t.c hope this helps, Daniel Januk wrote: > Is there a way to have mathematica display a graphic using a non- > linear scaling function? I want to scale any point on a 2D graphic by > some non-linear function of the distance away from the origin. For a > list of points, it is trivial to force the issue: > > pl3 = Graphics[{Point[ > RandomReal[{-20, 20}, {1000, 2}] > ] > }, Frame -> True, PlotRange -> All]; > GraphicsRow@{pl3, > pl3 /. (xy : {x_?NumericQ, y_?NumericQ} :> > Module[{r, \[Theta]}, > r = If[Norm[xy] == 0., 0, Log[1+Norm[xy]]]; > \[Theta] = If[Norm[xy] == 0., 0, ArcTan @@ xy]; > r {Cos[\[Theta]], Sin[\[Theta]]} > ] > )} > > Is there a way to do this for more complecated graphics (e.g. graphics > with primitives)? For example: > > pl2 = Graphics[{ > Red, Point[RandomReal[{-2,2},{100,2}]], > Orange, Line[{{-2, .75}, {2, .75}}], > Green, Thick , Circle[{0, 0}, 2], > Black, Point[{0, 0}] > }] > > So far the technique of using a ReplaceAll simply transforms the end > points of the line, not the line shape. > > Any thoughts of how to do this for an arbitrary Cartesian 2D graphic > would be much appreciated. > > Thanks, > Januk >