<div dir="ltr">To fundamentally change the shape from a cube, you'll need to discretize the cube to have more than just the 6 faces that define the initial cube.<div><br></div><div>First, triangulate the cube with vtkTriangleFilter, then use vtkLinearSubdivisionFilter to add triangles. You should have better luck.</div><div><br></div><div>HTH,</div><div>Cory</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Oct 27, 2017 at 7:55 PM, alican <span dir="ltr"><<a href="mailto:alican1812@hotmail.com" target="_blank">alican1812@hotmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I need  to apply kind of  "pinch" to vtkCubeSource, to make it look like half<br>
cylinder. I have thought to use warpScalar for that, however, no matter what<br>
I try I just can't get it working. The cube remains exactly as it was.<br>
<br>
Can anybody  spot a problem in my code? Thanks,<br>
AC<br>
<br>
void warpTest()<br>
{<br>
        vtkSmartPointer<vtkCubeSource> cubeSource =<br>
vtkSmartPointer<vtkCubeSource><wbr>::New();<br>
        cubeSource->SetXLength(50);<br>
        cubeSource->SetYLength(10);<br>
        cubeSource->SetZLength(1);<br>
        cubeSource->SetCenter(0,0,0);<br>
        cubeSource->Update();<br>
        vtkPolyData* polydata = cubeSource->GetOutput();<br>
<br>
        vtkSmartPointer<<wbr>vtkDoubleArray> scalars =<br>
vtkSmartPointer<<wbr>vtkDoubleArray>::New();<br>
        polydata->GetPointData()-><wbr>SetScalars(scalars);<br>
        int numOfPoints = polydata->GetNumberOfPoints();<br>
        scalars->SetNumberOfTuples(<wbr>numOfPoints);<br>
        for (vtkIdType i = 0; i < numOfPoints ; ++i)<br>
        {<br>
                scalars->SetTuple1(i, 200);<br>
        }<br>
<br>
        vtkSmartPointer<<wbr>vtkPolyDataNormals> normalGenerator =<br>
vtkSmartPointer<<wbr>vtkPolyDataNormals>::New();<br>
        normalGenerator->SetInputData(<wbr>polydata);<br>
        normalGenerator-><wbr>ComputePointNormalsOn();<br>
        normalGenerator-><wbr>ComputeCellNormalsOff();<br>
        normalGenerator->Update();<br>
<br>
        vtkSmartPointer<vtkWarpScalar> warpScalar =<br>
vtkSmartPointer<vtkWarpScalar><wbr>::New();<br>
        warpScalar->SetInputData(<wbr>normalGenerator->GetOutput());<br>
        warpScalar->SetScaleFactor(1); // use the scalars themselves<br>
        warpScalar->Update();<br>
<br>
        vtkSmartPointer<<wbr>vtkPolyDataMapper> mapper =<br>
vtkSmartPointer<<wbr>vtkPolyDataMapper>::New();<br>
        mapper->SetInputConnection(<wbr>warpScalar->GetOutputPort());<br>
<br>
        vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::<wbr>New();<br>
        actor->GetProperty()-><wbr>SetColor(1.0, 1.0, 0.0);<br>
        actor->SetMapper(mapper);<br>
<br>
        vtkSmartPointer<<wbr>vtkPolyDataMapper> smapper =<br>
vtkSmartPointer<<wbr>vtkPolyDataMapper>::New();<br>
        smapper->SetInputData(<wbr>polydata);<br>
<br>
        vtkSmartPointer<vtkActor> sactor = vtkSmartPointer<vtkActor>::<wbr>New();<br>
        sactor->GetProperty()-><wbr>SetColor(1.0, 0.0, 1.0);<br>
        sactor->SetMapper(smapper);<br>
<br>
        // Visualize<br>
        getRenderer()->AddActor(actor)<wbr>;<br>
        getRenderer()->AddActor(<wbr>sactor);<br>
<br>
<br>
<br>
--<br>
Sent from: <a href="http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html" rel="noreferrer" target="_blank">http://vtk.1045678.n5.nabble.<wbr>com/VTK-Users-f1224199.html</a><br>
______________________________<wbr>_________________<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/<wbr>opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_<wbr>FAQ</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=<wbr>vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/vtkusers</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Cory Quammen<br>Staff R&D Engineer<br>Kitware, Inc.</div>
</div>