So I figured out the problem . If I do InsetComponent instead of SetComponent it works without crashing . <br><br>So I guess the problem was I did not Allocate the Space before doing SetComponent .<br><br>Regards<br>Darshan<br>
<br><div class="gmail_quote">On Thu, Mar 25, 2010 at 1:19 AM, Darshan Pai <span dir="ltr">&lt;<a href="mailto:darshanpai@gmail.com">darshanpai@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Added a compilable version here . Please check . I am clueless<br><br>#include &lt;vtkActor.h&gt;<br>#include &lt;vtkRenderer.h&gt;<br>#include &lt;vtkRenderWindow.h&gt;<br>#include &lt;vtkRenderWindowInteractor.h&gt;<br>
#include &lt;vtkSmartPointer.h&gt;<br>
#include &lt;vtkDoubleArray.h&gt;<br>#include &lt;vtkPoints.h&gt;<br>#include &lt;vtkCellArray.h&gt;<br>#include &lt;vtkPolyDataMapper.h&gt;<br>#include &lt;vtkPolydata.h&gt;<br>#include &lt;iostream&gt;<br>#include &lt;fstream&gt;<br>

#include &lt;vtkProperty.h&gt;<br>#include &lt;vtkPointData.h&gt;<br><br>int main()<br>{<br>    vtkPoints *points = vtkPoints::New();<br>    vtkCellArray *lines = vtkCellArray::New();<br>    vtkPolyData *indata = vtkPolyData::New();<br>

    vtkPolyDataMapper *mapper = vtkPolyDataMapper::New();<br>    vtkActor* fiber_actor = vtkActor::New();<br>    vtkDoubleArray *dbar = vtkDoubleArray::New();<br><br>    dbar-&gt;SetNumberOfTuples(10);<br>    dbar-&gt;SetNumberOfComponents(9);<br>

    points-&gt;SetNumberOfPoints(10);<br>    lines-&gt;SetNumberOfCells(10);<br><br>    points-&gt;InsertPoint(0,101.822,56.87,64.0516);<br>    points-&gt;InsertPoint(1,101.844,57.7007,64.5);<br>    points-&gt;InsertPoint(2,101.818,57.81,64.4116);<br>

    points-&gt;InsertPoint(3,101.497,58.75,63.6901);<br>    points-&gt;InsertPoint(4,101.147,59.69,63.0351);<br>    points-&gt;InsertPoint(5,101.05,60.0038,62.8423);<br>    points-&gt;InsertPoint(6,100.88,60.63,62.4272);<br>

    points-&gt;InsertPoint(7,100.701,61.57,61.9138);<br>    points-&gt;InsertPoint(8,100.609,62.3104,61.5);<br>    points-&gt;InsertPoint(9,100.591,62.51,61.3388);<br>    indata-&gt;SetPoints(points);<br><br>    for (int j = 0; j &lt; 10 - 1; j++)<br>

    {<br>        lines-&gt;InsertNextCell(2);<br>        lines-&gt;InsertCellPoint(j);<br>        lines-&gt;InsertCellPoint(j+1);<br>    }<br>    indata-&gt;SetLines(lines);<br>    for (int i = 0; i &lt; 10; i++)<div class="im">
<br>    {<br>
        dbar-&gt;SetComponent(i,0,1);<br>        dbar-&gt;SetComponent(i,1,1);<br></div>        dbar-&gt;SetComponent(i,2,1);<br>        dbar-&gt;SetComponent(i,3,1);<br>        dbar-&gt;SetComponent(i,4,1);<br>        dbar-&gt;SetComponent(i,5,1);<br>

        dbar-&gt;SetComponent(i,6,1);<br>        dbar-&gt;SetComponent(i,7,1);<br>        dbar-&gt;SetComponent(i,8,1);<br>    }<br>    indata-&gt;GetPointData()-&gt;SetTensors(dbar);<br>    mapper-&gt;SetInput(indata);<br>

<br>    fiber_actor-&gt;SetMapper(mapper);<br>    fiber_actor-&gt;GetProperty()-&gt;SetLineWidth(3.0);<br>    vtkSmartPointer&lt;vtkRenderer&gt; renderer = vtkSmartPointer&lt;vtkRenderer&gt;::New();<br>    renderer-&gt;AddActor(fiber_actor);<br>

    vtkSmartPointer&lt;vtkRenderWindow&gt; renderWindow = vtkSmartPointer&lt;vtkRenderWindow&gt;::New();<br>     renderWindow-&gt;AddRenderer( renderer );<br>     renderWindow-&gt;SetSize(1000,1000);<br> <br>    vtkSmartPointer&lt;vtkRenderWindowInteractor&gt; interactor =<br>

        vtkSmartPointer&lt;vtkRenderWindowInteractor&gt;::New();<br>     interactor-&gt;SetRenderWindow( renderWindow );<br> <br>  // Initialize the event loop and then start it<br>    interactor-&gt;Initialize();<br>     interactor-&gt;Start(); <br>
<div><div></div><div class="h5">
}<br><br><div class="gmail_quote">On Wed, Mar 24, 2010 at 7:25 PM, David Doria <span dir="ltr">&lt;<a href="mailto:daviddoria%2Bvtk@gmail.com" target="_blank">daviddoria+vtk@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

<div class="gmail_quote"><div><div></div><div>On Wed, Mar 24, 2010 at 6:46 PM, Darshan Pai <span dir="ltr">&lt;<a href="mailto:darshanpai@gmail.com" target="_blank">darshanpai@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
I am trying to make a polydata composed of polylines , I am planning to add tensor information at each of the points .<br>i want to make a EllipsoidTensorProbeRepresentation which will add this polyline as a trajectory so that I can get an <br>



ellipsoid representation across the polyline.<br><br>My main problem is adding the tensor.<br>I did the following<br><br>vtkDoubleArray *dbar = vtkDoubleArray::New();<br>dbar-&gt;SetNumberOfValues(size);<br>dbar-&gt;SetNumberOfComponents(9);<br>



<br>The for each point I add the 9 components using the following function<br><br>dbar-&gt;SetComponent(i,0,1)<br>dbar-&gt;SetComponent(i,1,1);<br>.............. and so on <br><br>When I try to add it to the polydata though <br>



indata-&gt;GetPointData()-&gt;SetTensors(dbar);<br><br>It crashes .<br><br>I am not sure where I am going wrong <br><br>Please Help<br><font color="#888888"><br>Darshan<br><br></font></blockquote><div class="gmail_quote">


<br></div></div></div><div class="gmail_quote">Can you make the smallest compilable example that demonstrates this behavior and post it to the list?</div><br clear="all">Thanks,<br><br><div>David </div></div><br>
</blockquote></div><br>
</div></div></blockquote></div><br>