RE: Equation of a "potato"
- To: mathgroup at smc.vnet.net
- Subject: [mg24676] RE: [mg24416] Equation of a "potato"
- From: Wolf Hartmut <hwolf at debis.com>
- Date: Fri, 4 Aug 2000 01:19:01 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
> -----Original Message----- > From: Kevin J. McCann [SMTP:Kevin.McCann at jhuapl.edu] To: mathgroup at smc.vnet.net > Sent: Tuesday, July 18, 2000 6:58 AM > To: mathgroup at smc.vnet.net > Subject: [mg24416] Equation of a "potato" > > I am doing some illustrations for class notes on vector calculus. I > would be nice to have some drawings for a "random" 3d shape, i.e. > something that is fairly rounded and regular like a potato, but not as > simple as a sphere. Any ideas for the an equation that would draw > something like this? > [Hartmut Wolf] Dear Kevin, the question is: how much of potato must it be? Thinking of a computational model of a grown-up potato seems to be rather complicated; perhaps it may useful to look into Benoit B. Mandelbrot's book "Fractal Geometry of Nature". So part of the geometry of a potato may be fractal, but part of it appears smooth. Here I'll give you just a less ambitious, primitive means to generate random objects which might be considered as looking like potatoes (randomly harvested). As for an equation, they are specified implicitly as F[x,y,z] == const So if you only search for an illustration ContourPlot3D will give you that. << Graphics`ContourPlot3D` The idea is simple: we just compose objects that may be ellipsoids (which alone however are too regular for a potato). We need several random generators: cRan := (-1)^Random[Integer, {0, 1}]Log[1 - Random[Real, {0, 1}]] this gives a random coordinate (near the origin) << Statistics`ContinuousDistributions` ndis = GammaDistribution[5, 1]; (The Ceiling of) this will give a random number of primitive components (about 5 here). sdis = ExponentialDistribution[0.25]; This will give us the relative "size" of the components: larger and smaller ones. excdis = BetaDistribution[3, 2]; And this will give us (conservative) random ellipsoidal deformations of the primitives. To be reproducible we SeedRandom[Prime[1000000]] Now we do: n = Ceiling[First[RandomArray[ndis, 1]]] (* no of primitives *) pts = Table[{cRan, cRan, cRan}, {n}] (* centers of primitives *) str = RandomArray[sdis, n] (* "strengths" of primintives *) exc = Table[RandomArray[excdis, 3], {n}] (* deformations of primitives *) Now the function for the potato is potato = Plus @@ (1/(str Plus @@@ ((({x, y, z} - #)^2 &) /@ pts exc))); We may look at the behaviour along a line Plot[With[{y = 0.2, z = 0.3}, Evaluate[potato]], {x, -n, n}, PlotRange -> All] so we can see where we may place the contour. (N.B. these are the components Plot[Evaluate[With[{y = 0.2, z = 0.3}, Evaluate[List @@ potato]], {x, -n, n}, PlotRange -> All]] ). Now look at the potato: ContourPlot3D[ potato, {x, -(n + 1), n + 1}, {y, -(n + 1), n + 1}, {z, -(n + 1), n + 2}, PlotPoints -> {7, 3}, MaxRecursion -> 2, Contours -> {0.2}] // Timing {52.966 Second, Graphics3D[]} You may also use {0.15} or {0.25} for Contours (If the value is too great, the potato will go to pieces). The bounds given here are ad hoc, and certainly not senseful for n very different from 5. You may collect these steps to a procedure, and then repeat to get as much potato as you like. Also play with the parameters of the "theory". Kind regards, Hartmut Wolf