Changing the camera position

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Changing the camera position

Rhys Thomas
Hello,
   
    I was wondering if anyone knows an easy way of changing the camera
position in vtk by supplying a 16 element double-type matrix. My current
efforts result in some odd behaviour, and as such I am not entirely sure
of the correctness of, my code (plus it is a mess) so I have not added
it to this message. I am currently programming in C++ using Visual
Studio 6 (i.e. in Windows).

Thank You

Rhys
_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

vtkFixedPointVolumeRayCastMapper problem

Heye ZHANG
Dear all,

I run again one problem of vtkFixedPointVolumeRaycastMapper.

First

I generate
vtkImageData* id= vtkImageData::New();
id->SetDimensions(init_vtk3d.ndiv[0]+1,init_vtk3d.ndiv[1]+1,init_vtk3d.ndiv[2]+1);
id->SetScalarTypeToUnsignedShort();
id->SetNumberOfScalarComponents(2);
id->AllocateScalars();
id->SetSpacing(x_inc,y_inc,z_inc);
id->SetOrigin(x_start+length/2,y_start+width/2,z_start+height/2);
printf("origin:%lf,%lf,%lf\n",x_start+length/2,y_start+width/2,z_start+height/2);
unsigned short *ptr= (unsigned short*) id->GetScalarPointer();

then I use loop to initialize the "id":
  for(i=0;i<=init_vtk3d.ndiv[2];i++)
  {
   for(j=0;j<=init_vtk3d.ndiv[1];j++)
   {
    for(k=0;k<=init_vtk3d.ndiv[0];k++)
    {
       fread(coor_pos,3,sizeof(double),vtkcoor_handle);
       fread(ptr,1,sizeof(unsigned short),vtkdata_handle);
       if(coor_pos[1]<=-5)//---auck heart
        *ptr=0;

        ptr++;
       *ptr=*(ptr-1);
       ptr++;
    }
   }
  }
As I understand. I think 2 compoment data should be placed point by point in
this way : compoment1 of point1,compoment1 of point1,compoment1 of
point2,compoment1 of point2..... So If two components are the same,
vtkFixedPointVolumeRaycastMapper should provide the same result as one
compoment data.

those are other setting:
 volumeProperty->SetColor(color);
 volumeProperty->SetGradientOpacity(opacity1);
 volumeProperty->SetScalarOpacity(opacity);
 volumeProperty->SetInterpolationTypeToLinear();

 volumeProperty->SetAmbient(0.6);
 volumeProperty->SetDiffuse(0.6);
 volumeProperty->ShadeOn();

  volumeMapper->SetInput(id);

But finially I cannot get what I want.  the Geometry I want is inside a
black box,but I think that black color should be transparent because I have
set the opacity . I snap a figure and attach here. Please let me know you
have a solution of my problem. Thanks

_______________________________________________
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

untitled.JPG (20K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

picking points in VTK, C++ version...help!!!

Gilbert Mensah
Can anybody help me with how to pick points and get
global cordinates of a fine element mesh using
c++,there was an example in tcl,i tried following
it,but doesn't work when i code in the c++ version.Any
help is welcome.Thx

-Gilbert
_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

annotatepick.tcl to annotatepick.cxx

Gilbert Mensah
Can anyone help me convert annotatepick.tcl to
annotatepick.cxx.
I tried doing it but i'm having problems with how
AddObserver works in c++,that is passing that
annotatepick function as they did PROC annotatepick in
tcl.Really need your help.Thanks

-GIlbert
_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: annotatepick.tcl to annotatepick.cxx

Obada Mahdi
Hi Gilbert!

On Thu, 19 Jan 2006, Gilbert Mensah wrote:
> I tried doing it but i'm having problems with how
> AddObserver works in c++,that is passing that
> annotatepick function as they did PROC annotatepick in
> tcl.Really need your help.Thanks

The AddObserver method expects a vtkCommand-compatible instance, whose
`Execute' method is invoked when the event is dispatched.  To get your own
function called, you can set up a `vtkCallbackCommand' accordingly and pass it
to `AddObserver':

| picker = vtkCellPicker::New();
| annotatePickCallback = vtkCallbackCommand::New();
| annotatePickCallback->SetCallback(annotatePick);
| annotatePickCallback->SetClientData(this);
| picker->AddObserver(vtkCommand::EndPickEvent, annotatePickCallback);

where `annotatePickCallback' is your own function, which has to accept four
parameters, one of which is set to whatever you provided via `SetClientData'.
This mechanism is needed to pass custom data to your callback function.

> Can anyone help me convert annotatepick.tcl to
> annotatepick.cxx.

I have attached a C++ version of "annotatePick.tcl".

Feel free to contact me directly for further questions.


Regards

Obada
_______________________________________________
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

annotatePick.cc (6K) Download Attachment