[Insight-developers] recent changes in itkTriangleCell.txx seems to break wrapitk builds

Arnaud Gelas arnaud_gelas at hms.harvard.edu
Mon Jul 21 09:49:06 EDT 2008


Hi Luis,

Sorry for the late reply, I was away for the week end...

Thanks Luis for pointing these errors regarding the normal computation 
especially in 2D, and for fixing the code!

The cross product in higher dimension, if I am not wrong there is an 
extension through the exterior product of vectors (or wedge product). In 
such case, the CrossProduct may be generalized for higher dimension than 
2. I will investigate it, or if anyone knows about exterior or wedge 
product, it would be great to share his experience.

I understand the differences between a vector and a covariant vector and 
I agree with you on the theoretical side of the things.
Then, on the usage, an itk::Vector is way easier to use than an 
itk::CovariantVector:
point - point = vector
point.GetVectorFromOrigin = vector
point + lambda vector = point

I did not find the equivalent in a covariant vector (is there any?).

So, yes under affine transform, normals behave like CovariantVector, but 
for all my algorithms, it is eventually much easier to use a vector.

I know that there may be an historical reason behind that (at first, 
there were no covariant vectors in itk and everything was made of 
vector), but porting all the point API to support covariantvectors 
instead of vector would be an overkill for me. Do you see a simple way 
to do that?

Arnaud


Luis Ibanez wrote:
> Arnaud,
>
> The CrossProduct() templated function in itkVector.h
> is a historic mishap, that we have to keep around
> for Backwards compatibility.
>
> The correct CrossProduct to use is the one in the
> CovariantVector.h,cxx files.
>
> The outcome of a cross product between two vectors
> is not a vector, but a covariant vector. In the
> particular case the you are using it in the TriangleCell,
> for computing Normals, the correct type to use for
> representing the Normal to a surface is a Covariant
> Vector, and not a Vector.
>
> Normals do not behave as Vectors under Affine Transforms.
>
> These templated function is specialized in the .cxx
> files only for three cases:
>
> itkCovariantVector.cxx
>
> CrossProduct( CovariantVector<double,3> ...
> CrossProduct( CovariantVector<float,3> ...
> CrossProduct( CovariantVector<int,3> ...
>
> The case that is missing in the Wrapping is (float,2)
>
> ...which... is not a valid case, since you can't
> have Normals to 3 points in a 2D space, or 4D, 5D...
>
> The Normal computation should be removed from the
> TriangleCell, or it should be delegated through
> an intermediate class that could be specialized
> for computing a cross product in 3D, and doing
> nothing in any other dimension.
>
>
> Also, the "std::cout" lines should be removed
> from the code.
>
> There is a lot of commented out code that must
> be removed from the TriangleCell, before the
> release.
>
>
>      Luis
>
>
>
> ----------------------
> Gaëtan Lehmann wrote:
>> Hi Arnaud,
>>
>> It seems that your recent changes in itkTriangleCell.txx are breaking 
>> the builds
>> with wrapitk enabled.
>>
>> http://www.itk.org/cgi-bin/viewcvs.cgi/Code/Common/itkTriangleCell.txx?view=annotate&root=Insight&sortby=date 
>>
>> http://www.cdash.org/CDash/viewBuildError.php?buildid=127316
>> http://www.cdash.org/CDash/viewBuildError.php?buildid=127107
>>
>> Can you look at that problem?
>> Maybe I have instantiated the wrong types?
>>
>> Thanks,
>>
>> Gaëtan
>> _______________________________________________
>> Insight-developers mailing list
>> Insight-developers at itk.org
>> http://www.itk.org/mailman/listinfo/insight-developers
>>



More information about the Insight-developers mailing list