MantisBT - IGSTK
View Issue Details
0009310IGSTKIGSTKpublic2009-07-24 10:502009-07-24 10:53
Patrick Cheng 
Patrick Cheng 
normalminoralways
closedfixed 
AllAllAll
0009310: Ellipsoid object renderred in incorrect size
Hi Jake,

You are right. The problem is that the default "Size" of the
m_EllipsoidSource is 0.5

We need to set it to be 1, if we consider the scale factors to be radius not diameter.

The fix should be:
m_EllipsoidSource->SetSize( 1.0 );
m_EllipsoidSource->SetScale( radius[0], radius[1], radius[2] );

Thank you for reporting this.

Patrick

Jake McIvor wrote:
> I think I found it:
>
> In the UpdateRepresentationProcessing and SetEllipsoidObjectProcessing
> methods, the scale of the vtkSuperquadricSource is updated:
>
> EllipsoidObjectType::ArrayType radius = m_EllipsoidObject->GetRadius();
> m_EllipsoidSource->SetScale( radius[0], radius[1], radius[2] );
>
> The second line should read:
> m_EllipsoidSource->SetScale( 2*radius[0], 2*radius[1], 2*radius[2] );
>
> Does that make sense, or am I confusing the use of the setRadius method?
>
> -Jake
      igstk::EllipsoidObject::Pointer sphere1 = igstk::EllipsoidObject::New();
       sphere1->SetRadius( 10,10,10 );

       igstk::EllipsoidObjectRepresentation::Pointer sphere1rep =
            igstk::EllipsoidObjectRepresentation::New();
       sphere1rep->RequestSetEllipsoidObject( sphere1 );
       sphere1rep->SetColor( 1.0,0.0,0.0 );
       sphere1rep->SetOpacity( 0.9 );

       igstk::EllipsoidObject::Pointer sphere2 = igstk::EllipsoidObject::New();
       sphere2->SetRadius(10,10,10);

       igstk::EllipsoidObjectRepresentation::Pointer sphere2rep =
           igstk::EllipsoidObjectRepresentation::New();
       sphere2rep->RequestSetEllipsoidObject( sphere2 );
       sphere2rep->SetColor( 0.0,0.0,1.0 );
       sphere2rep->SetOpacity( 0.9 );

       igstk::Transform identity;
       identity.SetToIdentity(igstk::TimeStamp::GetLongestPossibleTime());
       igstk::Transform transform;
       igstk::Transform::VectorType translation;
       igstk::Transform::VersorType rotation;
       translation[0] = 20.0;
       translation[1] = 0.0;
       translation[2] = 0.0;
       rotation.Set( 0.0, 0.0, 0.0, 1.0 );
       igstk::Transform::ErrorType errorValue = 0;

       transform.SetTranslationAndRotation(
           translation, rotation, errorValue,
           igstk::TimeStamp::GetLongestPossibleTime() );

       sphere1->RequestSetTransformAndParent( identity, m_View );
       sphere2->RequestSetTransformAndParent( transform, m_View );

       m_View->RequestAddObject( sphere1rep );
       m_View->RequestAddObject( sphere2rep );
IGSTK uses vtkSuperquadricSource to generate graphics primitive for visualization
No tags attached.
Issue History
2009-07-24 10:50Patrick ChengNew Issue
2009-07-24 10:50Patrick ChengStatusnew => assigned
2009-07-24 10:50Patrick ChengAssigned To => Patrick Cheng
2009-07-24 10:51Patrick ChengNote Added: 0016957
2009-07-24 10:51Patrick ChengStatusassigned => confirmed
2009-07-24 10:52Patrick ChengNote Added: 0016958
2009-07-24 10:52Patrick ChengStatusconfirmed => resolved
2009-07-24 10:52Patrick ChengResolutionopen => fixed
2009-07-24 10:53Patrick ChengNote Added: 0016959
2009-07-24 10:53Patrick ChengStatusresolved => closed

Notes
(0016957)
Patrick Cheng   
2009-07-24 10:51   
Verified.
(0016958)
Patrick Cheng   
2009-07-24 10:52   
Add this line to change the default "Size" of the vtkSuperquadricSource to 1. m_EllipsoidSource->SetSize( 1.0 );

So the scale factor will act like radius
(0016959)
Patrick Cheng   
2009-07-24 10:53   
Fixes checked in. Along with fixes with test programs and baseline images