AmatureQ: clipping graphics? Small .nb attached
- To: mathgroup at smc.vnet.net
- Subject: [mg22869] AmatureQ: clipping graphics? Small .nb attached
- From: "Steven T. Hatton" <hattons at cpkwebser5.ncr.disa.mil>
- Date: Sun, 2 Apr 2000 15:33:38 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Note: Please don't flame me if I did a no-no by attaching a notebook. I looked on the Mathematica site for pointers on how to send notebooks, and they suggested attachments to mail. If this is undesirable, I will discontinue this practice. The listing below generates a manifold of square parallel pipettes. I would like to know if there is a way to "clip the wings" on this thing. That is, can I restrict the range of the ParametricPlot3D so that the internal plane segments do not protrude from the surface of the largest square? I attempted to use notation such as, "/; j -size -1 <= x <= size + 1 -j, to restrict the range of evaluation on the chamber formula. I couldn't get it to work. If anybody has an answer to this specific question I would be grateful if you would share it. If you know of a more eloquent way of generating this whole thing, that would also be appreciated. Sorry if my Mathematica code looks like my little sister's preschool scribble. I am just an armchair mathematician. TIA, Steve Clear[x, size, ySize, layers, distort, \[Alpha], n, flip, dispUp, dispDown, \ foundation, sign, position, j, chamber, hive] size = 6; ySize = \[Pi] size; \[Alpha] = .2; n = 1; layers = 6; distort[n_, \[Theta]_, \[Alpha]_] := \[Alpha] Sin[n \[Theta]]; flip[x_] := 0 /; x < 0; flip[x_] := 1 /; x >= 0; dispUp[x_, n_, \[Theta]_, \[Alpha]_] = flip[x] distort[n, \[Theta], \[Alpha]]; unFlip[x_] := 1 /; x < 0; unFlip[x_] := 0 /; x >= 0; dispDown[x_, n_, \[Theta]_, \[Alpha]_] = unFlip[x] distort[n, \[Theta], \[Alpha]]; SetOptions[ParametricPlot3D, PlotPoints -> {11, 11}]; foundation[sign_, x_, n_, y_, \[Alpha]_, position_] := sign Abs[x] + dispUp[x, n, y, \[Alpha]] + dispDown[x, n, y, \[Alpha]] + position; chamber[x_, n_, y_, \[Alpha]_, j_] := If[ OddQ[j], {x, y, foundation[1, x, n, y, \[Alpha], j - 1]}, {x, y, foundation[-1, x, n, y, \[Alpha], j ]}] hive[x_, n_, y_, \[Alpha]_] = Table[chamber[x, n, y, \[Alpha], j], {j, 1, 2 size}] hiveG = Graphics3D[ { (*EdgeForm[], *) First[ParametricPlot3D[ Evaluate[hive[x, n, y, \[Alpha]]], {x, -size, size}, {y, 0, ySize} , BoxRatios -> {1, 1, 1}, DisplayFunction -> Identity] ] } ]; Show[ hiveG] (*********************************************************************** Mathematica-Compatible Notebook This notebook can be used on any computer system with Mathematica 4.0, MathReader 4.0, or any compatible application. The data for the notebook starts with the line containing stars above. To get the notebook into a Mathematica-compatible application, do one of the following: * Save the data starting with the line of stars above into a file with a name ending in .nb, then open the file inside the application; * Copy the data starting with the line of stars above to the clipboard, then use the Paste menu command inside the application. Data for notebooks contains only printable 7-bit ASCII and can be sent directly in email or through ftp in text mode. Newlines can be CR, LF or CRLF (Unix, Macintosh or MS-DOS style). NOTE: If you modify the data for this notebook not in a Mathematica- compatible application, you must delete the line below containing the word CacheID, otherwise Mathematica-compatible applications may try to use invalid cache data. For more information on notebooks and Mathematica-compatible applications, contact Wolfram Research: web: http://www.wolfram.com email: info at wolfram.com phone: +1-217-398-0700 (U.S.) Notebook reader applications are available free of charge from Wolfram Research. ***********************************************************************) (*CacheID: 232*) (*NotebookFileLineBreakTest NotebookFileLineBreakTest*) (*NotebookOptionsPosition[ 4330, 101]*) (*NotebookOutlinePosition[ 4972, 124]*) (* CellTagsIndexPosition[ 4928, 120]*) (*WindowFrame->Normal*) Notebook[{ Cell[BoxData[{ \(Clear[x, size, ySize, layers, distort, \[Alpha], n, flip, dispUp, dispDown, foundation, sign, position, j, chamber, hive]\), "\[IndentingNewLine]", \(\(size\ = 6;\)\), "\n", \(\(ySize = \ \[Pi]\ size;\)\), "\n", \(\(\[Alpha]\ = \ .2;\)\), "\n", \(\(n\ = \ 1;\)\), "\[IndentingNewLine]", \(\(layers = 6;\)\n\), "\n", \(\(distort[ n_, \[Theta]_, \[Alpha]_]\ := \ \[Alpha]\ \ Sin[ n\ \[Theta]];\)\[IndentingNewLine]\), "\n", \(\(flip[x_] := 0\ \ /; x < 0;\)\), "\n", \(\(flip[x_] := \ 1\ /; x\ \[GreaterEqual] \ 0;\)\), "\n", \(\(dispUp[x_, n_, \ \[Theta]_, \ \[Alpha]_]\ = \ flip[x]\ distort[ n, \ \[Theta], \ \[Alpha]];\)\ \[IndentingNewLine]\), "\n", \(\(unFlip[x_] := 1\ /; x < 0;\)\), "\n", \(\(unFlip[x_] := \ 0\ /; x\ \[GreaterEqual] \ 0;\)\), "\n", \(\(dispDown[x_, n_, \ \[Theta]_, \ \[Alpha]_]\ = unFlip[x]\ distort[ n, \ \[Theta], \ \[Alpha]];\)\[IndentingNewLine]\ \[IndentingNewLine]\), "\n", \(\(SetOptions[ParametricPlot3D, PlotPoints \[Rule] {11, 11}];\)\n\), "\[IndentingNewLine]", \(\(foundation[sign_, x_, n_, y_, \[Alpha]_, \ position_]\ := \ \[IndentingNewLine]sign\ \ Abs[x]\ + \ dispUp[x, n, y, \[Alpha]]\ + \ \[IndentingNewLine]dispDown[x, n, y, \[Alpha]]\ + \ \[IndentingNewLine]position;\)\ \[IndentingNewLine]\[IndentingNewLine]\), "\[IndentingNewLine]", \(chamber[x_, n_, y_, \[Alpha]_, j_]\ := If[\ OddQ[j], \ \[IndentingNewLine]{x, \ y, foundation[1, x, n, y, \[Alpha], \ j - 1]}, \[IndentingNewLine]{x, \ y, foundation[\(-1\), x, n, y, \[Alpha], \ j\ ]}]\[IndentingNewLine]\[IndentingNewLine]\), "\ \[IndentingNewLine]", \(hive[x_, n_, y_, \[Alpha]_]\ = \ Table[chamber[x, n, y, \[Alpha], j], \ {j, 1, 2\ size}]\[IndentingNewLine]\[IndentingNewLine]\), "\n", \(\(hiveG\ = Graphics3D[\[IndentingNewLine]{\ \[IndentingNewLine] (*\(EdgeForm[]\)\ \(,\)\ *) \[IndentingNewLine]First[ ParametricPlot3D[\[IndentingNewLine]Evaluate[ hive[x, n, y, \[Alpha]]], \[IndentingNewLine]{x, \(-size\), size}, \[IndentingNewLine]{y, 0, ySize}\ , \[IndentingNewLine]BoxRatios \[Rule] {1, 1, 1}, \[IndentingNewLine]DisplayFunction\ \[Rule] \ Identity]\[IndentingNewLine]]\[IndentingNewLine]}\ \[IndentingNewLine]];\)\), "\n", \(Show[\ hiveG]\)}], "Input"] }, FrontEndVersion->"4.0 for X", ScreenRectangle->{{0, 1600}, {0, 1200}}, WindowSize->{520, 600}, WindowMargins->{{414, Automatic}, {Automatic, 202}} ] (*********************************************************************** Cached data follows. If you edit this Notebook file directly, not using Mathematica, you must remove the line containing CacheID at the top of the file. The cache data will then be recreated when you save this file from within Mathematica. ***********************************************************************) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[1717, 49, 2609, 50, 795, "Input"] } ] *) (*********************************************************************** End of Mathematica Notebook file. ***********************************************************************) --------------E76D2AEC5FC69C18E68400A2 filename="boxample.nb" (*********************************************************************** Mathematica-Compatible Notebook This notebook can be used on any computer system with Mathematica 4.0, MathReader 4.0, or any compatible application. The data for the notebook starts with the line containing stars above. To get the notebook into a Mathematica-compatible application, do one of the following: * Save the data starting with the line of stars above into a file with a name ending in .nb, then open the file inside the application; * Copy the data starting with the line of stars above to the clipboard, then use the Paste menu command inside the application. Data for notebooks contains only printable 7-bit ASCII and can be sent directly in email or through ftp in text mode. Newlines can be CR, LF or CRLF (Unix, Macintosh or MS-DOS style). NOTE: If you modify the data for this notebook not in a Mathematica- compatible application, you must delete the line below containing the word CacheID, otherwise Mathematica-compatible applications may try to use invalid cache data. For more information on notebooks and Mathematica-compatible applications, contact Wolfram Research: web: http://www.wolfram.com email: info at wolfram.com phone: +1-217-398-0700 (U.S.) Notebook reader applications are available free of charge from Wolfram Research. ***********************************************************************) (*CacheID: 232*) (*NotebookFileLineBreakTest NotebookFileLineBreakTest*) (*NotebookOptionsPosition[ 4330, 101]*) (*NotebookOutlinePosition[ 4972, 124]*) (* CellTagsIndexPosition[ 4928, 120]*) (*WindowFrame->Normal*) Notebook[{ Cell[BoxData[{ \(Clear[x, size, ySize, layers, distort, \[Alpha], n, flip, dispUp, dispDown, foundation, sign, position, j, chamber, hive]\), "\[IndentingNewLine]", \(\(size\ = 6;\)\), "\n", \(\(ySize = \ \[Pi]\ size;\)\), "\n", \(\(\[Alpha]\ = \ .2;\)\), "\n", \(\(n\ = \ 1;\)\), "\[IndentingNewLine]", \(\(layers = 6;\)\n\), "\n", \(\(distort[ n_, \[Theta]_, \[Alpha]_]\ := \ \[Alpha]\ \ Sin[ n\ \[Theta]];\)\[IndentingNewLine]\), "\n", \(\(flip[x_] := 0\ \ /; x < 0;\)\), "\n", \(\(flip[x_] := \ 1\ /; x\ \[GreaterEqual] \ 0;\)\), "\n", \(\(dispUp[x_, n_, \ \[Theta]_, \ \[Alpha]_]\ = \ flip[x]\ distort[ n, \ \[Theta], \ \[Alpha]];\)\ \[IndentingNewLine]\), "\n", \(\(unFlip[x_] := 1\ /; x < 0;\)\), "\n", \(\(unFlip[x_] := \ 0\ /; x\ \[GreaterEqual] \ 0;\)\), "\n", \(\(dispDown[x_, n_, \ \[Theta]_, \ \[Alpha]_]\ = unFlip[x]\ distort[ n, \ \[Theta], \ \[Alpha]];\)\[IndentingNewLine]\ \[IndentingNewLine]\), "\n", \(\(SetOptions[ParametricPlot3D, PlotPoints \[Rule] {11, 11}];\)\n\), "\[IndentingNewLine]", \(\(foundation[sign_, x_, n_, y_, \[Alpha]_, \ position_]\ := \ \[IndentingNewLine]sign\ \ Abs[x]\ + \ dispUp[x, n, y, \[Alpha]]\ + \ \[IndentingNewLine]dispDown[x, n, y, \[Alpha]]\ + \ \[IndentingNewLine]position;\)\ \[IndentingNewLine]\[IndentingNewLine]\), "\[IndentingNewLine]", \(chamber[x_, n_, y_, \[Alpha]_, j_]\ := If[\ OddQ[j], \ \[IndentingNewLine]{x, \ y, foundation[1, x, n, y, \[Alpha], \ j - 1]}, \[IndentingNewLine]{x, \ y, foundation[\(-1\), x, n, y, \[Alpha], \ j\ ]}]\[IndentingNewLine]\[IndentingNewLine]\), "\ \[IndentingNewLine]", \(hive[x_, n_, y_, \[Alpha]_]\ = \ Table[chamber[x, n, y, \[Alpha], j], \ {j, 1, 2\ size}]\[IndentingNewLine]\[IndentingNewLine]\), "\n", \(\(hiveG\ = Graphics3D[\[IndentingNewLine]{\ \[IndentingNewLine] (*\(EdgeForm[]\)\ \(,\)\ *) \[IndentingNewLine]First[ ParametricPlot3D[\[IndentingNewLine]Evaluate[ hive[x, n, y, \[Alpha]]], \[IndentingNewLine]{x, \(-size\), size}, \[IndentingNewLine]{y, 0, ySize}\ , \[IndentingNewLine]BoxRatios \[Rule] {1, 1, 1}, \[IndentingNewLine]DisplayFunction\ \[Rule] \ Identity]\[IndentingNewLine]]\[IndentingNewLine]}\ \[IndentingNewLine]];\)\), "\n", \(Show[\ hiveG]\)}], "Input"] }, FrontEndVersion->"4.0 for X", ScreenRectangle->{{0, 1600}, {0, 1200}}, WindowSize->{520, 600}, WindowMargins->{{414, Automatic}, {Automatic, 202}} ] (*********************************************************************** Cached data follows. If you edit this Notebook file directly, not using Mathematica, you must remove the line containing CacheID at the top of the file. The cache data will then be recreated when you save this file from within Mathematica. ***********************************************************************) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[1717, 49, 2609, 50, 795, "Input"] } ] *) (*********************************************************************** End of Mathematica Notebook file. ***********************************************************************) --------------E76D2AEC5FC69C18E68400A2--