[vtkusers] AddNodeAtWorldPosition - Crash

Dean Inglis dean.inglis at sympatico.ca
Thu Oct 22 19:59:02 EDT 2009


Hi,
 
your code crashes because the Renderer ivar is not set.
The contour representation should be added to a vtkContourWidget
and the widget should have its vtkRenderWindowInteractor set 
before trying to use it.  The widget will set up the representation's
renderer ivar.
 
Dean
 
 
int main()
{
        vtkOrientedGlyphFocalPlaneContourRepresentation* cr =
vtkOrientedGlyphFocalPlaneContourRepresentation::New();
        double wp[3] = {1.0, 1.0, 1.0};
        cr->AddNodeAtWorldPosition(wp); //crash here - access violation
reading location 0x00000000
        return 0;
}
 
 
The crash goes down to vtkcontourrepresentation.cxx, line 1106
 
//----------------------------------------------------------------------
void vtkContourRepresentation
::GetRendererComputedDisplayPositionFromWorldPosition( double worldPos[3],
                                double * vtkNotUsed(worldOrient[9]), double
displayPos[2] )
{
  double pos[4];
  pos[0] = worldPos[0];
  pos[1] = worldPos[1];
  pos[2] = worldPos[2];
  pos[3] = 1.0;
  
  this->Renderer->SetWorldPoint( pos );       //crashes here
  this->Renderer->WorldToDisplay();
  this->Renderer->GetDisplayPoint( pos );
  
  displayPos[0] = pos[0];
  displayPos[1] = pos[1];

}

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20091022/0b675d74/attachment.htm>


More information about the vtkusers mailing list