Guest User

Untitled

a guest
Oct 20th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.99 KB | None | 0 0
  1. SphereOpacity = 0.5;
  2. CuboidOpacity = 0.5;
  3. SphereColor = Blue;
  4. CuboidColor = Orange;
  5. Graphics3D[{SphereColor, Opacity[SphereOpacity], Sphere[{0, 0, 0.5}, 0.5],
  6. CuboidColor, Opacity[CuboidOpacity], Cuboid[{-5, -5, 0}, {5, 5, 0.5}]},
  7. Boxed -> False
  8. ]
  9.  
  10. ParametricPlot3D[{Cos[u] Sin[v], Sin[u] Sin[v], Cos[v]},
  11. {u, 0, π}, {v, 0, π},
  12. Mesh -> None,
  13. Boxed -> False,
  14. Axes -> None
  15. ]
  16.  
  17. r = 0.5;
  18. d = {0, 0, 0.5}
  19. sphere = ParametricPlot3D[r {Cos[u] Sin[v], Sin[u] Sin[v], Cos[v]} + d,
  20. {u, -π/2, π/2}, {v, -π/2, π/2},
  21. Mesh -> None, Boxed -> False, Axes -> None][[1]];
  22.  
  23. SphereOpacity = 0.5;
  24. CuboidOpacity = 0.5;
  25. SphereColor = Blue;
  26. CuboidColor = Orange;
  27. Graphics3D[{SphereColor, Opacity[SphereOpacity], sphere, CuboidColor,
  28. Opacity[CuboidOpacity], Cuboid[{-5, -5, 0}, {5, 5, 0.5}]},
  29. Boxed -> False]
  30.  
  31. With[{r = 1},
  32. Graphics3D[{EdgeForm[],
  33. BSplineSurface[Outer[Append[First[#1] #2, Last[#1]] &,
  34. r {{0, 1}, {1, 1}, {1, 0}},
  35. {{1, 0}, {1, 1}, {-1, 1}, {-1, 0}, {-1, -1}, {1, -1}, {1, 0}}, 1],
  36. SplineClosed -> {False, True}, SplineDegree -> 2,
  37. SplineKnots -> {{0, 0, 0, 1, 1, 1},
  38. {0, 0, 0, 1/4, 1/2, 1/2, 3/4, 1, 1, 1}},
  39. SplineWeights -> Outer[Times, {1, 1/Sqrt[2], 1},
  40. {1, 1/2, 1/2, 1, 1/2, 1/2, 1}]]},
  41. BaseStyle -> {BSplineSurface3DBoxOptions ->
  42. {Method -> {"SplinePoints" -> 40}}}, Boxed -> False]]
  43.  
  44. With[{r = 1},
  45. Graphics3D[{EdgeForm[],
  46. BSplineSurface[Outer[Insert[First[#1] #2, Last[#1], 2] &,
  47. r {{0, -1}, {1, -1}, {1, 1}, {0, 1}},
  48. {{-1, 0}, {-1, 1}, {1, 1}, {1, 0}}, 1],
  49. SplineDegree -> 2,
  50. SplineKnots -> {{0, 0, 0, 1/2, 1, 1, 1},
  51. {0, 0, 0, 1/2, 1, 1, 1}},
  52. SplineWeights -> Outer[Times, {1, 1/2, 1/2, 1},
  53. {1, 1/2, 1/2, 1}]]},
  54. BaseStyle -> {BSplineSurface3DBoxOptions ->
  55. {Method -> {"SplinePoints" -> 40}}}, Boxed -> False]]
  56.  
  57. Graphics3D[{CapForm["Round"], Tube[{{0, 0, 0}, {0, 0, 0}}, {0, 1}]}, Boxed -> False]
  58.  
  59. With[{r = 1, ε = $MachineEpsilon},
  60. Graphics3D[{CapForm["Round"], Tube[{{0, 0, 0}, {0, 0, ε r}}, {0, r}]},
  61. Boxed -> False]]
  62.  
  63. RegionPlot3D[
  64. x^2 + y^2 + z^2 <= 1
  65. &&
  66. z >= 0 ||
  67. (-5 < x < 5) && (-5 < y < 5) && (-0.5 < z < 0),
  68. {x, -2, 2}, {y, -2, 2}, {z, -2, 2},
  69. Mesh -> None,
  70. PlotPoints -> 120,
  71. PlotStyle -> Directive[Orange, Specularity[Yellow, 12], Opacity[0.8]],
  72. Boxed -> False,
  73. Lighting -> {{"Directional", White, {{5, 5, 4}, {2, 2, 0}}}},
  74. BoundaryStyle -> None,
  75. ImageSize -> 600,
  76. Axes -> False]
  77.  
  78. hemisphere =
  79. First@RevolutionPlot3D[Sqrt[1 - r^2], {r, 0, 1}, Mesh -> None];
  80.  
  81. plant = First@ExampleData[{"Geometry3D", "PottedPlant"}];
  82.  
  83. Graphics3D[{
  84. Translate[
  85. Scale[Rotate[
  86. {Brown,
  87. hemisphere},
  88. {{0, 0, -1}, {0, 0, 1}}], 25],
  89. {0, 0, 28}],
  90. {Darker[Green], plant}
  91. },
  92. Lighting -> "Neutral",
  93. Boxed -> False]
  94.  
  95. data3D = With[{reso = .05},
  96. Table[Boole[x^2 + y^2 + z^2 <= 1
  97. &&
  98. z >= 0 || (-5 < x < 5) && (-5 < y < 5) && (-0.5 < z <
  99. 0)], {x, -2, 2, reso}, {y, -2, 2, reso}, {z, -2, 2, reso}]
  100. ];
  101.  
  102. Image3D[data3D]
  103.  
  104. α = 0;
  105. θ = 0;
  106.  
  107. normal = Cross[{Cos[θ], Sin[θ], 0}, {Cos[α] (-Sin[θ]), Cos[α] Cos[θ], Sin[α]}];
  108.  
  109. ContourPlot3D[x^2 + y^2 + z^2, {x, -1, 1}, {y, -1, 1}, {z, -1, 1},
  110. Contours -> {1}, ContourStyle -> Opacity[0.5], Mesh -> None,
  111. RegionFunction -> Function[{x, y, z}, normal.{x, y, z} >= 0]]
Add Comment
Please, Sign In to add comment