       Re: Non-Linear Graphics Scaling

• To: mathgroup at smc.vnet.net
• Subject: [mg86498] Re: Non-Linear Graphics Scaling
• From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
• Date: Wed, 12 Mar 2008 05:27:37 -0500 (EST)
• Organization: Uni Leipzig
• References: <fr7ona\$373\$1@smc.vnet.net>
• Reply-to: kuska at informatik.uni-leipzig.de

```Hi,

a Line[] is a Line[] and if you wish to make a nonlinear
transformed line you must subdivide the line in several points

DivideLine[Line[pnts_]] := Module[{in},
in = Drop[0.5*(Plus @@@  Transpose[{pnts, RotateLeft[pnts]}]), -1];
Line[Riffle[pnts, in]]
]
DivideLine[l_Line, n_Integer] := Nest[DivideLine, l, n]

and

Manipulate[
(Graphics[
Line[{{-1, -1}, {1, -1}, {1, 1}, {-1, 1}, {-1, -1}}]
] /. l_Line :> DivideLine[l, n] ) /.
Line[pnts_] :> Line[#/#.# & /@ pnts], {{n, 0}, 1, 8, 1}
]

Regards
Jens

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
>

```

• Prev by Date: Re: Non-Linear Graphics Scaling
• Next by Date: Re: Impedance Equation fit to Complex Data
• Previous by thread: Re: Non-Linear Graphics Scaling