<div dir="ltr"><div><div>Dennis,<br>GetPosition() writes 3 double at the provided pointer. Here you pass it a pointer sized for 3 floats (2 times smaller), so it crashes (you misunderstand the meaning of reinterpret_cast).<br></div>Declare cpos as a double array instead of a float array and it will work (double cpos[3];).<br><br></div>Best,<br></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><b>Joachim Pouderoux</b><br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><font size="1"><i>PhD, Technical Expert</i></font><br><b><font size="1"><a href="http://www.kitware.fr" target="_blank">Kitware SAS</a></font></b><br></blockquote>
</div></div></div>
<br><div class="gmail_quote">2016-01-08 0:08 GMT+01:00 dieutan via vtk-developers <span dir="ltr"><<a href="mailto:vtk-developers@vtk.org" target="_blank">vtk-developers@vtk.org</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Everyone,<br>
<br>
My application crashed when calling vtkCamera::SetPosition<br>
<br>
Here is some of my code:<br>
float cpos[3];<br>
vtkRenderer *ren1;<br>
ren1 = vtkRenderer::New();<br>
vtkCamera *cam1 = ren1->GetActiveCamera();<br>
<br>
cam1->GetPosition(reinterpret_cast<double *>(cpos));<br>
cam1->SetPosition(0.000000,0.000000,7.453844);<br>
<br>
Here is the error message:<br>
Unhandled exception at 0x019661e1 in Sersim.exe: 0xC0000005: Access<br>
violation reading location 0x00000050.<br>
<br>
I'm using w1ndows 7, visual studio 2010, VTK version 5.10.1.<br>
<br>
Please advice to fix the issue.<br>
<br>
Thanks in advance,<br>
Dennis<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://vtk.1045678.n5.nabble.com/void-vtkCamera-SetPosition-crashed-tp5735862.html" rel="noreferrer" target="_blank">http://vtk.1045678.n5.nabble.com/void-vtkCamera-SetPosition-crashed-tp5735862.html</a><br>
Sent from the VTK - Dev mailing list archive at Nabble.com.<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtk-developers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=vtk-developers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtk-developers" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/vtk-developers</a><br>
<br>
</blockquote></div><br></div>