Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive

MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Scaling a part of a composite image

  • To: mathgroup at
  • Subject: [mg98748] Scaling a part of a composite image
  • From: Alexei Boulbitch <Alexei.Boulbitch at>
  • Date: Fri, 17 Apr 2009 04:31:13 -0400 (EDT)

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[[1]], pt2[[2]] - 0.2*r,
         pt2[[3]] - 0.2*r}, {pt2[[1]], pt2[[2]] + 0.3*r,
         pt2[[3]] + 0.2*r} }]}]];
  eq4 = x[0] == point[[1]];
      eq5 = y[0] == point[[2]];
                eq6 = z[0] == point[[3]];
  s = NDSolve[{eq1, eq2, eq3, eq4, eq5, eq6}, {x, y, z}, {t, 0,
           p0 = ParametricPlot3D[
    Evaluate[{x[t], y[t], z[t]} /. s], {t, 0, 30}, PlotRange -> All,
    PlotStyle -> col, AxesLabel -> {"x", "y", "z"}];
    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

Alexei Boulbitch, Dr., habil.
Senior Scientist

ZAE Weiergewan
11, rue Edmond Reuter
L-5326 Contern

Phone: +352 2454 2566
Fax:   +352 2454 3566


This e-mail may contain trade secrets or privileged, undisclosed or otherwise confidential information. If you are not the intended recipient and have received this e-mail in error, you are hereby notified that any review, copying or distribution of it is strictly prohibited. Please inform us immediately and destroy the original transmittal from your system. Thank you for your co-operation.

  • Prev by Date: Re: Re: Any way to make help browser remember the last position?
  • Next by Date: Re: Re: Should I be using Mathematica at all?
  • Previous by thread: Re: Been doing real-time measurements with Mathematica! (Wii Balance
  • Next by thread: Re: Scaling a part of a composite image