ViewCenter

ViewCenter is an option for Graphics3D, SurfaceGraphics and funtions that return such graphics. The ViewCenter usage message is shown below.

? ViewCenter

ViewCenter is an option for Graphics3D and SurfaceGraphics which gives the scaled coordinates of the point which appears at the center of the display area in the final plot. More…

The coordinates used for ViewVenter are always scaled so that the bounding box of the graphic has range (0,1) in all three directions.  The default setting is ViewCenter→{0.5,0.5,0.5} which ensures the center of the bounding box in in the center of the display area. Next I use ViewCenter→{0,0,0} and the red point is in the center of the graphic.  Here the red point is in the center of the display area because it's near the lowest value for the range along all three axes.  Recall the red point is at {5,8,10}, the yellow point is at {6,8,10}, the green point is at {6,8,11}, and the purple point is at {6,9,10}.

Show[gr, ViewCenter-> {0, 0, 0}] ;

In the next cell the green point is near the center of the display area.  That is because the setting ViewCenter→{1,0,1} ensures the maximum value along the x, z axes, and the minimum value along the y axis is in the center of the display area.

Show[gr, ViewCenter-> {1, 0, 1}] ;

Regardless of what setting for ViewPoint is used, ViewCenter always refers to the same point on the graphic.  So for example the next input ensures the red point is in the center of the display area.

RowBox[{RowBox[{Show, [, RowBox[{gr, ,, RowBox[{ViewPoint, , RowBox[{{, RowBox[{4, ,, 5.2, ,, RowBox[{-, 2.8}]}], }}]}], ,, ViewCenter-> {0, 0, 0}}], ]}], ;}]

The setting (SphericalRegion→True) overrides any ViewCenter setting.


Created by Mathematica  (May 16, 2004)

Back to Ted’s Tricks index page