<?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[Rotation for polygon]]></title><description><![CDATA[<p dir="auto">Hi,<br />
I want to do a rotation for a polynone.<br />
I know the coordinates of the points of the polygon, in the global coordinate system.<br />
For this rotation, I know the axis of rotation, defined by a vector V, and the angle of rotation A with respect to this axis.</p>
<p dir="auto">I manage to do this type of rotation, with matrices and with a change of Cartesian coordinate system, but I know that there is a much simpler method with C4D python functions</p>
]]></description><link>http://developers.maxon.net/forum/topic/14145/rotation-for-polygon</link><generator>RSS for Node</generator><lastBuildDate>Fri, 11 Sep 2026 10:25:44 GMT</lastBuildDate><atom:link href="http://developers.maxon.net/forum/topic/14145.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 09 Aug 2022 16:11:34 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Rotation for polygon on Tue, 09 Aug 2022 18:38:56 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/ferdinand">@<bdi>ferdinand</bdi></a></p>
<p dir="auto">Thanks, it works well</p>
<p dir="auto">My first method was complex:</p>
<ul>
<li>creation of a new orthogonal spatial system, with one of its axes is identical to the axis of rotation</li>
<li>compute the coordinates of the points of the object in this new spatial system, then rotate the object</li>
<li>calculation of the new coordinates in the initial orthogonal spatial system.</li>
</ul>
]]></description><link>http://developers.maxon.net/forum/post/69605</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/69605</guid><dc:creator><![CDATA[Kantronin]]></dc:creator><pubDate>Tue, 09 Aug 2022 18:38:56 GMT</pubDate></item><item><title><![CDATA[Reply to Rotation for polygon on Tue, 09 Aug 2022 17:05:39 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/kantronin">@<bdi>kantronin</bdi></a>,</p>
<p dir="auto">Thank you for reaching out to us. I am not quite sure how your last sentence is meant,</p>
<blockquote>
<p dir="auto">I manage to do this type of rotation, with matrices and with a change of Cartesian coordinate system, but I know that there is a much simpler method with C4D python functions</p>
</blockquote>
<p dir="auto">but you can define a rotation matrix from an axis of rotation <em>v</em> and an angle <em>w</em> with the function <a href="https://developers.maxon.net/docs/py/2023_2/modules/c4d.utils/index.html#c4d.utils.RotAxisToMatrix" target="_blank" rel="noopener noreferrer nofollow ugc">c4d.utils.RotAxisToMatrix(v, w)</a>. I.e., to transform vertices of an object, you would do something like this:</p>
<pre><code>axis: c4d.Vector = c4d.Vector(1, 2, 3)
theta: float = c4d.utils.DegToRad(45)
transform: c4d.Matrix = c4d.utils.RotAxisToMatrix(axis, theta)

transformedPoints: list[c4d.Vector] = [transform * p for p in somePointObject.GetAllPoints()]
</code></pre>
<p dir="auto">This transformation would however here happen in local object space, i.e., the space vertices/points are being expressed in. If you want to do the rotation in a space relative to the polygon, you will have to construct a frame for that polygon first, then convert the points out of local object space into your custom polygon space, carry out your rotation, and then convert the points back. I am just mentioning this because you talk about <em>'[..] do[ing] a rotation for a polyon'</em> which somewhat implies that you want to rotate around the origin of the polygon and some frame implied by the polygon.</p>
<p dir="auto">Cheers,<br />
Ferdinand</p>
]]></description><link>http://developers.maxon.net/forum/post/69604</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/69604</guid><dc:creator><![CDATA[ferdinand]]></dc:creator><pubDate>Tue, 09 Aug 2022 17:05:39 GMT</pubDate></item></channel></rss>