<div>Hello,</div><div><br></div><div>I have a GroupType phantom, containing some ellipses. I have applied a transform to the phantom group:</div><div><br></div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">
<div><div><font class="Apple-style-span" face="'courier new', monospace">phantom->GetObjectToWorldTransform()->SetMatrix(transform->GetMatrix());</font><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" face="'courier new', monospace">        </font></span></div>
</div></blockquote><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><div><font class="Apple-style-span" face="'courier new', monospace">phantom->GetObjectToWorldTransform()->SetOffset(transform->GetOffset());</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace">phantom->ComputeObjectToWorldTransform();</font></div></blockquote><div><br></div><div>Now I try the transform to se if it produces reasonable results:</div>
<div><br></div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><div><font class="Apple-style-span" face="'courier new', monospace">EllipseType::PointType point;</font></div>
</blockquote><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"></blockquote>
<font class="Apple-style-span" face="'courier new', monospace">point[0] = -25/sqrt(2.0);</font></blockquote><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"></blockquote>
<blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><font class="Apple-style-span" face="'courier new', monospace">point[1] = 25/sqrt(2.0);</font></blockquote><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">
<div><font class="Apple-style-span" face="'courier new', monospace">point[2] = -47.5;</font></div></blockquote><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">
<div>
<font class="Apple-style-span" face="'courier new', monospace">EllipseType::PointType point2 = phantom->GetObjectToWorldTransform()->TransformPoint(point)</font>;</div><div><font class="Apple-style-span" face="'courier new', monospace">std::cout << "Transformed point 1 is: " << point2 << std::endl;</font></div>
</blockquote><div><br></div><div>I now try the same thing with one of the ellipses in the group:</div><div><br></div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><div>
<font class="Apple-style-span" face="'courier new', monospace">// Try with ellipse</font></div></blockquote><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><div>
<font class="Apple-style-span" face="'courier new', monospace">GroupType::ChildrenListPointer children = phantom->GetChildren();</font></div></blockquote><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">
<div><font class="Apple-style-span" face="'courier new', monospace">GroupType::ChildrenListType::const_iterator itr = children->begin();</font></div><div><font class="Apple-style-span" face="'courier new', monospace"><br>
</font></div></blockquote><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><div><font class="Apple-style-span" face="'courier new', monospace">itr++;</font></div>
</blockquote><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><div><font class="Apple-style-span" face="'courier new', monospace">point2 = itr->GetPointer()->GetObjectToWorldTransform()->TransformPoint(point);</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace">std::cout << "Transformed point 2 is: " << point2 << std::endl;</font></div></blockquote><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">
<div><font class="Apple-style-span" face="'courier new', monospace"><span class="Apple-style-span" style="white-space: pre;">delete children;</span></font></div></blockquote><font class="Apple-style-span" face="'courier new', monospace"><span class="Apple-style-span" style="white-space: pre;"><div>
<span class="Apple-style-span" style="white-space: pre;"><font class="Apple-style-span" face="arial, helvetica, sans-serif"><br></font></span></div><font class="Apple-style-span" face="arial, helvetica, sans-serif">But the points calculated with the two methods are not the same. The </font>point <font class="Apple-style-span" face="arial, helvetica, sans-serif">variable is the center of the ellipse, so</font></span></font><div>
<font class="Apple-style-span" face="'courier new', monospace"><span class="Apple-style-span" style="white-space: pre;"><font class="Apple-style-span" face="arial, helvetica, sans-serif"> </font></span></font><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">
<div><span class="Apple-style-span" style="white-space: pre;"><font class="Apple-style-span" face="'courier new', monospace">EllipseType::PointType center = itr->GetPointer()->GetBoundingBox()->GetCenter();</font></span></div>
</blockquote><div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><div><font class="Apple-style-span" face="'courier new', monospace"><span class="Apple-style-span" style="white-space: pre; ">point2 = itr->GetPointer()->GetObjectToWorldTransform()->TransformPoint(center);</span><span class="Apple-style-span" style="white-space: pre; "><font class="Apple-style-span" face="arial, helvetica, sans-serif"> </font></span></font></div>
</blockquote><span class="Apple-style-span" style="font-family: arial, helvetica, sans-serif; white-space: pre; "><div><span class="Apple-style-span" style="font-family: arial, helvetica, sans-serif; white-space: pre; "><br>
</span></div>should produce the same result as when getting the world coordinate from the phantom group? </span></div><div><span class="Apple-style-span" style="font-family: arial, helvetica, sans-serif; white-space: pre; "><br>
</span></div><div><span class="Apple-style-span" style="font-family: arial, helvetica, sans-serif; white-space: pre; ">If I use the GetObjectToParentTransform(), I get the ellipse position in the phantom, as I expect. I want to get the ellipse position in world coordinates from it's center, what am I doing wrong?</span></div>
<div><span class="Apple-style-span" style="font-family: arial, helvetica, sans-serif; white-space: pre; "><br></span></div><div><span class="Apple-style-span" style="font-family: arial, helvetica, sans-serif; white-space: pre; "></span><span class="Apple-style-span" style="font-family: arial, helvetica, sans-serif; white-space: pre; ">Regards, </span></div>
<div><div>---<br>Patrik Brynolfsson<br><br><br>
</div></div></div>