[IGSTK-Users] EllipsoidObject Radius
Patrick Cheng
cheng at isis.georgetown.edu
Fri Jul 24 10:29:35 EDT 2009
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
>
>
> On Thu, Jul 23, 2009 at 11:43 AM, Jake
> McIvor<jdmcivor at interchange.ubc.ca> wrote:
>> 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
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>
>> Follow this link to subscribe/unsubscribe:
>> http://public.kitware.com/cgi-bin/mailman/listinfo/igstk-users
>>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/cgi-bin/mailman/listinfo/igstk-users
>
>
More information about the IGSTK-Users
mailing list