[IGSTK-Users] EllipsoidObject Radius
Jake McIvor
jdmcivor at interchange.ubc.ca
Thu Jul 23 14:43:49 EDT 2009
I believe there is a bug somewhere in the ellipsoidObject or
ellipsoidObjectRepresentation classes. When I use the SetRadius
method, the resulting ellipsoid's axes are half as big as they should
be ( i.e. the length of each axis is set to the radius, instead of
each radius being half the legth of the axis.)
My application uses the QtWidget. Here is a code snippet that should
display two 10mm spheres, touching at one point.
// test ellipsoid radii
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 );
Cheers,
Jake
--
Jake McIvor
MASc Candidate, Biomedical Engineering
Univerisity of British Columbia
More information about the IGSTK-Users
mailing list