<!-- Converted by db4-upgrade version 1.0 -->

<refentry xmlns="http://docbook.org/ns/docbook" version="5.0" xml:id="center">

  <refmeta>
    <refentrytitle>CENTER</refentrytitle>
    <manvolnum>nged</manvolnum>
    <refmiscinfo class="source">BRL-CAD</refmiscinfo>
    <refmiscinfo class="manual">BRL-CAD User Commands</refmiscinfo>
  </refmeta>
  
  <refnamediv xml:id="name">
    <refname>center</refname>
    <refpurpose>Positions the center of the <emphasis>mged</emphasis> viewing 
    cube at the specified model coordinates.
    </refpurpose>
  </refnamediv>
  
  <!-- body begins here -->
  <refsynopsisdiv xml:id="synopsis">
    <cmdsynopsis sepchar=" ">
      <command>center</command>    
      <arg choice="opt" rep="norepeat"><replaceable>x y z</replaceable></arg>
    </cmdsynopsis>
  </refsynopsisdiv>
  
  <refsection xml:id="description"><info><title>DESCRIPTION</title></info>
    
    <para>
      Positions the center of the <emphasis>mged</emphasis> viewing cube at the specified
      model coordinates. This is accomplished by moving the eye position while not
      changing the viewing direction. (The <command>lookat</command> command performs a 
      related function by changing the viewing direction, but not moving the eye location.) 
      The coordinates are expected in the current editing units. In case the coordinates 
      are the result of evaluating a formula, they are echoed back. If no coordinates are 
      provided, the current center coordinates (in current editing units, not mm) are 
      printed and can be used in subsequent calculations.
    </para>
    <para>
      It is often convenient to use the center of the view when visually selecting key
      locations in the model for construction or animation because of (1) the visible
      centering dot on the screen, (2) the fact that zoom and rotation are performed with
      respect to the view center, (3) the default center-mouse behavior is to move the
      indicated point to the view center, and (4) the angle/distance cursors are centered by
      default. This command provides the means to set and retrieve those values
      numerically.
    </para>
  </refsection>
  
  <refsection xml:id="examples"><info><title>EXAMPLES</title></info>
    
    <para>
      The examples show the use of the <command>center</command> command to print 
      coordinates of the center of the mged display, move the center of the 
      <emphasis>mged</emphasis> display to a given point, set a Tcl variable to the 
      display center coodinates, move the center point a given distance
      in a given direction, and update a vertex in the database to be located at 
      the current center of view.
    </para>
    <example><info><title>Printing the coordinates of the center of the <emphasis>mged</emphasis> display.</title></info>
      
      <para>
	<prompt>mged&gt;</prompt> <userinput>center</userinput>
      </para>
      <para>Prints out the coordinates of the center of the mged display.
      </para>
    </example>
    
    <example><info><title>Moving the center of the <emphasis>mged</emphasis> display to a specified point.</title></info>
      
      <para>
	<prompt>mged&gt;</prompt><userinput>center 12.5 5.6 8.7&gt;</userinput>
      </para>
      <para>The center of the <emphasis>mged</emphasis> display is moved to the point (12.5, 5.6, 8.7).</para>
    </example>
    
    <example><info><title>Set Tcl variable $oldcent to the display center coordinates.</title></info>
      
      <para>
	<prompt>mged&gt;</prompt><userinput>set oldcent [center]</userinput>
      </para>
      <para>
	Sets the Tcl variable $oldcent to the display center coordinates.
      </para>
    </example>
    
    <example><info><title>Move the center point a given distance in a given direction.</title></info>
      
      <variablelist>
	<varlistentry>
	  <term><prompt>mged&gt;</prompt> <userinput>set glob_compat_mode 0</userinput></term>
      </varlistentry>
      <varlistentry>
	   <term><prompt>mged</prompt> <userinput>units mm</userinput></term>
      </varlistentry>
      <varlistentry>
	<term><prompt>mged</prompt> <userinput>eval center [vadd2[center] {2 0 0}]</userinput></term>
	<listitem>
	  <para>
	    Moves the center point 2 mm in the model + x direction.
	  </para>
	</listitem>
      </varlistentry>
      </variablelist>
    </example>
    <example><info><title>Update the vertex of a shape in the database to be located at the current
      center of the view and recreate the vector display lists of objects that were affected by the change.</title></info>
      
      <variablelist>
	<varlistentry>
	   <term><prompt>mged&gt;</prompt> <userinput>units mm</userinput></term>
	</varlistentry>
	<varlistentry>
	  <term><prompt>mged</prompt> <userinput>db adjust sphere.s  V [center]</userinput></term>
	</varlistentry>
	<varlistentry>
	  <term><prompt>mged</prompt> <userinput>redraw_vlist sphere.s</userinput></term>
	  <listitem>
	    <para>
	      Updates the "V" vertex of shape sphere.s in the database to be located at
	      the current center of the view, and recreates the vector display lists of 
	      only those object(s) that were affected by the change.
	    </para>
	  </listitem>
	</varlistentry>
      </variablelist>
    </example>
  </refsection>
  
  <info><corpauthor>BRL-CAD Team</corpauthor></info>
  
  <refsection xml:id="bug_reports"><info><title>BUG REPORTS</title></info>
    
    <para>
      Reports of bugs or problems should be submitted via electronic
      mail to &lt;devs@brlcad.org&gt;, or via the "cadbug.sh" script.
    </para>
  </refsection>
</refentry>
