Jump to content

  • Log In with Google      Sign In   
  • Create Account


DX11 - API - Disadvantage of vector multiplication.


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
9 replies to this topic

#1 Migi0027   Crossbones+   -  Reputation: 1631

Like
0Likes
Like

Posted 06 September 2013 - 06:59 AM

Hi guys, wink.png

 

some few times multiplying vectors of same kind becomes a must, and so I do it, but I need to do multiply the components individually (Not a problem). But the class D3DVECTORX (2, 3, 4...), doesn't have an multiply operator with an overload for other vectors of it's kind, why not?

 

Why has the developers chosen that? ( Disadvantages ? )

 

Thanks, as usual.

-MIGI0027


Hi! Cuboid Zone
The Rule: Be polite, be professional, but have a plan to kill everyone you meet, ohh, AND STEAL ALL ZE TRIANGLES FROM ZHEM!

Sponsor:

#2 unbird   Crossbones+   -  Reputation: 4973

Like
2Likes
Like

Posted 06 September 2013 - 07:25 AM

Probably because it can be confused with a dot product, which also takes two vectors as arguments. E.g. I use SlimDX and the math library there doesn't even have such an overload, but explicitly named functions for both dot and a so-called modulate. Counter example: HLSL uses modulate for *, but has an intrinsic for dot (or  mul for matrix vector multiplication).

 

If you don't find such a modulate function, it should be easy write a free function :wink:



#3 Migi0027   Crossbones+   -  Reputation: 1631

Like
0Likes
Like

Posted 06 September 2013 - 07:57 AM

Thanks unbird,  just what I needed to hear. wink.png


Hi! Cuboid Zone
The Rule: Be polite, be professional, but have a plan to kill everyone you meet, ohh, AND STEAL ALL ZE TRIANGLES FROM ZHEM!

#4 Burnt_Fyr   Members   -  Reputation: 1232

Like
0Likes
Like

Posted 06 September 2013 - 08:00 AM

It is likely because multiplying one vector by another component wise doesn't make sense as an operation on vector spaces. Under what circumstances do you need to use component wise multiplication?



#5 Migi0027   Crossbones+   -  Reputation: 1631

Like
1Likes
Like

Posted 06 September 2013 - 08:04 AM

I'm trying to implement Volume Rendering,

 

link can be found here: http://www.gamedev.net/topic/647531-dx11-volume-rendering-article-misunderstanding/


Hi! Cuboid Zone
The Rule: Be polite, be professional, but have a plan to kill everyone you meet, ohh, AND STEAL ALL ZE TRIANGLES FROM ZHEM!

#6 Ravyne   Crossbones+   -  Reputation: 7120

Like
1Likes
Like

Posted 06 September 2013 - 01:23 PM

It is likely because multiplying one vector by another component wise doesn't make sense as an operation on vector spaces. Under what circumstances do you need to use component wise multiplication?

 

Sure it does, its just a non-uniform scale. Granted its not the most common operation for 3D graphics, but its hardly unheard of, and it has wide applicability in other domains. In my own vector math library, I overload operator * and operator / between vectors to mean piecewise multiplication and piecewise division (non-uniform scaling), and between vectors and scalars by extending the scalar to a vector of same rank (uniform scaling). I feel that this configuration best satisfies the recommended design principles of "principle of least surprise" (particularly regarding operator associativity and operator precedense) and "do as the ints do". I provide for the dot, cross (and 2D psuedo-cross) product as (non-member) functions, along with some other useful ones. I'm pretty happy with how orthogonal this makes things, and while its not as terse as with operator overloading, it forces you to state the order of operations explicitly.



#7 Burnt_Fyr   Members   -  Reputation: 1232

Like
0Likes
Like

Posted 06 September 2013 - 03:06 PM

 

It is likely because multiplying one vector by another component wise doesn't make sense as an operation on vector spaces. Under what circumstances do you need to use component wise multiplication?

 

Sure it does, its just a non-uniform scale. Granted its not the most common operation for 3D graphics, but its hardly unheard of, and it has wide applicability in other domains. In my own vector math library, I overload operator * and operator / between vectors to mean piecewise multiplication and piecewise division (non-uniform scaling), and between vectors and scalars by extending the scalar to a vector of same rank (uniform scaling). I feel that this configuration best satisfies the recommended design principles of "principle of least surprise" (particularly regarding operator associativity and operator precedense) and "do as the ints do". I provide for the dot, cross (and 2D psuedo-cross) product as (non-member) functions, along with some other useful ones. I'm pretty happy with how orthogonal this makes things, and while its not as terse as with operator overloading, it forces you to state the order of operations explicitly.

I think we have differing definitions of vectors.



#8 Ravyne   Crossbones+   -  Reputation: 7120

Like
0Likes
Like

Posted 06 September 2013 - 03:29 PM

Not really. Strictly speaking, I suppose non-uniform-scaling isn't common in processing things like geometry, but it certainly has a meaning that's rational enough to be useful, and vectors and vector spaces have other applications. For example, if you consider a color space (like RGB), as a vector space, then operations like gamma-correction are just non-uniform scales. We can argue mathematical pedantries all day but when we're being pragmatic there's not a strong argument to be made for keeping to a 100% correct, mathematical definition of vectors intact (unless you're specifically working in a pure-math domain, and want the type system to chain you to the mathematical definition intentionally). For example, even though vectors and points are entirely different mathematical concepts, they can be represented in unified form, and often are, without making any dangerous compromises.


Edited by Ravyne, 06 September 2013 - 03:30 PM.


#9 Jason Z   Crossbones+   -  Reputation: 4905

Like
0Likes
Like

Posted 06 September 2013 - 08:19 PM

 

 

It is likely because multiplying one vector by another component wise doesn't make sense as an operation on vector spaces. Under what circumstances do you need to use component wise multiplication?

 

Sure it does, its just a non-uniform scale. Granted its not the most common operation for 3D graphics, but its hardly unheard of, and it has wide applicability in other domains. In my own vector math library, I overload operator * and operator / between vectors to mean piecewise multiplication and piecewise division (non-uniform scaling), and between vectors and scalars by extending the scalar to a vector of same rank (uniform scaling). I feel that this configuration best satisfies the recommended design principles of "principle of least surprise" (particularly regarding operator associativity and operator precedense) and "do as the ints do". I provide for the dot, cross (and 2D psuedo-cross) product as (non-member) functions, along with some other useful ones. I'm pretty happy with how orthogonal this makes things, and while its not as terse as with operator overloading, it forces you to state the order of operations explicitly.

I think we have differing definitions of vectors.

 

Are you implying that a useful construct for computer graphics (non-uniform scaling, which is used in editors all the time) should not be allowed because of the mathematical definition of a vector?  Non-uniform scaling is very clearly used frequently - are you saying that such an operation should not be possible?

 

I just don't see the logic in the argument you are making here...



#10 Pink Horror   Members   -  Reputation: 1151

Like
0Likes
Like

Posted 06 September 2013 - 09:25 PM


some few times multiplying vectors of same kind becomes a must, and so I do it, but I need to do multiply the components individually (Not a problem). But the class D3DVECTORX (2, 3, 4...), doesn't have an multiply operator with an overload for other vectors of it's kind, why not?

 

Why are you asking about D3DVECTOR structs in a topic titled with "DX11"? DirectX 11 has DirectXMath, which has the XMVECTOR class, which has an operator for component multiplication.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS