<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Multiplying (transforming) a Vector by a Matrix - in 3 or more steps...]]></title><description><![CDATA[<p dir="auto">Hi gang,</p>
<p dir="auto">So... back in the good-ole days (at least R14 and earlier), it was quite common in my code to have something like...</p>
<pre><code>m_xfPoints[ndx] = m_pPoints[ndx] * mxForm;    // transform point by current matrix
</code></pre>
<p dir="auto">In other words, within a loop (increasing the value of 'ndx'), you could transform all points/vertices by some matrix - with a single line of code.</p>
<p dir="auto">The (R20, but maybe back as far as R15?) API no longer seems to have a built-in "multiply a vector by a matrix" operator, so you end up with more lines of code, to achieve the same thing...</p>
<pre><code>Vector xfPt = m_pPoints[ndx];             // get a copy of the point...
xfPt *= mxForm;                           // use the '*=' operator to modify it...
m_xfPoints[ndx] = xfPt;                   // ...finally, assign it to the transformed array
</code></pre>
<p dir="auto">...note that I had to use a new Vector to store a temporary copy of the original (so I wouldn't modify the original with the '*=' operator).</p>
<p dir="auto">Of course I could have done it with one less line of code...</p>
<pre><code>m_xfPoints[ndx] = m_pPoints[ndx];          // get original point value... 
m_xfPoints[ndx] *= mxForm;                 // use the '*=' operator to modify it.
</code></pre>
<p dir="auto">..but the above is just the most simplistic example... I have other cases where more math is done on the same (single) line of code to the point (scaling, other matrices or vectors involved, etc.), so I more often than not have to add more, separate operations.</p>
<p dir="auto">So... am I missing something?  I'm sure there was some rationale for removing some operators (you can no longer multiply 2 Vectors either... have to use Dot(), can no longer use '%' - must use Cross(), etc.), but/so I'm just wondering what that is.</p>
<p dir="auto">Thanks,</p>
<p dir="auto">Keith</p>
]]></description><link>http://developers.maxon.net/forum/topic/11001/multiplying-transforming-a-vector-by-a-matrix-in-3-or-more-steps</link><generator>RSS for Node</generator><lastBuildDate>Tue, 15 Sep 2026 21:11:37 GMT</lastBuildDate><atom:link href="http://developers.maxon.net/forum/topic/11001.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 15 Sep 2018 08:47:09 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Multiplying (transforming) a Vector by a Matrix - in 3 or more steps... on Tue, 18 Sep 2018 07:31:29 GMT]]></title><description><![CDATA[<p dir="auto">"actually, you can still multiply in one line. You just have to multiply a matrix with a vector:..."</p>
<p dir="auto">D'oh! I'm surprised that I didn't try that - tho it doesn't seem as intuitive ("vector = some other <em>vector</em>, being modified by some operations" vs. "vector = a <em>matrix</em>, imposing/operating on some vector", etc.)... do you know why the Vector lost so many direct operators (* other Vector (Dot()), * Matrix, % other Vector (Cross()) - there may be others)?</p>
<p dir="auto">Apparently, you can still '!v' to normalize it (yay), even tho there's a v.Normalize() call... and I can understand why the "Identity Matrix" operator might have changed from '!' to '~'... some of the other changes just seem a bit arbitrary.</p>
<p dir="auto">I've already made all the changes at this point, but thanks for the tip/reply - I'll keep that in mind for future reference.</p>
<p dir="auto">Cheers.</p>
]]></description><link>http://developers.maxon.net/forum/post/55720</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/55720</guid><dc:creator><![CDATA[Keith Young]]></dc:creator><pubDate>Tue, 18 Sep 2018 07:31:29 GMT</pubDate></item><item><title><![CDATA[Reply to Multiplying (transforming) a Vector by a Matrix - in 3 or more steps... on Mon, 17 Sep 2018 08:32:27 GMT]]></title><description><![CDATA[<p dir="auto">Hello,</p>
<p dir="auto">actually, you can still multiply in one line. You just have to multiply a matrix with a vector:</p>
<pre><code>maxon::Vector points[count];
maxon::Matrix matrices[count];

// fill arrays ...

for (maxon::Int i = 0; i &lt; count; ++i)
{
    points[i] = matrices[i] * points[i];
}
</code></pre>
<p dir="auto">You find information on how to use matrices in these manuals:</p>
<ul>
<li><a href="https://developers.maxon.net/docs/cpp/2023_2/page_maxonapi_data_matrix.html#page_maxonapi_data_matrix_create" target="_blank" rel="noopener noreferrer nofollow ugc">Matrices</a></li>
<li><a href="https://developers.maxon.net/docs/cpp/2023_2/page_manual_matrix.html#page_manual_matrix_use_transform" target="_blank" rel="noopener noreferrer nofollow ugc">Matrix Manual (Classic)</a></li>
</ul>
<p dir="auto">best wishes,<br />
Sebastian</p>
]]></description><link>http://developers.maxon.net/forum/post/55706</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/55706</guid><dc:creator><![CDATA[s_bach]]></dc:creator><pubDate>Mon, 17 Sep 2018 08:32:27 GMT</pubDate></item></channel></rss>