<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-2">
<META content="MSHTML 6.00.2800.1106" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff><FONT face=Arial size=2>
<DIV>To move any object in 3D Space </DIV>
<DIV>I do fallowing things:</DIV>
<DIV>&nbsp;</DIV>
<DIV>{</DIV>
<DIV>&nbsp;// l1p1 , l1p2 two poits defining line (ray) in which the object is 
on start</DIV>
<DIV>&nbsp;// l3p1 , l3p2 two poits defining line (ray) in which the object is 
on end</DIV>
<DIV>&nbsp;// l2p1 , l2p2 two poits defining line&nbsp;(direction of 
movment)&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;float&nbsp;&nbsp;&nbsp;*l1p1, *l1p2, *l2p1, *l2p2, *l3p1, *l3p2, 
delta[3], v[3];<BR></DIV>
<DIV>&nbsp;float&nbsp;&nbsp;position1[3], position2[3], position3[3], 
position4[3];<BR></DIV>
<DIV>&nbsp;// we define vector of movement</DIV>
<DIV>&nbsp;vtkGeometric::Vector(capitalaxisActorMain-&gt;GetCenter(), 
capitalaxisActorMain-&gt;GetPosition(), v);</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;l1p1 = RenderPanelMain-&gt;lastpickedpoint;&nbsp;//&nbsp;point in 3D 
where we start picking<BR>&nbsp;l1p2 = 
RenderPanelMain-&gt;pointbehindlastpickedpoint; // point behinde (i.e. i Z deph 
+1) that point but on the line (ray)</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;// we move vector in 3D space (creating a line)</DIV>
<DIV>&nbsp;l2p1 = 
capitalaxisActorMain-&gt;GetPosition();<BR>&nbsp;vtkGeometric::MoveVector(v, 
l2p1);<BR>&nbsp;l2p2 = v;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;// calculating object's position on line (l2p1, l2p2);</DIV>
<DIV>&nbsp;vtkGeometric::CrossLinePoints(l1p1, l1p2, l2p1, l2p2, position1, 
position2);</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;l3p1 = RenderPanelMain-&gt;earlierpickedpoint; //&nbsp;point in 3D 
where we stop picking<BR>&nbsp;l3p2 = 
RenderPanelMain-&gt;pointbehindearlierpickedpoint; // point behinde (i.e. i Z 
deph +1) that point but on the line (ray)</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;// calculating object's position on line (l2p1, l2p2);</DIV>
<DIV>&nbsp;vtkGeometric::CrossLinePoints(l3p1, l3p2, l2p1, l2p2, position3, 
position4);</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;// calculating shift;<BR>&nbsp;delta[0] = position2[0] - 
position4[0];<BR>&nbsp;delta[1] = position2[1] - position4[1];<BR>&nbsp;delta[2] 
= position2[2] - position4[2];<BR></DIV>
<DIV>&nbsp;// changing position</DIV>
<DIV>&nbsp;capitalplaneActorMain-&gt;AddPosition(delta); 
<BR>&nbsp;capitalaxisActorMain-&gt;AddPosition(delta);</DIV>
<DIV>}</DIV>
<DIV>&nbsp;</DIV>
<DIV>void vtkGeometric::MoveVector(float v[3], float 
point[3])<BR>{<BR>&nbsp;v[0] += point[0];<BR>&nbsp;v[1] += 
point[1];<BR>&nbsp;v[2] += point[2];<BR>}</DIV>
<DIV>&nbsp;</DIV>
<DIV>void vtkGeometric::Vector(float p1[3], float p2[3], float 
v[3])<BR>{<BR>&nbsp;v[0] = p1[0]-p2[0];<BR>&nbsp;v[1] = 
p1[1]-p2[1];<BR>&nbsp;v[2] = p1[2]-p2[2];<BR>}</DIV>
<DIV><BR>bool vtkGeometric::CrossLinePoints(float l1p1[3], float l1p2[3], float 
l2p1[3], float l2p2[3], float pointonl1[3], float 
pointonl2[3])<BR>{<BR>&nbsp;float v1[3], v2[3], v3[3], normal[3], t;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;Vector(l1p1, l1p2, v1);<BR>&nbsp;Vector(l2p1, l2p2, v2);</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;vtkMath::Cross(v1, v2, v3);</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;if ((v3[0] == 0.0) &amp;&amp; (v3[1] == 0.0) &amp;&amp; (v3[2] == 
0.0))<BR>&nbsp;&nbsp;return false;&nbsp; // the lines are parallel</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;vtkMath::Cross(v3, v2, 
normal);<BR>&nbsp;vtkMath::Normalize(normal);<BR>&nbsp;vtkPlane::IntersectWithLine(l1p1, 
l1p2, normal, l2p1, t, pointonl1);</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;vtkMath::Cross(v3, v1, 
normal);<BR>&nbsp;vtkMath::Normalize(normal);<BR>&nbsp;vtkPlane::IntersectWithLine(l2p1, 
l2p2, normal, l1p1, t, pointonl2);</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;return true;<BR>}</DIV>
<DIV>&nbsp;</DIV>
<DIV>I hope it would help.</DIV>
<DIV>&nbsp;</DIV>
<DIV>micha³</FONT></DIV></BODY></HTML>