| New in Wolfram Mathematica 6: Symbolic Interface Construction | ◄ previous | next ► |
Construct Arbitrarily Sophisticated Palettes
With an unprecedentedly high functionality-to-code ratio, Mathematica 6 allows you to create arbitrarily sophisticated palettes, here for performing operations on 3D objects.
In[1]:= | CreatePalette[Pane[Row[
Button[Style[First[#], 48, Darker[Magenta]],
NotebookWrite[InputNotebook[],
ToBoxes[ToExpression[NotebookRead[InputNotebook[]]] /.
{Polygon[x_] :>
With[{y = Last[#][x]}, Polygon[y] /; True]}], After];
SelectionMove[InputNotebook[], Previous, Graphics]
] & /@ {
{"\[FilledDiamond]", (# + RotateLeft[#])/2 &},
{"\[FivePointedStar]",
Module[{c = Mean[#], mids = (# + RotateLeft[#])/2},
mids = ((# + c)/2 &) /@ mids;
Flatten[Transpose[{#, mids}], 1]] &},
{"\[FilledSquare]",
Module[{c = Mean[#]}, ((# + c)/2) & /@ #] &}
}, " "], ImageMargins -> 10],
WindowTitle -> "Polygon Operations"]; |
![]() |


