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

3D plot with orthographic projection

400 views
Skip to first unread message

markus

unread,
Jul 3, 2009, 5:36:21 AM7/3/09
to
Hi,

I would like to create a 3D Plot in Mathematica 7 using an
orthographic projection instead of the default stereographic mode. So
far, I have found that it is possible to give something like
"ViewPoint->{0,0,Infinity}" as an option in order to view at the plot
from the top plane, using orthographic projection. But the ViewPoint
option seems to accept only +/-Infinity for *one* of the directions,
keeping all other zero. However, I would like to look at an
orthographic plot from any viewpoint, just as in the default 3d plots
(that I can rotate with the moue).
Does anybody know how that is possible?

Thanks,
Markus

Alexander Elkins

unread,
Jul 5, 2009, 11:16:49 PM7/5/09
to
Have a look at the very poor documentation for ViewMatrix.

In the example shown, replace

{{1, 0, 0, 0}, {0, 1, 0, 0}, {0, 0, -1, 0}, {0, 0, 0, 1}}

with

TransformationMatrix[ReflectionTransform[{0, 0, 1}]]

giving

Graphics3D[Sphere[], Boxed -> False,
ViewMatrix -> {TransformationMatrix[
RescalingTransform[{{-1, 1}, {-1, 1}, {-1, 1}}]],
TransformationMatrix[ReflectionTransform[{0, 0, 1}]]}]

The reason for having two matrices has to do with lighting.

For a somewhat more meaningful example try the following:

Manipulate[
Graphics3D[{PointSize[0.05], Sphere[{-1, -1, -1}, 0.05] ,
Arrowheads[{0.05}], Red, Arrow[Tube[{{0, 0, 0}, {1, 0, 0}}, 0.02]],
Text[Style["X", "Section"], {1, 0, 0}], Green,
Arrow[Tube[{{0, 0, 0}, {0, 1, 0}}, 0.02]],
Text[Style["Y", "Section"], {0, 1, 0}], Blue,
Arrow[Tube[{{0, 0, 0}, {0, 0, 1}}, 0.02]],
Text[Style["Z", "Section"], {0, 0, 1}]},
ViewCenter -> {{1/2, 1/2, 1/2}, ImageScaled[{1, 1}]},
ViewMatrix -> {TransformationMatrix[ScalingTransform[{1, 1, 1} s]],
TransformationMatrix[
ReflectionTransform[
Append[Normalize[pt - {1/2, 1/2}], -1 +
2 SquaredEuclideanDistance @@ (pt - {1/2,
1/2})]]]}], {{s, 0.27,
"Scale"}, 0.1, 0.5}, {pt, {{0.777, 0.292}}, Locator}]

Move the locator about to get different views.

Hope this helps...
Alexander

"markus" <markus...@googlemail.com> wrote in message
news:h2kjel$imk$1...@smc.vnet.net...

markus

unread,
Jul 7, 2009, 7:47:09 AM7/7/09
to
thank you, Alexander, this is what I was looking for, although it is a
bit too complicated for my taste.
I hope that in the next version of Mathematica there will be some
simple option for Graphics3D to enable orthographic projection

0 new messages