Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to crop Graphics3D in V7?

30 views
Skip to first unread message

Cca

unread,
Dec 22, 2008, 5:15:22 AM12/22/08
to
Hello,

Consider this:

fig = Graphics3D[{FontSize ->
28, {Translate[{{Text[b, {1, 0, 0}, {0, -1}],
Text[h, {2, 0, 2}, {1, 0}]},
Polygon[{{0, 0, 0}, {2, 0, 0}, {2, 0, 4}, {0, 0, 4}}]}, {0,
1/Pi, 0}], Opacity[0.5],
Cylinder[{{0, 0, 0}, {0, 0, 4}}, 1/Pi]},
Translate[{Translate[{{Text[h, {2, 0, 0}, {0, -1}],
Text[b, {4, 0, 1}, {1, 0}]},
Polygon[{{0, 0, 0}, {4, 0, 0}, {4, 0, 2}, {0, 0, 2}}]}, {0,
2/Pi, 0}], Opacity[0.5],
Cylinder[{{0, 0, 0}, {0, 0, 2}}, 2/Pi]}, {3.1, 0, 0}],
Text[b < h, Scaled[{0.8, 1, 1}]]},
ViewPoint->{-0.02, -1.6, -1.5},
SphericalRegion->True,
Boxed->False,
Axes->False,
PlotRange->{{-1/Pi, 7.1}, {-0.7, 0.7}, {0, 4}},
ImageSize->{488, Automatic}]

In Mathematica 6, the following works:

Append[fig, ImagePadding -> {{0, 0}, {-120, -150}}]

The image is similar to what we get with

ImageCrop[fig]

However, ImagePadding with negative values no longer works in V7. What combination of options do I have to use to crop the Graphics3D above (without using Inset in Graphics)?

BTW, interactive cropping (Ctrl+drag) is not working in V7 with Windows XP.


Cordialmente,

Carlos César de Araújo
Gregos & Troianos Educacional
http://www.gregosetroianos.mat.br
MSN: cca_grego...@hotmail.com
Belo Horizonte, MG, Brasil
(31) 3283-1122


David Park

unread,
Dec 23, 2008, 6:54:47 AM12/23/08
to
Carlos,

Try:

Append[fig, PlotRegion -> {{0, 1}, {-.3, 1.4}}]


David Park
djm...@comcast.net
http://home.comcast.net/~djmpark/


From: Cca [mailto:c...@gregosetroianos.mat.br]

Hello,

Consider this:

ImageCrop[fig]

BTW, interactive cropping (Ctrl+drag) is not working in V7 with Windows =
XP.


Cordialmente,

Carlos C=E9sar de Ara=FAjo

John Fultz

unread,
Dec 23, 2008, 6:55:51 AM12/23/08
to
Actually, this *doesn't* work in later versions of 6.0 (I just tried in 6.0.3).
I'm not sure whether it should or not. I'll send your comments to the graphics
developers. In version 7, what you're looking for can be accomplished by adding
the option...

Method->{"ShrinkWrap"->True}

to the Graphics3D options. This will work for any Graphics3D object, and can
also be done interactively by right-clicking on a 3D graphic and choosing "Trim
Bounding Box".

As for the Ctrl+drag cropping problem, that is a known bug which will be fixed
in the next incremental release of Mathematica.

Sincerely,

John Fultz
jfu...@wolfram.com
User Interface Group
Wolfram Research, Inc.

sjoerd.c...@gmail.com

unread,
Dec 24, 2008, 6:02:49 AM12/24/08
to
Hi John,

This Method->{"ShrinkWrap"->True} option is very useful. I've never
seen it before. Can you point me to the location in the documentation
centre where it is described? I couldn't find it and I usually can
find my way around there. In fact, the Method option of Graphics3D
doesn't seem to have a list of possible settings at all.

Cheers -- Sjoerd

On Dec 23, 1:55 pm, John Fultz <jfu...@wolfram.com> wrote:
> Actually, this *doesn't* work in later versions of 6.0 (I just tried in 6=
.0.3).
> I'm not sure whether it should or not. I'll send your comments to the =
graphics
> developers. In version 7, what you're looking for can be accomplished =


by adding
> the option...
>
> Method->{"ShrinkWrap"->True}
>

> to the Graphics3D options. This will work for any Graphics3D object, a=
nd can
> also be done interactively by right-clicking on a 3D graphic and choosing=
"Trim
> Bounding Box".
>
> As for the Ctrl+drag cropping problem, that is a known bug which will be =

> > MSN: cca_gregosetroia...@hotmail.com

0 new messages