
Cross-sections
By: a guest on
Sep 28th, 2012 | syntax:
None | size: 0.69 KB | hits: 30 | expires: Never
ptsph[\[Theta]_, \[Phi]_] := {Sin[\[Theta]] Sin[\[Phi]],
Cos[\[Theta]] Sin[\[Phi]], Cos[\[Phi]]}
points = {ptsph[-0.2, \[Pi]/2 + 0.01], ptsph[0.2, \[Pi]/2 - 0.01],
ptsph[\[Pi] - 0.2, \[Pi]/2 + 0.01],
ptsph[\[Pi] + 0.2, \[Pi]/2 - 0.01]};
slice[z_, {pt1_, pt2_}] :=
If[# == {}, Null, \[Lambda] pt1 + (1 - \[Lambda]) pt2 /. #[[1]]] &[
Quiet[Solve[\[Lambda] pt1[[3]] + (1 - \[Lambda]) pt2[[3]] == z &&
0 <= \[Lambda] <= 1, \[Lambda]]]]
slice[z_] :=
Polygon[DeleteCases[slice[z, #] & /@ Subsets[points, {2}],
Null][[{1, 2, 4, 3}]]]
Manipulate[
Graphics3D[{{Red, slice[z]}, {Opacity[0.5], Sphere[],
tetrahedron}}], {z, Cos[\[Pi]/2 + 0.01], Cos[\[Pi]/2 - 0.01]}]