[vtk-developers] [vtkusers] 3D line and coordinate system

Yumin Yuan yumin.yuan at kitware.com
Thu Jan 10 13:44:16 EST 2013


Ok, from the email you sent to Sankhesh, I now understand what you try
to do (and this seems to be similar to the other email thread I just
replied)

I think what you need is  vtkPlane::ProjectPoint(...)
  // Project a point x onto plane defined by origin and normal. The
  // projected point is returned in xproj. NOTE : normal assumed to
  // have magnitude 1.
  static void ProjectPoint(double x[3], double origin[3], double normal[3],
                           double xproj[3]);

In your case, do the same for world_coordinate1, then to get the
second point, you can try

vtkPlane::ProjectPoint(world_coordinate1, camera->GetFocalPoint(),
camera->GetViewPlaneNormal(), world_coordinate2);

HTH,
Yumin

On Thu, Jan 10, 2013 at 9:04 AM, Yumin Yuan <yumin.yuan at kitware.com> wrote:
> Which version of VTK is this?
>
> You can try to add the following after setting the two line points.
>
> line->Update();
>
> Yumin
>
> On Thu, Jan 10, 2013 at 3:47 AM, Pengdong Xiao <xiaopd at hotmail.com> wrote:
>> Hi Yumin,
>>
>> Thank you very much for your e-mail. After I change the following:
>>
>> display1[2] = 0 ;
>>
>> the problem still exists. After I click mouse, a line will be drawn, but it
>> isn't perpendicular to the screen; and each time the length is different.
>> Any other suggestions? Many thanks.
>>
>> Best regards,
>> Pengdong
>>
>>> Date: Wed, 9 Jan 2013 10:31:29 -0500
>>> Subject: Re: [vtkusers] 3D line and coordinate system
>>> From: yumin.yuan at kitware.com
>>> To: xiaopd at hotmail.com
>>> CC: vtkusers at vtk.org; vtk-developers at vtk.org
>>
>>>
>>> The VTK display coordinates' z range is 0 to 1, try this:
>>>
>>> display1[2] = 0 ;
>>>
>>> HTH,
>>> Yumin
>>>
>>> On Mon, Jan 7, 2013 at 9:16 PM, Pengdong Xiao <xiaopd at hotmail.com> wrote:
>>> > display1[2] = -1 ;



More information about the vtk-developers mailing list