Group Abstract Group Abstract

Message Boards Message Boards

Finding size of 3d Parametric Plot

Posted 11 years ago
POSTED BY: Shinji Ishida
3 Replies
Posted 11 years ago
POSTED BY: Jim Baldwin
Posted 11 years ago

I believe you'll need to find the minimums and maximums for each dimension and then calculate the range for each dimension to get the size of the box that would fit the object. (Unless you're asking for how to calculate the volume?) Also, the units are whatever units you want. If you want the height of the object to be a certain size, then you'll need to multiply each dimension by the ratio of the desired height to the current height. Below is a brute-force approach to getting the dimensions. Note that for one of the dimensions I needed to use FindMinimum rather than Minimize to get the appropriate minimum. You'll need to check to see if all of the other Minimums and Maximums converged properly.

a = 1.06;
b = 6;
c = 1.5;
d = 1;
e = 1.2;
tr = 0;
tmax = 50;

(* Find maximum and mininum for each dimension *)
(* 1st dimension *)
max1 = Maximize[{a^
     t (Cos[t] (1 + 
        c (Cos[e] Cos[\[Theta]] + d Sin[e] Sin[\[Theta]]))), -50 <= 
     t <= 0 && -\[Pi] <= \[Theta] <= \[Pi]}, {t, \[Theta]}]
min1 = FindMinimum[
  a^t (Cos[t] (1 + 
       c (Cos[e] Cos[\[Theta]] + 
          d Sin[e] Sin[\[Theta]]))), {t, -0.5}, {\[Theta], 1.5}]
(* 2nd dimension *)
max2 = Maximize[{a^
     t (Sin[t] (1 + 
        c (Cos[e] Cos[\[Theta]] + d Sin[e] Sin[\[Theta]]))), -50 <= 
     t <= 0 && -\[Pi] <= \[Theta] <= \[Pi]}, {t, \[Theta]}]
min2 = Minimize[{a^
     t (Sin[t] (1 + 
        c (Cos[e] Cos[\[Theta]] + d Sin[e] Sin[\[Theta]]))), -50 <= 
     t <= 0 && -\[Pi] <= \[Theta] <= \[Pi]}, {t, \[Theta]}]
(* 3rd dimension *)
max3 = Maximize[{a^
     t (b + c (Cos[\[Theta]] Sin[e] - d Cos[e] Sin[\[Theta]])), -50 <=
      t <= 0 && -\[Pi] <= \[Theta] <= \[Pi]}, {t, \[Theta]}]
min3 = Minimize[{a^
     t (b + c (Cos[\[Theta]] Sin[e] - d Cos[e] Sin[\[Theta]])), -50 <=
      t <= 0 && -\[Pi] <= \[Theta] <= \[Pi]}, {t, \[Theta]}]

(* Construct object *)
g = ParametricPlot3D[
   a^t {Cos[
       t] (1 + c (Cos[e] Cos[\[Theta]] + d Sin[e] Sin[\[Theta]])), 
     Sin[t] (1 + c (Cos[e] Cos[\[Theta]] + d Sin[e] Sin[\[Theta]])), 
     b + c (Cos[\[Theta]] Sin[e] - 
         d Cos[e] Sin[\[Theta]])}, {\[Theta], -Pi, Pi}, {t, -tmax, 0},
    PlotStyle -> 
    Directive[Opacity[0.5], Lighter[Yellow, .3], 
     Specularity[White, 10], Thickness[.1]], Axes -> True, 
   ViewPoint -> {2, 2, -6}, Boxed -> True, 
   PlotRange -> {{-3, 3}, {-3, 3}, {0, 7.5}}, ImageSize -> {400, 450},
    Mesh -> None, PlotPoints -> 400, 
   MaxRecursion -> ControlActive[0, Automatic], 
   RotationAction -> "Clip", SphericalRegion -> True];

(* Construct points where minimums and maximums occur *)
{max11, max12, 
  max13} = {max1[[1]], 
   a^t (Sin[
       t] (1 + c (Cos[e] Cos[\[Theta]] + d Sin[e] Sin[\[Theta]]))), 
   a^t (b + c (Cos[\[Theta]] Sin[e] - d Cos[e] Sin[\[Theta]]))} /. 
  max1[[2]]
{min11, min12, 
  min13} = {min1[[1]], 
   a^t (Sin[
       t] (1 + c (Cos[e] Cos[\[Theta]] + d Sin[e] Sin[\[Theta]]))), 
   a^t (b + c (Cos[\[Theta]] Sin[e] - d Cos[e] Sin[\[Theta]]))} /. 
  min1[[2]]
{max21, max22, 
  max23} = {a^
     t (Cos[t] (1 + 
        c (Cos[e] Cos[\[Theta]] + d Sin[e] Sin[\[Theta]]))), 
   max2[[1]], 
   a^t (b + c (Cos[\[Theta]] Sin[e] - d Cos[e] Sin[\[Theta]]))} /. 
  max2[[2]]
{min21, min22, 
  min23} = {a^
     t (Cos[t] (1 + 
        c (Cos[e] Cos[\[Theta]] + d Sin[e] Sin[\[Theta]]))), 
   min2[[1]], 
   a^t (b + c (Cos[\[Theta]] Sin[e] - d Cos[e] Sin[\[Theta]]))} /. 
  min2[[2]]
{max31, max32, 
  max33} = {a^
     t (Cos[t] (1 + 
        c (Cos[e] Cos[\[Theta]] + d Sin[e] Sin[\[Theta]]))), 
   a^t (Sin[
       t] (1 + c (Cos[e] Cos[\[Theta]] + d Sin[e] Sin[\[Theta]]))), 
   max3[[1]]} /. max3[[2]]
{min31, min32, 
  min33} = {a^
     t (Cos[t] (1 + 
        c (Cos[e] Cos[\[Theta]] + d Sin[e] Sin[\[Theta]]))), 
   a^t (Sin[
       t] (1 + c (Cos[e] Cos[\[Theta]] + d Sin[e] Sin[\[Theta]]))), 
   min3[[1]]} /. min3[[2]]

(* Graph object and maximum and minimum points *)
p = Graphics3D[{PointSize[0.05], 
    Point[{{max11, max12, max13}, {min11, min12, min13}, {max21, 
       max22, max23}, {min21, min22, min23}, {max31, max32, 
       max33}, {min31, min32, min33}}]}];
Show[{g, p}]

(* Object dimensions *)
{max1[[1]] - min1[[1]], max2[[1]] - min2[[1]], max3[[1]] - min3[[1]]}
POSTED BY: Jim Baldwin
Posted 11 years ago

Thanks a bunch for all the help! The step by step will be very useful for getting sizes of shells of different parameters

POSTED BY: Shinji Ishida
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard