MathGroup Archive 2009

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

Search the Archive

Re: Plotting surface with thickness

  • To: mathgroup at smc.vnet.net
  • Subject: [mg100993] Re: Plotting surface with thickness
  • From: ADL <alberto.dilullo at tiscali.it>
  • Date: Fri, 19 Jun 2009 20:47:46 -0400 (EDT)
  • References: <h1cv87$jet$1@smc.vnet.net>

Bill, this is a way in which your type of result can be achieve with
Mathematica 7.0.
I think it should work also in version 6.


ClearAll[fronty];
fronty[yv_] := Module[{l1, l2},
   {l1, l2} = Cases[gy[yv], Line[x_] -> x, Infinity];
   Graphics3D[Polygon[Insert[#, yv, 2] & /@ (Join[l1, Reverse[l2]])]]
   ];

ClearAll[frontx];
frontx[xv_] := Module[{l1, l2},
   {l1, l2} = Cases[gx[xv], Line[x_] -> x, Infinity];
   Graphics3D[Polygon[Insert[#, xv, 1] & /@ (Join[l1, Reverse[l2]])]]
   ];

top = Plot3D[Sin[x y], {x, -1, 1}, {y, -1, 1}];
bottom = Plot3D[Sin[x y] - 0.5, {x, -1, 1}, {y, -1, 1}];
g3D = Plot3D[{Sin[x y], Sin[x y] - 0.5}, {x, -1, 1}, {y, -1, 1}];

gy[-1] = Plot[{Sin[x y], Sin[x y] - 0.5} /. y -> -1 // Evaluate, {x,
-1, 1}];
gy[1] = Plot[{Sin[x y], Sin[x y] - 0.5} /. y -> 1 // Evaluate, {x, -1,
1}];
gx[-1] = Plot[{Sin[x y], Sin[x y] - 0.5} /. x -> -1 // Evaluate, {y,
-1, 1}];
gx[1] = Plot[{Sin[x y], Sin[x y] - 0.5} /. x -> 1 // Evaluate, {y, -1,
1}];

Show[g3D, fronty[-1], fronty[1], frontx[-1], frontx[1]]

The last command produces walls on all the sides of the floor and
ceiling surfaces.

ADL


On Jun 18, 10:52 am, Bill <WDWNORW... at aol.com> wrote:
> Plotting surface with thickness
>
> Hi:
>
> Using the following code with Mathematica 5.2 works without any problem.
> Using it with Mathematica 6.0.1 doesn't work.
>
> top = Plot3D[Sin[x y], {x, -1, 1}, {y, -1, 1}]
> bottom = Plot3D[Sin[x y] - 0.5, {x, -1, 1}, {y, -1, 1}]
> g = Plot[{Sin[x y], Sin[x y] - 0.5} /. y -> -1 // Evaluate, {x, -1, 1}]
>
> (* Mathematica 5.2 works with the following line, Mathematica 6.0.1 does =
not. *)
>
> front = Graphics3D[
>   Polygon[Insert[#, -1, 2] & /@
>     Join[g[[1, 1, 1, 1, 1]], Reverse[g[[1, 2, 1, 1, 1]]]]]]
>
> Question: How can the code (front) be modified to run in Mathematica 6.0.=
1?
>
> Thanks,
>
> Bill
>
> Ref:  http://forums.wolfram.com/student-support/topics/7384


  • Prev by Date: Re: SphericalHarmonics strange behavior
  • Next by Date: Re: Solving Polynomial equation
  • Previous by thread: Re: Plotting surface with thickness
  • Next by thread: Re: Plotting surface with thickness