Re: [eigen] Patch for quaternion normalization and cross product for Vector4f |

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]

*To*: eigen@xxxxxxxxxxxxxxxxxxx*Subject*: Re: [eigen] Patch for quaternion normalization and cross product for Vector4f*From*: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>*Date*: Wed, 11 Mar 2009 14:44:25 +0100*Dkim-signature*: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=feAkh+AkhkYCUE3vZX4V3fWTw1MHrySDsWBn1sL/lpo=; b=uxJ1Ivm5uErZ+c606wOb52NRBfMSXFpZARUiE/9ApX3znLuoYZx6CgfrLHHL+I6eDX tc8h9Gz5qg//RvIvp5LoKD2Fe2HSDUor5Miv3bzO95YuuR1r6ylgqnLDArYKHWokRtIM XJestVo9FAl/BWSObaex/p9DpLyVxDIssIFNo=*Domainkey-signature*: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=OoyFvQtNMiGixrM1p3eriWObSMmgX7eHN7iTFH09zXi4IVgyryeiHy7whdJaNGYoYf vOJR7/FWQVLXeOdkVeR3C40InVeeS+WovF+1fmVDEMVqzvK5JCfvZJBYY7hDncq7MchJ vYtLnXgg4jhR0ga6MatPc1flG0TH8eECCiXrA=

short answers: - start<3>() returns an expression of the first 3 coeffs. - for matrices, I think the default Transform is perfect for that. - I'll commit the cross3 optimized routine in Geometry now => immediate consequence: people can do their own cooking to mimic vec3 using vec4, including cross products. - and then if you write a small doc/tutorial to explain how to best use vec4 to mimic vec3, then I'll be please to include it as well. for the rest (more transparent support of vectorized vec3) we can see later, very low priority to me even though I mostly deal with vec3 objects ! Gael. On Wed, Mar 11, 2009 at 2:15 PM, Rohit Garg <rpg.314@xxxxxxxxx> wrote: > <snip> > >> about vector3 ops using aligned vector4, currently I would say that's >> up to the user to correctly use vector4 to ensure the last coeff is >> zero when it really as to be 0 (dot/norm) and uses .start<3> when >> there is no alternative (minCoeff). Am I right if I say that in that >> context the only missing feature is a vectorized cross product ? If >> so, then the easiest way is to add a cross3() function. Another option >> would be to check the MaxSizeAtCompileTime value to automatically >> vectorize: >> a.start<3>().cross(b.start<3>()), the problem is the return type which >> have to be a Vector4. > > Yes it(keep the last coeff 0) is, I volunteer to write the docs for > this (use of vec4f instead of vec3f to use sse) in case it is > accepted. I too can't recall any other thing which is nonvectorized. > Cross of two vec3's producing a vec4 is pretty confusing and non > orthogonal from API cleanliness POV. People are immediately going to > ask "what in the name of god makes vec3 cross vec3 = vec4?" IMHO, A > good API is one where the ins and outs are predictable. > > BTW, what is start<3> and what does it do? > >> Another related thing: we already can do: >> >> typedef Matrix<float,3,1,0,4,1> AlignedVector3; >> >> so if we improve the vectorization to better take into account the >> Max{Row|Cols|Size}AtCompileTime values, then all coeff wise ops could >> be easily vectorized. Likewise, the cross product could automatically >> return an "AlignedVector3". The only problems I see are: >> 1 - the dot/norm stuff (we would need specialized versions of ei_predux) >> 2 - the evaluation to a temporary if the Max*AtCompileTime values are >> not taken into account (I don't remember how it behaves) > > Benoit -> "Things get more complicated with 3x3 matrices. Here it seems that for > good performance with matrix products, what we need is to embed the > 3x3 matrix as top-left corner in a 4x4 matrix with zeros outside. So > it is really getting complicated, and very wasteful of memory. > Probably a reason to not think of matrices for now." > > @Benoit: as far as matrices are concerned, their issues are a natural > extension of the issues with vectors. I think the best way would be > just to let people use vec3 class and only those which actually need > sse use vec4 but make the vectorization complete(ie do all ops) for > them. For some people, using 3 instead of 4 is a waste, for others it > isn't. Let people choose what they need instead of deciding for them. > > Regards, > > -- > Rohit Garg > > http://rpg-314.blogspot.com/ > > Senior Undergraduate > Department of Physics > Indian Institute of Technology > Bombay > > >

**References**:**[eigen] Patch for quaternion normalization and cross product for Vector4f***From:*Rohit Garg

**Re: [eigen] Patch for quaternion normalization and cross product for Vector4f***From:*Gael Guennebaud

**Re: [eigen] Patch for quaternion normalization and cross product for Vector4f***From:*Rohit Garg

**Re: [eigen] Patch for quaternion normalization and cross product for Vector4f***From:*Gael Guennebaud

**Re: [eigen] Patch for quaternion normalization and cross product for Vector4f***From:*Rohit Garg

**Re: [eigen] Patch for quaternion normalization and cross product for Vector4f***From:*Benoit Jacob

**Re: [eigen] Patch for quaternion normalization and cross product for Vector4f***From:*Gael Guennebaud

**Re: [eigen] Patch for quaternion normalization and cross product for Vector4f***From:*Rohit Garg

**Messages sorted by:**[ date | thread ]- Prev by Date:
**Re: [eigen] Patch for quaternion normalization and cross product for Vector4f** - Next by Date:
**Re: [eigen] Bounding Volume Hierarchies** - Previous by thread:
**Re: [eigen] Patch for quaternion normalization and cross product for Vector4f** - Next by thread:
**[eigen] making a new page on wiki**

Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |