Re: Scaling a part of a composite image

• To: mathgroup at smc.vnet.net
• Subject: [mg98843] Re: Scaling a part of a composite image
• From: dh <dh at metrohm.com>
• Date: Mon, 20 Apr 2009 05:41:04 -0400 (EDT)
• References: <gs9eo8\$n10\$1@smc.vnet.net>

```
Hi Alexei,

to specify your arrow, you may use a mix of coordinates and scaled

coordinates like e.g.:

Polygon[{pt1, Scaled[10^-2 {0, -2, -2}, pt2],

Scaled[10^-2 {0, 3, 2}, pt2]}]

Daniel

Alexei Boulbitch wrote:

> Dear community,

>

> In an image composed of at least two (or more) parts combined using

> Show, I would like to programmatically scale one of these two images

> with respect to the size of the whole composite image.

> Do you know, how to do this in Mathematica 6?

>

> Is it possible in Mathematica 6 to determine programmatically the total size of the Image?

>

> To be more concrete: the function below draws a 3D trajectory - a

> solution of a system of three ODE. In addition it draws a triangle

> attached to the trajectory. The latter plays the role of an arrow head

> showing the direction of the trajectory. Parameters in the argument

> are:  point is a list of initial values {x0,y0,z0} of the trajectory,

> tmax is the calculation time, col is the color of both the trajectory

> and the arrow head, arrpos is the time fixing the position of the arrow

> on the trajectory, and arrsize scales the arrow size. The subfunction

> arr defines the arrow using 2 closely-lying points taken on the trajectory.

>

> directedTrajectory3D[point_List, tmax_, col_, arrpos_, arrsize_] :=

>  Module[{p0, eq4, eq5, eq6, pt1, pt2, s},

>   arr[pt1_List, pt2_List] := Module[{r},

>     r = (pt1 - pt2)2 /. List -> Plus // Sqrt;

>     Graphics3D[ {col,

>       Polygon[{pt1, {pt2[], pt2[] - 0.2*r,

>          pt2[] - 0.2*r}, {pt2[], pt2[] + 0.3*r,

>          pt2[] + 0.2*r} }]}]];

>

>   eq4 = x == point[];

>       eq5 = y == point[];

>                 eq6 = z == point[];

>   s = NDSolve[{eq1, eq2, eq3, eq4, eq5, eq6}, {x, y, z}, {t, 0,

>      tmax}];

>            p0 = ParametricPlot3D[

>     Evaluate[{x[t], y[t], z[t]} /. s], {t, 0, 30}, PlotRange -> All,

>     PlotStyle -> col, AxesLabel -> {"x", "y", "z"}];

>

>   Show[{p0,

>     arr[Evaluate[{x[arrpos], y[arrpos], z[arrpos]} /. s] // Flatten,

>      Evaluate[{x[arrpos - 0.5*arrsize], y[arrpos - 0.5*arrsize],

>          z[arrpos - 0.5*arrsize]}] /. s // Flatten]}]

>   ];

>

> One can try with the example of Lorentz system from help:

>

> Clear[eq1, eq2, eq3];

> eq1 =

> \!\(\*SuperscriptBox["x", "\[Prime]",

> MultilineFunction->None]\)[t] == -3 (x[t] - y[t]);

> eq2 =

> \!\(\*SuperscriptBox["y", "\[Prime]",

> MultilineFunction->None]\)[t] == -x[t] z[t] + 26.5 x[t] - y[t];

> eq3 =

> \!\(\*SuperscriptBox["z", "\[Prime]",

> MultilineFunction->None]\)[t] == x[t] y[t] - z[t];

>

> directedTrajectory3D[{1, 0, 1}, 30, Red, 5, 0.1]

>

>

> A strong drawback is that in this function one needs to rescale the

> arrow sizes by hand each time. Compare two images with the same

> trajectory in which the arrow is placed the first time at t=5 and then

> at t=15 with the same arrsize=0.1.

>

> directedTrajectory3D[{1, 0, 1}, 30, Red, 5, 0.1]

> directedTrajectory3D[{1, 0, 1}, 30, Red, 15, 0.1]

>

> I would like to find a programmatic way of scaling the arrows so that

> they would be always visible and the same size.

>

> Thank you, Alexei

>

```

• Prev by Date: Re: running mathematica notebooks without interface
• Next by Date: recognition typesetted mathematical text?
• Previous by thread: Scaling a part of a composite image
• Next by thread: Looking for a scrolling list control, or how to create/simulate one??
{"ft_lang_label":"__label__en","ft_lang_prob":0.6499903,"math_prob":0.9876508,"size":3270,"snap":"2021-43-2021-49","text_gpt3_token_len":1127,"char_repetition_ratio":0.11053276,"word_repetition_ratio":0.038327526,"special_character_ratio":0.39510703,"punctuation_ratio":0.2230014,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.99389654,"pos_list":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14],"im_url_duplicate_count":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-10-18T12:51:38Z\",\"WARC-Record-ID\":\"<urn:uuid:00967ec1-8636-4644-ad75-f6e5c96c897e>\",\"Content-Length\":\"47537\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:99821b54-84fc-478c-a4e8-6e93d42b708c>\",\"WARC-Concurrent-To\":\"<urn:uuid:91fea39f-e5d4-4ac0-9283-9bbdc2a38f40>\",\"WARC-IP-Address\":\"140.177.205.73\",\"WARC-Target-URI\":\"http://forums.wolfram.com/mathgroup/archive/2009/Apr/msg00718.html\",\"WARC-Payload-Digest\":\"sha1:HNSNOQIBT77N7VM6AU5VOGSM2WI7HPEX\",\"WARC-Block-Digest\":\"sha1:WXRNJ6ILKNXWJBGD5LNOUZGBE6PTJIMT\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-43/CC-MAIN-2021-43_segments_1634323585203.61_warc_CC-MAIN-20211018124412-20211018154412-00552.warc.gz\"}"}