Frühere | Chronologischer Index | Spätere | ||
Vorherige | Thematischer Index | Nächste |
Hallo Leonardo,hier ist Code, der die durch die Millerschen Indizes gegebene Ebene in das dreidimensionale Gitter einzeichnet und die Parallelprojektion auf diese Ebene darstellt. Für die Millerschen Indizes können auch nichtganze Zahlen verwendet werden. Man kann zwischen den drei kubischen Gittern wählen.
Remove[drawIt, millerPlane] (* millerPlane - the projection plane *) millerPlane[mI_List?VectorQ] := Block[{\[Xi] = 2}, Translate[ Rotate[Polygon[{{-\[Xi], -\[Xi], 0}, {\[Xi], -\[Xi], 0}, {\[Xi], \[Xi], 0}, {-\[Xi], \[Xi], 0}}], {{0, 0, 1}, mI}], mI/(mI.mI)] ] (* drawIt *) drawIt[lat_Integer, mI_List?VectorQ, mode_Integer] := Module[{latD, pom = N[IdentityMatrix[3] - Outer[Times, Normalize[mI], Normalize[mI]]], oS}, If[ mI[[1]] == 0 && mI[[2]] == 0 && mI[[3]] == 0, CreateDialog["Miller Indices all zero! Bye."]; Return[$Failed] ]; Switch[lat, 0, latD = LatticeData["SimpleCubic", "Image"][[1, All]], 1, latD = LatticeData["FaceCenteredCubic", "Image"][[1, All]], 2, latD = LatticeData["BodyCenteredCubic", "Image"][[1, All]], _, CreateDialog[ "Lattice " <> ToString[lat] <> " not implemented! Bye."] ]; Switch[mode, 0, Show[ Graphics3D[{latD, {Opacity[0.66], millerPlane[mI]}}, Axes -> True, AxesLabel -> {"X", "Y", "Z"}]], 1, oS = latD /. Sphere[l_List, pS_Number] -> {PointSize[pS], Point[l]}; Show[Graphics3D[GeometricTransformation[oS, pom] (* //. {{x1_, x2_, x3_} -> {x2, x3}, Sphere -> Circle} *) , Axes -> True, AxesLabel -> {"X", "Y", "Z"}]], _, Text["Mode " <> ToString[mode] <> " not implemented!"] ] ] Manipulate[ hint = 0; (* 3D state *) state = lat = hint; h = 1; k = l = 0; Dynamic[drawIt[lat, {h, k, l}, state]], Column[{ Row[{Text[Style["Miller Indices", Bold, FontSize -> 12]]}], Row[{Panel[InputField[Dynamic[h], Number, FieldSize -> {5, 1}], "h", Left, FrameMargins -> 1], Panel[InputField[Dynamic[k], Number, FieldSize -> {5, 1}], "k", Left, FrameMargins -> 1], Panel[InputField[Dynamic[l], Number, FieldSize -> {5, 1}], "l", Left, FrameMargins -> 1]}], Row[{Button["3D", state = 0], Button["Parallel", state = 1], Text[Style[" ", Bold, FontSize -> 12]], Button["SC", lat = 0], Button["FCC", lat = 1], Button["BCC", lat = 2], Text[Style[" ", Bold, FontSize -> 12]], Button["Credits", CreateDialog[ "Cubic Lattice Projections\nVersion 0.0.1 - October 2009\n© uk \ on demand by Leonardo Agudo"]] }] }] ] Gruss Udo.
<<attachment: agudoProjection.nb>>
Frühere | Chronologischer Index | Spätere | ||
Vorherige | Thematischer Index | Nächste |
DMUG-Archiv, http://www.mathematica.ch/archiv.html