Re: Conditional Plots

• To: mathgroup at smc.vnet.net
• Subject: [mg50487] Re: Conditional Plots
• From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
• Date: Tue, 7 Sep 2004 05:43:48 -0400 (EDT)
• Organization: Universitaet Leipzig
• References: <chblrt\$rme\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Hi,

something like

Clear[BlendSplit]
BlendSplit[{{p1_, f1_}, {_, f2_}}, _] /; Sign[f1] == Sign[f2] := {p1,
f1}

If[\$VersionNumber < 5.0,
BlendSplit[{{p1_, f1_}, {p2_, f2_}}, blend_] :=

Module[{func, t, sol, crossp},
func = blend @@ (p1*(1 - t) + p2*t);
sol = t /. FindRoot[Evaluate[func], {t, {0, 1}}];
crossp = p1*(1 - sol) + p2*sol;
Sequence @@ {{p1, f1}, {crossp, 0}, {p2, f2}}
],
(* Else *)

BlendSplit[{{p1_, f1_}, {p2_, f2_}}, blend_] :=

Module[{func, t, sol, crossp},
func = blend @@ (p1*(1 - t) + p2*t);
sol = First[t /. FindRoot[Evaluate[func], {t, {0, 1}}]];
crossp = p1*(1 - sol) + p2*sol;
Sequence @@ {{p1, f1}, {crossp, 0}, {p2, f2}}
]
]

BlendPoly[Polygon[pnts_], blend_] :=
Module[{feval, p1, p2, addp1, i, n},
feval = {#, blend @@ #} & /@ pnts;
feval =
BlendSplit[##, blend] & /@ Transpose[{feval, RotateLeft[feval]}];
If[And @@ (Last[#] > 0 & /@ feval),
Return[Polygon[pnts]],
];
p1 = First /@ Select[feval, Last[#] >= 0 &];
Polygon[p1]
]

gg = Graphics3D[
Plot3D[Sin[(x + y)*y], {x, -2Pi, 2Pi}, {y, -2Pi, 2Pi}, PlotPoints ->
60]];

Show[Graphics3D[
Cases[gg, _Polygon, Infinity] /.

p_Polygon :> BlendPoly[p, Function[{x, y, z},
- ( x^2 + y^2 - 4)]],
PlotRange -> All]
]

??

Regards
Jens

matt wrote:
>
> Dear all,
>
> Í´m trying to produce a 3D plot with a 2D ploygon (within unit circle)
> as its base. Equivalently, I want my 3D surface to sit inside (be
> bounded by) a cylinder with n-gon cross section.
>
> How can I trim off the edges?
>  I´ve tried to use
> If[ (condition), Plot, Blah] but it doesn´t seem to work.....

```

• Prev by Date: Re: making contents and index
• Next by Date: plot thousands(?) of trajectories in single graph.
• Previous by thread: Conditional Plots
• Next by thread: Re : definite and indefinite Integrate