<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.16481" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV>You may mean ".... instead of 1.0 1.0 0.0", do you? If yes, I answer:
yes, <BR>i've tried and work OK, but I'm altering the cell's geometry. I'm using
a <BR>similar code to draw a curve line, and that was the solution I've found at
<BR>the moment: filtering the geometry data to normalized viewport values. But
<BR>it would be easier if GetPosition2Coordinate worked! In fact, it works OK
<BR>with vtkActor2D classes that are below it in the hierarchical tree. There's
<BR>could be a bug...<BR><BR><BR>> Hi Isidro,<BR>><BR>> Have you tried
setting your second point to 0.5, 0.5, 0 instead of 1.0, <BR>> 1.0,
1.0?<BR>><BR>> - Amy<BR>><BR>> Isidro Moreno
wrote:<BR>>> Hi! I think this method _definitely doesn't work_:
<BR>>>
vtkActor2D->GetPosition2Coordinate->SetValue(x,y,z).<BR>>>
This is my code (a simple straight line):<BR>>> /*This should draw a
diagonal in the left-bottom quarter of the window, <BR>>> but the diagonal
crosses the whole screen. If the commented lines below <BR>>> are enabled,
the behaviour it's the same*/<BR>>> #include
"vtkActor2D.h"<BR>>> #include "vtkRenderWindow.h"<BR>>> #include
"vtkRenderer.h"<BR>>> #include "vtkRenderWindowInteractor.h"<BR>>>
#include "vtkPolyDataMapper2D.h"<BR>>> #include
"vtkProperty2D.h"<BR>>> #include "vtkPolyData.h"<BR>>> #include
"vtkPoints.h"<BR>>> #include "vtkCellArray.h"<BR>>> #include
"vtkCamera.h"<BR>>> int main(int argc, char
*argv[]){<BR>>> vtkPolyData
*linea=vtkPolyData::New();<BR>>> vtkPoints
*puntos=vtkPoints::New();<BR>>> vtkCellArray
*lineas=vtkCellArray::New();<BR>>> vtkPolyDataMapper2D
*mapper=vtkPolyDataMapper2D::New();<BR>>>
vtkActor2D *actor=vtkActor2D::New();<BR>>>
vtkRenderer *render=vtkRenderer::New();<BR>>>
vtkRenderWindow
*ventana=vtkRenderWindow::New();<BR>>>
vtkRenderWindowInteractor
*interac=vtkRenderWindowInteractor::New();<BR>>>
vtkCoordinate *coor=vtkCoordinate::New();<BR>>>
lineas->InsertNextCell(2);<BR>>>
lineas->InsertCellPoint(0);<BR>>>
lineas->InsertCellPoint(1);<BR>>>
puntos->InsertPoint(0,0.0,0.0,0.0);<BR>>>
puntos->InsertPoint(1,1.0,1.0,0.0);<BR>>>
linea->SetPoints(puntos);<BR>>>
linea->SetLines(lineas);<BR>>>
coor->SetCoordinateSystemToNormalizedViewport();<BR>>>
mapper->SetInput(linea);<BR>>>
mapper->SetTransformCoordinate(coor);<BR>>>
actor->SetMapper(mapper);<BR>>>
actor->GetProperty()->SetColor(1.0,0.0,0.0);<BR>>> <BR>>>
actor->GetPositionCoordinate()->SetCoordinateSystemToNormalizedViewport();<BR>>>
<BR>>>
actor->GetPosition2Coordinate()->SetCoordinateSystemToNormalizedViewport();<BR>>>
//actor->GetPosition2Coordinate()->SetReferenceCoordinate(NULL);<BR>>>
actor->GetPositionCoordinate()->SetValue(0.0,0.0,0.0);<BR>>>
actor->GetPosition2Coordinate()->SetValue(0.5,0.5,0.0);
//ĦĦĦHere!!!<BR>>>
render->AddActor2D(actor);<BR>>>
render->SetBackground(0.1,0.2,0.4);<BR>>> //
render->ResetCamera();<BR>>> //
render->ResetCameraClippingRange();<BR>>>
ventana->AddRenderer(render);<BR>>>
interac->SetRenderWindow(ventana);<BR>>>
ventana->Render();<BR>>>
interac->Start();<BR>>>
linea->Delete();<BR>>>
puntos->Delete();<BR>>>
lineas->Delete();<BR>>>
mapper->Delete();<BR>>>
actor->Delete();<BR>>>
render->Delete();<BR>>>
ventana->Delete();<BR>>>
interac->Delete();<BR>>>
coor->Delete();<BR>>> return 0;}<BR></DIV></BODY></HTML>