<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Hi Liam,<br>
      <blockquote type="cite">On 1/9/2015 10:52 AM, Liam wrote:<br>
        <blockquote cite="mid:loom.20150109T194901-160@post.gmane.org"
          type="cite">
          Just one more question. How do you define:
          far = config.camFac
        </blockquote>
      </blockquote>
      <br>
      your question is a follow up to the script about automatically
      positioning the camera when viewing 2d axis aligned image data
      from thread<br>
      <blockquote type="cite"> <a
          href="http://comments.gmane.org/gmane.comp.science.paraview.user/15091"
          target="_blank">http://comments.gmane.org/gmane.comp.science.paraview.user/15091</a></blockquote>
      <br>
      in that post config.camFac was a variable for used for fine tuning
      the camera position. It could be 1.0 to go with default, less than
      1.0 to move camera closer or greater than 1.0 to move the camera
      away.<br>
      <br>
      Since I originally posted the script I had made improvements to it
      which I'll paste below. To remind of the context of the script
      below: I have 2d axis aligned image data in the object named bovr.
      the script below automatically positions the camera and sizes the
      view according to the aspect ratio of the data. "config_camZoom"
      is a fine tuning parameter, and is documented <a
href="http://www.vtk.org/doc/nightly/html/classvtkCamera.html#a64512cc87555856a84f6c7d00abe0da9">here</a>.
      1.0 is the value to start with.<br>
      <br>
      hope this helps<br>
      Burlen<br>
      <br>
      <tt># run the pipeline here to get the bounds</tt><tt><br>
      </tt><tt>rep = Show(bovr)</tt><tt><br>
      </tt><tt>rep.Representation = 'Outline'</tt><tt><br>
      </tt><tt>Render()</tt><tt><br>
      </tt><tt><br>
      </tt><tt>bounds = bovr.GetDataInformation().GetBounds()</tt><tt><br>
      </tt><tt>bounds_dx = fabs(bounds[1] - bounds[0])</tt><tt><br>
      </tt><tt>bounds_dy = fabs(bounds[3] - bounds[2])</tt><tt><br>
      </tt><tt>bounds_dz = fabs(bounds[5] - bounds[4])</tt><tt><br>
      </tt><tt>bounds_cx = (bounds[0] + bounds[1])/2.0</tt><tt><br>
      </tt><tt>bounds_cy = (bounds[2] + bounds[3])/2.0</tt><tt><br>
      </tt><tt>bounds_cz = (bounds[4] + bounds[5])/2.0</tt><tt><br>
      </tt><tt><br>
      </tt><tt>if (bounds_dx == 0):</tt><tt><br>
      </tt><tt>  # yz</tt><tt><br>
      </tt><tt>  dimMode = 2</tt><tt><br>
      </tt><tt>  aspect = bounds_dz/bounds_dy</tt><tt><br>
      </tt><tt><br>
      </tt><tt>elif (bounds_dy == 0):</tt><tt><br>
      </tt><tt>  # xz</tt><tt><br>
      </tt><tt>  dimMode = 1</tt><tt><br>
      </tt><tt>  aspect = bounds_dz/bounds_dx</tt><tt><br>
      </tt><tt><br>
      </tt><tt>elif (bounds_dz == 0):</tt><tt><br>
      </tt><tt>  #xy</tt><tt><br>
      </tt><tt>  dimMode = 0</tt><tt><br>
      </tt><tt>  aspect = bounds_dy/bounds_dx</tt><tt><br>
      </tt><tt><br>
      </tt><tt>else:</tt><tt><br>
      </tt><tt>  #3d</tt><tt><br>
      </tt><tt>  dimMode = 3</tt><tt><br>
      </tt><tt>  aspect = 1.0 # TODO</tt><tt><br>
      </tt><tt><br>
      </tt><tt># position the camera</tt><tt><br>
      </tt><tt>camFar=1.0</tt><tt><br>
      </tt><tt><br>
      </tt><tt>if (dimMode == 0):</tt><tt><br>
      </tt><tt>  # xy</tt><tt><br>
      </tt><tt>  camUp = [0.0, 1.0, 0.0]</tt><tt><br>
      </tt><tt>  camDir = 2</tt><tt><br>
      </tt><tt>  pos = max(bounds_dx, bounds_dy)</tt><tt><br>
      </tt><tt>  camPos = [bounds_cx, bounds_cy, -pos*camFar]</tt><tt><br>
      </tt><tt>  camFoc = [bounds_cx, bounds_cy, bounds_cz]</tt><tt><br>
      </tt><tt><br>
      </tt><tt>elif (dimMode == 1):</tt><tt><br>
      </tt><tt>  # xz</tt><tt><br>
      </tt><tt>  camUp = [0.0, 0.0, 1.0]</tt><tt><br>
      </tt><tt>  camDir = 1</tt><tt><br>
      </tt><tt>  pos = max(bounds_dx, bounds_dz)</tt><tt><br>
      </tt><tt>  camPos = [bounds_cx, -pos*camFar,  bounds_cz]</tt><tt><br>
      </tt><tt>  camFoc = [bounds_cx, bounds_cy, bounds_cz]</tt><tt><br>
      </tt><tt><br>
      </tt><tt>elif (dimMode == 2):</tt><tt><br>
      </tt><tt>  # yz</tt><tt><br>
      </tt><tt>  camUp = [0.0, 0.0, 1.0]</tt><tt><br>
      </tt><tt>  camDir = 0</tt><tt><br>
      </tt><tt>  pos = max(bounds_dy, bounds_dz)</tt><tt><br>
      </tt><tt>  camPos = [ pos*camFar, bounds_cy, bounds_cz]</tt><tt><br>
      </tt><tt>  camFoc = [bounds_cx, bounds_cy, bounds_cz]</tt><tt><br>
      </tt><tt><br>
      </tt><tt>else:</tt><tt><br>
      </tt><tt>  # 3d</tt><tt><br>
      </tt><tt>  print '3d cam position is yet TODO'</tt><tt><br>
      </tt><tt><br>
      </tt><tt># configure the view</tt><tt><br>
      </tt><tt>width = 1024</tt><tt></tt><tt><br>
      </tt><tt>height = int(width*aspect)</tt><tt><br>
      </tt><tt><br>
      </tt><tt>view = GetRenderView()</tt><tt><br>
      </tt><tt>view.CameraViewUp = camUp</tt><tt><br>
      </tt><tt>view.CameraPosition = camPos</tt><tt><br>
      </tt><tt>view.CameraFocalPoint = camFoc</tt><tt><br>
      </tt><tt>view.UseOffscreenRenderingForScreenshots = 0</tt><tt><br>
      </tt><tt>view.CenterAxesVisibility = 0</tt><tt><br>
      </tt><tt>view.OrientationAxesVisibility = 0</tt><tt><br>
      </tt><tt>view.ViewSize = [width, height]</tt><tt><br>
      </tt><tt>Render()</tt><tt><br>
      </tt><tt>view.ResetCamera()</tt><tt><br>
      </tt><tt><br>
        # for fine tuning<br>
      </tt><tt>config_camZ</tt><tt>oom = 1.0</tt><tt><br>
      </tt><tt>cam = GetActiveCamera()</tt><tt><br>
      </tt><tt>cam.Zoom(config</tt><tt>_</tt><tt>camZoom)</tt><tt><br>
      </tt><br>
      On 1/9/2015 10:52 AM, Liam wrote:<br>
    </div>
    <blockquote cite="mid:loom.20150109T194901-160@post.gmane.org"
      type="cite">
      <pre wrap="">Hey guys,

Just one more question. How do you define:

far  = config.camFac

I cannot find in the code neither config nor camFac variable, so anybody
could explain me how to compute far variable?

This code has helped me so much. 

Yhanks in advance,

Liam


_______________________________________________
Powered by <a class="moz-txt-link-abbreviated" href="http://www.kitware.com">www.kitware.com</a>

Visit other Kitware open-source projects at <a class="moz-txt-link-freetext" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a>

Please keep messages on-topic and check the ParaView Wiki at: <a class="moz-txt-link-freetext" href="http://paraview.org/Wiki/ParaView">http://paraview.org/Wiki/ParaView</a>

Search the list archives at: <a class="moz-txt-link-freetext" href="http://markmail.org/search/?q=ParaView">http://markmail.org/search/?q=ParaView</a>

Follow this link to subscribe/unsubscribe:
<a class="moz-txt-link-freetext" href="http://public.kitware.com/mailman/listinfo/paraview">http://public.kitware.com/mailman/listinfo/paraview</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>