[vtkusers] OfficeTubes.tcl - TCL vs. C++ Anomaly

Amy Squillacote amy.squillacote at kitware.com
Tue Sep 6 10:47:47 EDT 2005


The difference you are seeing has nothing to do with 
typecasting.  The reason (as you guessed in your last e-mail to the 
list) is that the positions of the points inside the sphere produced 
by vtkPointSource are chosen randomly.  From the header file for that class:

// By default location of the points is random within the sphere. It is
// also possible to generate random points only on the surface of the
// sphere.

In the officeTube.tcl example (in 
VTK/Examples/VisualizationAlgorithms/Tcl), vtkStreamLine is using a 
single, explicitly-specified point to produce a streamline.  In 
officeTubes.tcl (in the same source code directory), vtkPointSource 
is being used to randomly select 6 points within a sphere with a 
radius of 0.15, so the points won't necessarily be exactly the 
same.  Do you get the same results each time you run the 
officeTubes.tcl Tcl script?

- Amy

At 04:10 AM 9/5/2005, Divya Rathore wrote:
>Just a thought..
>
>Could it be that straight typecasting to (vtkDataSet *)  as in:
>
>streamer->SetSource((vtkDataSet *)seeds->GetOutput());
>
>be causing the problem? To be noted is that SetSource accepts 
>vtkDataSet* and Getoutput returns vtkPolyData*
>
>warm regards,
>D. Rathore
>
>
>----- Original Message ----- From: "Divya Rathore" <divyaksr at iitk.ac.in>
>To: <vtkusers at vtk.org>
>Sent: Monday, September 05, 2005 12:59 PM
>Subject: [vtkusers] OfficeTubes.tcl - TCL vs. C++ Anomaly
>
>
>>Dear Folks,
>>
>>    Kindly excuse me for re-posting this mail but I wanted to get 
>> clarified about a few doubts of mine. It would be really nice if 
>> some user or somebody form Kitware could attend to this problem of mine.
>>
>>I tried to convert officeTubes.tcl to a C++ program using MS VC++ 
>>6.0. It seems that the C++ version gets different start points than 
>>the TCL version and hence the stream-tubes.
>>
>>I digged further and found that 'officeTube.tcl' when converted to 
>>C++ works perfectly fine. So we see that the following lines in 
>>'officeTubes.tcl' could be causing the problem:
>>
>>-----
>>vtkPointSource seeds
>>    seeds SetRadius 0.15
>>    eval seeds SetCenter 0.1 2.1 0.5
>>    seeds SetNumberOfPoints 6
>>..
>>..
>>..
>>vtkStreamLine streamer
>>    streamer SetInput [reader GetOutput]
>>    streamer SetSource [seeds GetOutput]
>>-----
>>
>>How exactly does the class vtkPointSource generates 6 points inside 
>>a sphere of given center and radius? Is it random? If so, is that 
>>what is causing the problem in TCL to C++ conversion of 
>>'officeTubes.tcl' and and that 'officeTube.tcl' doesn't use this makes it work?
>>
>>It would be really nice if some user or somebody form Kitware could 
>>attend to this problem of mine and suggest a solution.
>>
>>warm regards,
>>D. Rathore
>>
>>
>>
>>
>>----- Original Message ----- From: "Divya Rathore" <divyaksr at iitk.ac.in>
>>To: <vtkusers at vtk.org>
>>Sent: Saturday, September 03, 2005 3:02 AM
>>Subject: [vtkusers] TCL vs. C++
>>
>>Dear Users,
>>
>>    We tried to convert a TCL script to C++ regarding StreamTubes [Examples
>> >> VisualizationAlgorithms >> TCL >> officeTubes.tcl]. What we found is
>>that
>>the results are different.
>>
>>Kindly suggest corrections in our code, if any. See attached lines of code.
>>
>>
>>warm regards,
>>- D. Rathore
>>- G. Bayu
>>
>>--
>>
>>
>>The lines of code which we feel are causing the problem are:
>>******************
>>officeTubes.TCL
>>******************
>>
>>vtkPointSource seeds
>>    seeds SetRadius 0.15
>>    eval seeds SetCenter 0.1 2.1 0.5
>>    seeds SetNumberOfPoints 6
>>vtkRungeKutta4 integ
>>vtkStreamLine streamer
>>    streamer SetInput [reader GetOutput]
>>    streamer SetSource [seeds GetOutput]
>>    streamer SetMaximumPropagationTime 500
>>    streamer SetStepLength 0.5
>>    streamer SetIntegrationStepLength 0.05
>>    streamer SetIntegrationDirectionToIntegrateBothDirections
>>    streamer SetIntegrator integ
>>
>>
>>
>>
>>******************
>>Following is our converted C++ code.
>>******************
>>
>>vtkPointSource *seeds = vtkPointSource::New();
>>seeds->SetRadius(0.15);
>>seeds->SetCenter(0.1, 2.1, 0.5);
>>seeds->SetNumberOfPoints(6);
>>
>>vtkRungeKutta4 *integ = vtkRungeKutta4::New();
>>vtkStreamLine *streamer = vtkStreamLine::New();
>>streamer->SetInput(reader->GetOutput());
>>
>>streamer->SetSource((vtkDataSet *)seeds->GetOutput());
>>
>>streamer->SetMaximumPropagationTime(500);
>>streamer->SetStepLength(0.5);
>>streamer->SetIntegrationStepLength(0.05);
>>streamer->SetIntegrationDirectionToIntegrateBothDirections();
>>streamer->SetIntegrator(integ);
>>
>>
>>
>>
>>_______________________________________________
>>This is the private VTK discussion list. Please keep messages 
>>on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>>Follow this link to subscribe/unsubscribe:
>>http://www.vtk.org/mailman/listinfo/vtkusers
>
>
>_______________________________________________
>This is the private VTK discussion list. Please keep messages 
>on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>Follow this link to subscribe/unsubscribe:
>http://www.vtk.org/mailman/listinfo/vtkusers




More information about the vtkusers mailing list