<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi Miroslav and David,<br>
    <br>
    Thanks for the suggestions. That's what I was looking for.<br>
    I'll implement it using a separate renderer to avoid mixing actors
    and to set the layer.<br>
    I just need to read up on synchronizing the cameras between the two
    renderers and it should work.<br>
    <br>
    Thanks!<br>
    <br>
    <div class="moz-cite-prefix">On 3/13/2015 5:32 PM, Miroslav Drahos
      wrote:<br>
    </div>
    <blockquote
cite="mid:CA601922B0319145BC245491E6F9FDCE5E793869DF@pub.curexomed.local"
      type="cite">
      <pre wrap="">Sent my email response a bit too early, sorry.

If you decide to layer the renderers, you'll probably want to set the foreground renderer as non-interactive (vtkRenderer::SetInteractive(0)) otherwise it will be grabbing the events from interactors.
Cheers,
Miro


________________________________________
From: Miroslav Drahos
Sent: Friday, March 13, 2015 2:28 PM
To: David Gobbi; Serge Lalonde
Cc: <a class="moz-txt-link-abbreviated" href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a>
Subject: RE: [vtkusers] Tips for the display of a fixed size origin marker

You could stack two renderers, assign the layer number to them (vtkRenderer::SetLayer(int) and vtkRenderWindow::SetNumberOfLayers(int) ) and have the one that's on top contain the origin label actor. That way it will always be visible (as a top layer).

________________________________________
From: vtkusers [<a class="moz-txt-link-abbreviated" href="mailto:vtkusers-bounces@vtk.org">vtkusers-bounces@vtk.org</a>] On Behalf Of David Gobbi [<a class="moz-txt-link-abbreviated" href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>]
Sent: Friday, March 13, 2015 2:23 PM
To: Serge Lalonde
Cc: <a class="moz-txt-link-abbreviated" href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a>
Subject: Re: [vtkusers] Tips for the display of a fixed size origin marker

Hi Serge,

To get the scale right, I add an observer for the renderer's StartEvent
that does all the necessary calculations to set the position and scale
of the actor correctly just before the render occurs.  It's kind of messy,
but I don't know a better way.  The code that I use to compute the
correct actor scale is as follows:

void ComputeScale(const double position[3], vtkRenderer *renderer)
{
  // Find the cursor scale factor such that 1 data unit length
  // equals 1 screen pixel at the cursor's distance from the camera.
  // Start by computing the height of the window at the cursor position.
  double worldHeight = 1.0;
  vtkCamera *camera = renderer->GetActiveCamera();
  if (camera->GetParallelProjection())
    {
    worldHeight = 2*camera->GetParallelScale();
    }
  else
    {
    vtkMatrix4x4 *matrix = camera->GetViewTransformMatrix();
    // Get a 3x3 matrix with the camera orientation
    double cvz[3];
    cvz[0] = matrix->GetElement(2, 0);
    cvz[1] = matrix->GetElement(2, 1);
    cvz[2] = matrix->GetElement(2, 2);

    double cameraPosition[3];
    camera->GetPosition(cameraPosition);

    double v[3];
    v[0] = cameraPosition[0] - position[0];
    v[1] = cameraPosition[1] - position[1];
    v[2] = cameraPosition[2] - position[2];

    worldHeight = 2*(vtkMath::Dot(v,cvz)
                     * tan(0.5*camera->GetViewAngle()/57.296));
    }

  // Compare world height to window height.
  int windowHeight = renderer->GetSize()[1];
  double scale = 1.0;
  if (windowHeight > 0)
    {
    scale = worldHeight/windowHeight;
    }

  return scale;
}

For the other question, it sounds like you want VTK to ignore the depth
buffer when it renders your actor.  I don't know if this is possible.  If I need
an annotation or a cursor to be in front of everything, I do a pick to find the
depth (i.e. frontmost object) at the position where I want to render my cursor,
and then I place my cursor at that depth.

 - David


On Fri, Mar 13, 2015 at 2:54 PM, Serge Lalonde <<a class="moz-txt-link-abbreviated" href="mailto:serge@infolytica.com">serge@infolytica.com</a><a class="moz-txt-link-rfc2396E" href="mailto:serge@infolytica.com"><mailto:serge@infolytica.com></a>> wrote:
Anyone have any suggestions on how to implement the display of the origin?
It doesn't have to be axes (although that would be nice).
The trick is to get it to be a fixed size regardless of the camera zoom and to make it visible even if "hidden" inside of another actor.

Thanks for any tips.
--
<a class="moz-txt-link-abbreviated" href="http://www.infolytica.com">www.infolytica.com</a> <http:://www.infolytica.com>
300 Leo Pariseau, Suite 2222, Montreal, QC, Canada, H2X 4B3
(514) 849-8752 x236<a class="moz-txt-link-rfc2396E" href="tel:%28514%29%20849-8752%20x236"><tel:%28514%29%20849-8752%20x236></a>, Fax: (514) 849-4239<a class="moz-txt-link-rfc2396E" href="tel:%28514%29%20849-4239"><tel:%28514%29%20849-4239></a>



</pre>
    </blockquote>
    <br>
    <div class="moz-signature">-- <br>
      <meta http-equiv="content-type" content="text/html;
        charset=windows-1252">
      <title>Signature</title>
      <a href="http:://www.infolytica.com">www.infolytica.com </a><br>
      300 Leo Pariseau, Suite 2222, Montreal, QC, Canada, H2X 4B3<br>
      (514) 849-8752 x236, Fax: (514) 849-4239
    </div>
  </body>
</html>