The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Inactive » comp.soft-sys.math.mathematica

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Clippling of polygons within a defined region
Replies: 2   Last Post: Aug 5, 1999 2:27 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
John Tanner

Posts: 10
Registered: 12/7/04
Re: Clippling of polygons within a defined region
Posted: Aug 5, 1999 2:27 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

In article <7o5ff4$>, Allan Hayes
<> writes
>The same problem arises with big points, thick lines and with text.
>Here is an first attempt at dealing with it.

>One undesirable feature of this is that we are relying the hidden frame and
>ticks in gr to make room for the versions in fat.


Thank you very much! That gives me exactly what I needed. At first I
thought it was a complete solution but I now see what you mean about an
"undesirable feature". There seems to be a small problem with
FullGraphics in terms of the position and orientation of FrameLabels and
PlotLabel (fortunately easy to overcome: before, I had absolutely

Masked[gr_Graphics, st___] :=
Module[{fat, pr, mask, e, x1, x2, y1,y2},
(*get the explicit graphics for frame, and frameticks*)
fat = Delete[FullGraphics[gr], {1, 1}];
(*get the explicit plotrange for gt*)
{{x1, x2}, {y1, y2}} = pr = PlotRange[gr];
(*calculate a suitable mask with style st*)
e = Max[x2 - x1, y2 - y1];
mask = Graphics[{st,
Polygon[{{x1, y1}, {x2, y1}, {x2, y2}, {x1, y2}, {x1, y1},
{x1 - e, y1 - e}, {x1 - e, y2 + e}, {x2 + e, y2 + e},
{x2 + e, y1 - e}, {x1 - e, y1 - e}}]}];
(*show the graphics in the right order*)
Show[gr, mask, fat, PlotRange -> pr]]

gr2 = Show[
Graphics[{Polygon[{{-1, 0}, {2, -2}, {2, 1}}],
PointSize[0.5],Point[{1, 1}]}],
Frame -> True, FrameTicks -> True,
PlotRange -> {{0, 1}, {0, 1}},
FrameLabel -> {"X Axis", "Y Axis"},
PlotLabel -> "Plot Label"]

Masked[gr2, RGBColor[1, 1, 1]]

Select[ToString[#] & /@ Flatten[FullGraphics[gr2] /. Graphics -> List],
StringPosition[#, "Axis"] =!= {} &]

{"Text[X Axis, {0.5, -0.0202254}, {0., 1.}]",
"Text[Y Axis, {-0.01875, 0.5}, {1., 0.}]"}

This seems to show that Text is being called with 3 arguments, missing
the "offset" argument in position 3.

Incidentally, the behaviour of Display in generating output files is
rather different from Show. I still do not fully understand the
following, but it appears that the FrameLabel added by the Masked
function overrides the previous Text calls etc., completely the opposite
to the behaviour of Show. The new Export command does give the same as

Display["c:\\temp\\tmp1.gif", gr2, "GIF"]

Display["c:\\temp\\tmp2.gif", Masked[gr2, RGBColor[1, 1, 1]], "GIF"]

Select[ToString[#] & /@
Flatten[Masked[gr2, RGBColor[1, 1, 1]] /. Graphics -> List],
StringPosition[#, "Axis"] =!= {} &]

{"Text[X Axis, {0.5, -0.0202254}, {0., 1.}]",
"Text[Y Axis, {-0.01875, 0.5}, {1., 0.}]",
"FrameLabel -> {X Axis, Y Axis}"}

Thank you again! This saved me much time.


Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.