iomikron

seashells_draft

Jul 8th, 2012
334
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.03 KB | None | 0 0
  1. l[{n_}, theta_] :=
  2. (2*Pi/n) ((n*theta/(2*Pi)) - IntegerPart[n*theta/(2*Pi)]);
  3. k[{a_, b_, ll_, p_, w1_, w2_, n_}, s_, theta_] :=
  4. If[w1 == 0 || w2 == 0 || n == 0,
  5. 0,
  6. ll*Exp[-(2*(s - p)/w1)^2 - (2*l[{n}, theta]/w2)^2]
  7. ];
  8. h[{a_, b_, ll_, p_, w1_, w2_, n_}, s_, theta_] :=
  9. (1/(Sqrt[(Cos[s]/a)^2 + (Sin[s]/b)^2]))
  10. +k[{a, b, ll, p, w1, w2, n}, s, theta];
  11.  
  12. (*cartesian coordinates*)
  13. x[{d_, aa_, beta_, phi_, omega_, mu_, alpha_, a_, b_, ll_, p_, w1_,
  14. w2_, n_}, theta_, s_] :=
  15. d*(aa*Sin[beta]*Cos[theta]
  16. + h[{a, b, ll, p, w1, w2, n}, s,
  17. theta]*(Cos[s + phi]*Cos[theta + omega] -
  18. Sin[mu]*Sin[s + phi]*Sin[theta + omega]))*
  19. Exp[theta*Cot[alpha]];
  20. y[{aa_, beta_, phi_, omega_, mu_, alpha_, a_, b_, ll_, p_, w1_, w2_,
  21. n_}, theta_, s_] :=
  22. (-aa*Sin[beta]*Sin[theta] -
  23. h[{a, b, ll, p, w1, w2, n}, s,
  24. theta]*(Cos[s + phi]*Sin[theta + omega] +
  25. Sin[mu]*Sin[s + phi]*Cos[theta + omega]))*
  26. Exp[theta*Cot[alpha]];
  27. z[{aa_, beta_, phi_, mu_, alpha_, a_, b_, ll_, p_, w1_, w2_, n_},
  28. theta_, s_] :=
  29. (-aa*Cos[beta] +
  30. h[{a, b, ll, p, w1, w2, n}, s, theta]*Sin[s + phi]*Cos[mu])*
  31. Exp[theta*Cot[alpha]];
  32.  
  33. (*sample*)
  34. With[{d = 1, aa = 90, beta = 10 Degree, phi = 45 Degree,
  35. omega = 1 Degree, mu = 5 Degree, alpha = 86 Degree, a = 20, b = 20,
  36. ll = 14, p = 0, w1 = 180, w2 = .4, n = 180},
  37. ParametricPlot3D[{x[{d, aa, beta, phi, omega, mu, alpha, a, b, ll, p,
  38. w1, w2, n}, theta, s],
  39. y[{aa, beta, phi, omega, mu, alpha, a, b, ll, p, w1, w2, n}, theta,
  40. s],
  41. z[{aa, beta, phi, mu, alpha, a, b, ll, p, w1, w2, n}, theta, s]},
  42. {theta, -10*Pi, 10*Pi},
  43. {s, -270 Degree, 90 Degree},
  44. PlotRange -> All, PlotPoints -> 50, Mesh -> False, Boxed -> False,
  45. Axes -> False,
  46. PlotStyle -> {Darker[Orange, 0.1], Specularity[White, 20]},
  47. Background -> GrayLevel[0.5],
  48. SphericalRegion -> True,
  49. ViewPoint ->
  50. RotationTransform[-3 Pi/4, {0, 2, 1}][{3 Cos[-3 Pi/4/7] + 2,
  51. Cos[3 - 3 Pi/4], 5 + 2 Sin[-3 Pi/4 7]}]]
  52. ]
Advertisement
Add Comment
Please, Sign In to add comment