<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 10 (filtered)">
<style>
<!--body
        {overflow-y:auto;
        overflow-x:auto;}
/* Font Definitions */
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:blue;
        text-decoration:underline;}
p
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
span.EmailStyle18
        {font-family:Arial;
        color:navy;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.Section1
        {page:Section1;}
-->
</style>
<style>
p.MsoNormal
        {margin-left:2.25pt;}
</style>
</head>
<body lang=EN-US link=blue vlink=blue style='margin-left:2.25pt;margin-top:
2.25pt;margin-right:2.25pt;margin-bottom:2.25pt'>
<div class=Section1>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Hi Jacques,</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> </span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>On a very quick look, check</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> </span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> </span></font><font size=1
face=Arial><span style='font-size:9.0pt;font-family:Arial'> currentMapper->SetScalarModeToUseCellData();
</span></font></p>
<p class=MsoNormal><font size=1 face=Arial><span style='font-size:9.0pt;
font-family:Arial'><br>
</span></font><font size=2 color=navy face=Arial><span style='font-size:10.0pt;
font-family:Arial;color:navy'>Did you mean point data?</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> </span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>HTH </span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>John.</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> </span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> </span></font></p>
<p class=MsoNormal style='margin-left:36.0pt'><font size=2 face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma'>-----Original Message-----<br>
<b><span style='font-weight:bold'>From:</span></b> vtkusers-bounces@vtk.org
[mailto:vtkusers-bounces@vtk.org] <b><span style='font-weight:bold'>On Behalf
Of </span></b>jacques.charreyron<br>
<b><span style='font-weight:bold'>Sent:</span></b> </span></font><font size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>21 February
2005</span></font><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'> </span></font><font size=2 face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma'>10:25</span></font><font size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'><br>
<b><span style='font-weight:bold'>To:</span></b> vtkusers@vtk.org<br>
<b><span style='font-weight:bold'>Subject:</span></b> [vtkusers] Quadratic cell
data bug ?</span></font></p>
<p class=MsoNormal style='margin-left:36.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'> </span></font></p>
<div>
<p class=MsoNormal style='margin-left:36.0pt'><font size=1 face=Arial><span
style='font-size:9.0pt;font-family:Arial'>Hello,<br>
<br>
<br>
I am trying to display values on quadratic cells. In my example I have one
quadratic quad cell <br>
I allocate only one tuple in my float array and put an arbitrary value :<br>
<br>
<br>
vtkFloatArray *pointScalars = vtkFloatArray::New();<br>
<br>
pointScalars->SetNumberOfComponents(1);<br>
pointScalars->SetNumberOfTuples(6);<br>
pointScalars->SetTuple1(0,10.0);<br>
grid->GetCellData()->SetScalars(pointScalars);<br>
<br>
When running this example I get this error :<br>
<br>
ERROR: In G:\Sandbox\Shared\common\intel_a\Api\Vtk\R4.4\Src\Common\vtkDataSet.cxx,
line 403<br>
vtkPolyData (0x01BADF98): Cell array with 1 components, has only 0 tuples
but there are 6 cells<br>
<br>
When I allocate six tuples to put six value : ie one for each triangle like
this :<br>
<br>
vtkFloatArray *pointScalars = vtkFloatArray::New();<br>
<br>
pointScalars->SetNumberOfComponents(1);<br>
pointScalars->SetNumberOfTuples(6);<br>
pointScalars->SetTuple1(0,10.0);<br>
pointScalars->SetTuple1(1,10.0);<br>
pointScalars->SetTuple1(2,10.0);<br>
pointScalars->SetTuple1(3,10.0);<br>
pointScalars->SetTuple1(4,10.0);<br>
pointScalars->SetTuple1(5,10.0);<br>
<br>
<br>
grid->GetCellData()->SetScalars(pointScalars);<br>
<br>
<br>
I get the following error :<br>
<br>
Warning: In
G:\Sandbox\Shared\common\intel_a\Api\Vtk\R4.4\Src\Common\vtkDataSet.cxx, line
411<br>
vtkUnstructuredGrid (0x01B8CB00): Cell array with 1 components, has 6
tuples but there are only 1 cells<br>
<br>
ERROR: In
G:\Sandbox\Shared\common\intel_a\Api\Vtk\R4.4\Src\Common\vtkDataSet.cxx, line
403<br>
vtkPolyData (0x01BADF98): Cell array with 1 components, has only 0 tuples
but there are 6 cells<br>
<br>
<br>
<br>
Any idea ?<br>
<br>
<br>
<br>
Here is a code snippet to reproduce the behaviour :<br>
<br>
<br>
#include <vtkActor.h><br>
#include <vtkCellType.h><br>
#include <vtkDataSetMapper.h><br>
#include <vtkInteractorStyleTrackballCamera.h><br>
#include <vtkPoints.h><br>
#include <vtkProperty.h><br>
#include <vtkRenderer.h><br>
#include <vtkRenderWindow.h><br>
#include <vtkRenderWindowInteractor.h><br>
#include <vtkUnstructuredGrid.h><br>
#include <vtkWindowToImageFilter.h><br>
#include <vtkInteractorStyleTrackballCamera.h><br>
#include <vtkActor2D.h><br>
#include <vtkLabeledDataMapper.h><br>
#include <vtkLookupTable.h><br>
#include <vtkFloatArray.h><br>
#include <vtkPointData.h><br>
#include <vtkMath.h><br>
#include <vtkScalarBarWidget.h><br>
#include <vtkScalarBarActor.h><br>
#include <vtkLookupTable.h><br>
#include <vtkTexture.h><br>
#include <vtkStructuredPoints.h><br>
#include <vtkBandedPolyDataContourFilter.h><br>
#include <vtkGeometryFilter.h><br>
#include <vtkPolyDataMapper.h><br>
#include <vtkCellData.h><br>
int main( int argc, char *argv[] )<br>
{<br>
<br>
vtkPoints *points = vtkPoints::New();<br>
points->SetNumberOfPoints(8);<br>
<br>
points->SetPoint(0,
0, 0,
0);<br>
points->SetPoint(1,
1, 0,
0);<br>
points->SetPoint(2,
1, 1,
0);<br>
points->SetPoint(3,
0, 1,
0);<br>
points->SetPoint(4, 0.5,
0, 0);<br>
points->SetPoint(5,
1, 0.5, 0);<br>
points->SetPoint(6,
0.5, 1, 0);<br>
points->SetPoint(7,
0, 0.5, 0);<br>
<br>
<br>
vtkIdType pointIds[8];<br>
<br>
pointIds[0] = 0;<br>
pointIds[1] = 1;<br>
pointIds[2] = 2;<br>
pointIds[3] = 3;<br>
pointIds[4] = 4;<br>
pointIds[5] = 5;<br>
pointIds[6] = 6;<br>
pointIds[7] = 7;<br>
<br>
<br>
<br>
<br>
<br>
//--------------<br>
// Quad grid<br>
//--------------<br>
<br>
vtkUnstructuredGrid* grid =
vtkUnstructuredGrid::New();<br>
grid->Allocate(1);<br>
grid->SetPoints(points);<br>
grid->InsertNextCell(VTK_QUADRATIC_QUAD,8,pointIds);<br>
<br>
<br>
// Point data (scalars)<br>
vtkFloatArray *pointScalars = vtkFloatArray::New();<br>
<br>
pointScalars->SetNumberOfComponents(1);<br>
pointScalars->SetNumberOfTuples(6);<br>
pointScalars->SetTuple1(0,10.0);<br>
<br>
grid->GetCellData()->SetScalars(pointScalars);<br>
<br>
// Lookup :<br>
vtkLookupTable *lookupTable = vtkLookupTable::New();<br>
lookupTable->SetNumberOfColors(10);<br>
lookupTable->SetTableRange(0.0,1.0);<br>
lookupTable->Build(); <br>
<br>
<br>
// Scalar bar actor<br>
vtkScalarBarWidget
*scalarBarWidget=vtkScalarBarWidget::New();<br>
vtkScalarBarActor *scalarBarActor =
vtkScalarBarActor::New();<br>
scalarBarActor->SetLookupTable(lookupTable);<br>
scalarBarWidget->SetScalarBarActor(scalarBarActor);<br>
scalarBarActor->SetMaximumNumberOfColors(10);<br>
<br>
<br>
// Mapper<br>
vtkDataSetMapper *currentMapper=vtkDataSetMapper::New();<br>
currentMapper->SetInput(grid);<br>
currentMapper->ScalarVisibilityOff();<br>
currentMapper->SetLookupTable(lookupTable);<br>
currentMapper->SetInterpolateScalarsBeforeMapping(1);<br>
currentMapper->SetScalarModeToUseCellData();<br>
<br>
<br>
// Actor<br>
vtkActor *quadActor = vtkActor::New();<br>
quadActor->SetMapper(currentMapper);<br>
<br>
<br>
<br>
//--------------<br>
// Visualization<br>
//-------------- <br>
// Renderer<br>
vtkRenderer *renderer= vtkRenderer::New();<br>
<br>
renderer->SetLightFollowCamera(true);<br>
renderer->SetBackground(0.6,0.7,0.9);<br>
renderer->AddActor(quadActor);<br>
renderer->AddActor(scalarBarActor);<br>
<br>
// RenderWindow<br>
vtkRenderWindow *renderWindow = vtkRenderWindow::New();<br>
renderWindow->AddRenderer(renderer);<br>
renderWindow->SetSize(300,300);<br>
<br>
// Interactor<br>
vtkRenderWindowInteractor *interactor = vtkRenderWindowInteractor::New();<br>
interactor->SetRenderWindow(renderWindow);<br>
<br>
// Interactor style<br>
vtkInteractorStyleTrackballCamera *interactorStyle =
vtkInteractorStyleTrackballCamera::New();<br>
interactor->SetInteractorStyle(interactorStyle);<br>
<br>
// Event loop<br>
interactor->Initialize();<br>
interactor->Start();<br>
<br>
<br>
<br>
return 0;<br>
}<br>
<br>
<br>
<br>
</span></font></p>
</br>
<p style='margin-right:0cm;margin-bottom:0cm;margin-left:36.0pt;margin-bottom:
.0001pt'><font size=1 face=Arial><span style='font-size:9.0pt;font-family:Arial'><img
width=32 height=32
src="http://premiummail.caramail.lycos.fr/Images/Mail/_icons/premium.gif"><b><font
color="#cc0000"><span style='color:#CC0000;font-weight:bold'>300 Mo gratuits
sur CaraMail : </span></font></b><a
href="http://secure.caramail.lycos.fr/services/signin/mail.jsp" target="_blank">Cliquez
ici pour en profiter!</a></span></font></p>
</div>
</div>
</body>
</html>