<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Circle rotation in space. Can't calculate x coordinate. in Libraries &amp; objects</title>
    <link>https://community.graphisoft.com/t5/Libraries-objects/Circle-rotation-in-space-Can-t-calculate-x-coordinate/m-p/131385#M22398</link>
    <description>&lt;BLOCKQUOTE&gt;Anne wrote:&lt;BR /&gt;I tested out my husbands brain yesterday... (...) A friend of me told me today that her husband was really good in mathematics, so I have to test him &lt;E&gt;&lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/E&gt;&lt;/BLOCKQUOTE&gt;
Poor Norwegian husbands...  &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_lol.gif" style="display : inline;" /&gt;</description>
    <pubDate>Wed, 04 Nov 2009 16:19:55 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2009-11-04T16:19:55Z</dc:date>
    <item>
      <title>Circle rotation in space. Can't calculate x coordinate.</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Circle-rotation-in-space-Can-t-calculate-x-coordinate/m-p/131375#M22388</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;&lt;T&gt;I'm trying to make a circle that has a center in origo. Se the illustration below.&lt;BR /&gt;
I first put the circle on the horizontal layer (XY-layer and z=0). Center is origo (x=y=z=0) That works fine. &lt;BR /&gt;
I tilt the circle with an angle to the horizontal layer. I call this angleXY.&lt;BR /&gt;
The circle cuts through the horizontal layer in the X-axis. The circle is tilted counter-clockwise. This also works fine.&lt;BR /&gt;
But the problem occures when I try to rotate the tilted circle counterclockwise around the z-axis. The angle is vinkeXZ. I can't figure out how to calculate the x-coordinates. I 've tryed many formulas, but the coordinates eighter give me an ellipsis or a line.&lt;BR /&gt;
&lt;BR /&gt;
Here is the code (vinkel norwegian for  angle):&lt;BR /&gt;
&lt;BR /&gt;
fromDegrees = 10&lt;BR /&gt;
toDegrees = 360&lt;BR /&gt;
stepDegrees = 10&lt;BR /&gt;
centerX = 0&lt;BR /&gt;
centerY = 0&lt;BR /&gt;
centerZ = 0 &lt;BR /&gt;
radiusP = 0.5 &lt;BR /&gt;
vinkelXZ = 45 ! Angle from the X-axis counterclockwise around the Z-axis (centerX and centerY=0)&lt;BR /&gt;
vinkelXY = 45 ! Angle between the horizontal-layer and the circle. &lt;BR /&gt;
! Counterclockwise around the X-axis (centerY=0)&lt;BR /&gt;
angle = 0 &lt;BR /&gt;
GOSUB "GenerateCircularCoordinates"&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
END&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
"GenerateCircularCoordinates":&lt;BR /&gt;
! This routine calculates xyz-coordinates to a circle that tilts against the horizontal-layer &lt;BR /&gt;
! and rotates around the Z-axis&lt;BR /&gt;
!&lt;BR /&gt;
! Calculate the trigonometric factores to angles that do not change in the loop.&lt;BR /&gt;
sinVinkelXY = SIN(vinkelXY)&lt;BR /&gt;
cosVinkelXY = COS(vinkelXY)&lt;BR /&gt;
sinVinkelXZ = SIN(vinkelXZ)&lt;BR /&gt;
cosVinkelXZ = COS(vinkelXZ)&lt;BR /&gt;
&lt;BR /&gt;
FOR vinkel = fromDegrees TO toDegrees STEP stepDegrees&lt;BR /&gt;
deltaX = radiusP * COS (vinkel)&lt;BR /&gt;
deltaY = radiusP * SIN (vinkel)&lt;BR /&gt;
deltaZ = radiusP * SIN (vinkel) &lt;BR /&gt;
&lt;BR /&gt;
x = centerX - deltaX &lt;BR /&gt;
y = centerY - deltaY &lt;BR /&gt;
z = centerZ &lt;BR /&gt;
! ---------------------------------------------------&lt;BR /&gt;
! Tilt against the horizontal-layer (XY-layer)&lt;BR /&gt;
! Rotation around the X-axis&lt;BR /&gt;
!&lt;BR /&gt;
z = -y * sinVinkelXY + centerZ&lt;BR /&gt;
y = y * cosVinkelXY + centerY&lt;BR /&gt;
! ---------------------------------------------------&lt;BR /&gt;
! Rotation around the Z-axis&lt;BR /&gt;
!&lt;BR /&gt;
y = y + x*sinVinkelXZ&lt;BR /&gt;
x = x*cosVinkelXZ&lt;BR /&gt;
!&lt;BR /&gt;
! PUT x, y, z, angle&lt;BR /&gt;
IF vinkel &amp;lt;&amp;gt; 0 THEN&lt;BR /&gt;
ADD x, y, z&lt;BR /&gt;
TEXT 0.005, 0, vinkel&lt;BR /&gt;
DEL 1&lt;BR /&gt;
LIN_ x - 0.01, y - 0.01, z - 0.01, x + 0.01, y + 0.01, z + 0.01&lt;BR /&gt;
ENDIF&lt;BR /&gt;
&lt;BR /&gt;
NEXT vinkel&lt;BR /&gt;
RETURN&lt;/T&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;IMG src="http://community.graphisoft.com/t5/image/serverpage/image-id/68049i3DA505E4359F5E91/image-size/large?v=v2&amp;amp;px=999" border="0" alt="CircleIll.jpg" title="CircleIll.jpg" /&gt;</description>
      <pubDate>Tue, 03 Nov 2009 11:47:07 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Circle-rotation-in-space-Can-t-calculate-x-coordinate/m-p/131375#M22388</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-11-03T11:47:07Z</dc:date>
    </item>
    <item>
      <title>Re: Circle rotation in space. Can't calculate x coordinate.</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Circle-rotation-in-space-Can-t-calculate-x-coordinate/m-p/131376#M22389</link>
      <description>Hi Anne,&lt;BR /&gt;
&lt;BR /&gt;
Perhaps I'm missing something...&lt;BR /&gt;
&lt;BR /&gt;
Do you know you can use the Circle command in 3d?...&lt;BR /&gt;
&lt;BR /&gt;
Its in the GDL Reference Manual Page 61.&lt;BR /&gt;
&lt;BR /&gt;
HTH.</description>
      <pubDate>Tue, 03 Nov 2009 12:33:45 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Circle-rotation-in-space-Can-t-calculate-x-coordinate/m-p/131376#M22389</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-11-03T12:33:45Z</dc:date>
    </item>
    <item>
      <title>Re: Circle rotation in space. Can't calculate x coordinate.</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Circle-rotation-in-space-Can-t-calculate-x-coordinate/m-p/131377#M22390</link>
      <description>Yes, I forgot to tell why I want to make this routine.&lt;BR /&gt;
I will use the TUBE and SWEEP commands in GDL.&lt;BR /&gt;
Instead of splitting the object I want to make into different parts, rotating axis a.s.o., I want to generate the x,y,z coordinates for the path, put it into the internal array, and fetch them when I use the TUBE and SWEEP commands. So that's the background. So it's actually the coordinates I need to generate, not the circle.</description>
      <pubDate>Tue, 03 Nov 2009 13:20:44 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Circle-rotation-in-space-Can-t-calculate-x-coordinate/m-p/131377#M22390</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-11-03T13:20:44Z</dc:date>
    </item>
    <item>
      <title>Re: Circle rotation in space. Can't calculate x coordinate.</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Circle-rotation-in-space-Can-t-calculate-x-coordinate/m-p/131378#M22391</link>
      <description>Ok Anne... Let me see if I get it right...&lt;BR /&gt;
&lt;BR /&gt;
You want to Generate xyz coordinates of a circle/arc and this circle/arc has to be rotated in the xyz axis with no distortion, right?&lt;BR /&gt;
&lt;BR /&gt;
At first it makes me wonder why not generate the coords in the xy plan an rotate it using transformations (RotX, RotY, RotZ)?</description>
      <pubDate>Tue, 03 Nov 2009 18:33:11 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Circle-rotation-in-space-Can-t-calculate-x-coordinate/m-p/131378#M22391</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-11-03T18:33:11Z</dc:date>
    </item>
    <item>
      <title>Re: Circle rotation in space. Can't calculate x coordinate.</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Circle-rotation-in-space-Can-t-calculate-x-coordinate/m-p/131379#M22392</link>
      <description>I want the axis to be in the same position all the time. I want to find the coordinates with the axis as a reference. It means I cannot rotate the axis.&lt;BR /&gt;
I just need a formula for calculating the X-coordinate. I think it's actually a matehematic problem.</description>
      <pubDate>Tue, 03 Nov 2009 21:17:47 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Circle-rotation-in-space-Can-t-calculate-x-coordinate/m-p/131379#M22392</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-11-03T21:17:47Z</dc:date>
    </item>
    <item>
      <title>Re: Circle rotation in space. Can't calculate x coordinate.</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Circle-rotation-in-space-Can-t-calculate-x-coordinate/m-p/131380#M22393</link>
      <description>&lt;BLOCKQUOTE&gt;Anne wrote:&lt;BR /&gt;I want the axis to be in the same position all the time. I want to find the coordinates with the axis as a reference. It means I cannot rotate the axis.&lt;BR /&gt;
I just need a formula for calculating the X-coordinate. I think it's actually a matehematic problem.&lt;/BLOCKQUOTE&gt;

Cant you just DEL the ROT transformation to return the axis to a default position.</description>
      <pubDate>Tue, 03 Nov 2009 21:51:13 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Circle-rotation-in-space-Can-t-calculate-x-coordinate/m-p/131380#M22393</guid>
      <dc:creator>Aussie John</dc:creator>
      <dc:date>2009-11-03T21:51:13Z</dc:date>
    </item>
    <item>
      <title>Re: Circle rotation in space. Can't calculate x coordinate.</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Circle-rotation-in-space-Can-t-calculate-x-coordinate/m-p/131381#M22394</link>
      <description>As John well said, if you use DEL after the ROT the axis will return to its place...&lt;BR /&gt;
&lt;BR /&gt;
But I can see by your code that you perfectly know how to use ROT AND DEL...  &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_question.gif" style="display : inline;" /&gt; &lt;BR /&gt;
&lt;BR /&gt;
Sorry Anne, but I really can't understand why you can't use a simple transformation.  &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_confused.gif" style="display : inline;" /&gt; &lt;BR /&gt;
&lt;BR /&gt;
Perhaps if you could describe us whats the final purpose of the object we could help more effectively.&lt;BR /&gt;
&lt;BR /&gt;
HTH.</description>
      <pubDate>Wed, 04 Nov 2009 09:29:46 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Circle-rotation-in-space-Can-t-calculate-x-coordinate/m-p/131381#M22394</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-11-04T09:29:46Z</dc:date>
    </item>
    <item>
      <title>Re: Circle rotation in space. Can't calculate x coordinate.</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Circle-rotation-in-space-Can-t-calculate-x-coordinate/m-p/131382#M22395</link>
      <description>The original purpose was to make a scarf that is hanging over a horizontal pole. I will use the TUBE or SWEEP commands in GDL to optain this. Do you know those commands? &lt;BR /&gt;
(I want an alternative to splitting the object I want to make into different parts, rotating axis, adding distances in different directions a.s.o.)&lt;BR /&gt;
The path I need consists of parts of a circe, orientated in different ways in the space, and with different radiuses and centerpoints, all attached to eachother.&lt;BR /&gt;
So, that is why I want to make a routine like this. &lt;BR /&gt;
I want to generate the x,y,z coordinates for the path, put it into the internal array, and fetch them when I use the TUBE and SWEEP commands. In that way it will be much more easy to make those difficult objects, I think. And I can simply reuse  this routine over and over again. &lt;BR /&gt;
This is the background.</description>
      <pubDate>Wed, 04 Nov 2009 10:38:12 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Circle-rotation-in-space-Can-t-calculate-x-coordinate/m-p/131382#M22395</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-11-04T10:38:12Z</dc:date>
    </item>
    <item>
      <title>Re: Circle rotation in space. Can't calculate x coordinate.</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Circle-rotation-in-space-Can-t-calculate-x-coordinate/m-p/131383#M22396</link>
      <description>Ok... Now I get it. Its a tuff geometry...  &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_eek.gif" style="display : inline;" /&gt; &lt;BR /&gt;
&lt;BR /&gt;
Do you know Andrew Watson's "GDL Handbook"?&lt;BR /&gt;
&lt;BR /&gt;
In page 251 it has a wonderful 3d cubic spline that would do the job with more smooth and realistic effect.&lt;BR /&gt;
&lt;BR /&gt;
Sorry I can't help you more.  &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_sad.gif" style="display : inline;" /&gt;</description>
      <pubDate>Wed, 04 Nov 2009 11:14:04 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Circle-rotation-in-space-Can-t-calculate-x-coordinate/m-p/131383#M22396</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-11-04T11:14:04Z</dc:date>
    </item>
    <item>
      <title>Re: Circle rotation in space. Can't calculate x coordinate.</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Circle-rotation-in-space-Can-t-calculate-x-coordinate/m-p/131384#M22397</link>
      <description>No, unfourtunately I do not have that book. But, I bought the GDL Cookbook 3. some time ago. I've looked through it, but could not find anything like this, as far as I could see.&lt;BR /&gt;
I tested out my husbands brain yesterday. But his solution creates another interesting shape &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_biggrin.gif" style="display : inline;" /&gt; . A friend of me told me today that her husband was really good in mathematics, so I have to test him &lt;E&gt;&lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/E&gt;</description>
      <pubDate>Wed, 04 Nov 2009 14:49:49 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Circle-rotation-in-space-Can-t-calculate-x-coordinate/m-p/131384#M22397</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-11-04T14:49:49Z</dc:date>
    </item>
    <item>
      <title>Re: Circle rotation in space. Can't calculate x coordinate.</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Circle-rotation-in-space-Can-t-calculate-x-coordinate/m-p/131385#M22398</link>
      <description>&lt;BLOCKQUOTE&gt;Anne wrote:&lt;BR /&gt;I tested out my husbands brain yesterday... (...) A friend of me told me today that her husband was really good in mathematics, so I have to test him &lt;E&gt;&lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/E&gt;&lt;/BLOCKQUOTE&gt;
Poor Norwegian husbands...  &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_lol.gif" style="display : inline;" /&gt;</description>
      <pubDate>Wed, 04 Nov 2009 16:19:55 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Circle-rotation-in-space-Can-t-calculate-x-coordinate/m-p/131385#M22398</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-11-04T16:19:55Z</dc:date>
    </item>
    <item>
      <title>Re: Circle rotation in space. Can't calculate x coordinate.</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Circle-rotation-in-space-Can-t-calculate-x-coordinate/m-p/131386#M22399</link>
      <description>&lt;BLOCKQUOTE&gt;Anne wrote:&lt;BR /&gt;But the problem occures when I try to rotate the tilted circle counterclockwise around the z-axis. The angle is vinkeXZ. I can't figure out how to calculate the x-coordinates. I 've tryed many formulas, but the coordinates eighter give me an ellipsis or a line.&lt;/BLOCKQUOTE&gt;
Try the script below. I've typed this from memory, so it might have errors. Hopefully the comments make the meaning clear.
&lt;PRE&gt;!-----------------------------------------------------------
!Set up rotation angles
! xRotationAngle is rotation angle about X axis
! zRotationAngle is rotation angle about Z axis
!-----------------------------------------------------------
cosX = cos(-xRotationAngle)
sinX = sin(-xRotationAngle)
cosZ = cos(-zRotationAngle)
sinZ = sin(-zRotationAngle)

!Rotate a point about 'X' axis
xIn = 20
yIn = 5
zIn = 0
gosub "doXRotate"

!Rotate about 'Z' axis
gosub "doZRotate"

!The rotated point is contained in (xIn, yIn, zIn)

end

!-----------------------------------------------------------
! Rotate a point about the x axis

! In/Out:
! yIn: The Y coordinate of the point to rotate
! zIn: The Z coordinate of the point to rotate
!-----------------------------------------------------------
"doXRotate":
yOut = zIn * sinX + yIn * cosX
zIn = zIn * cosX - yIn * sinX
yIn = yOut
return


!-----------------------------------------------------------
! Rotate a point about the z axis

! In/Out:
! xIn: The X coordinate of the point to rotate
! yIn: The Y coordinate of the point to rotate
!-----------------------------------------------------------
"doZRotate":
xOut = xIn * cosZ + yIn * sinZ
yIn = -xIn * sinZ + yIn * cosZ
xIn = xOut
return&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 Nov 2009 18:02:24 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Circle-rotation-in-space-Can-t-calculate-x-coordinate/m-p/131386#M22399</guid>
      <dc:creator>Ralph Wessel</dc:creator>
      <dc:date>2009-11-04T18:02:24Z</dc:date>
    </item>
    <item>
      <title>Re: Circle rotation in space. Can't calculate x coordinate.</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Circle-rotation-in-space-Can-t-calculate-x-coordinate/m-p/131387#M22400</link>
      <description>This worked fine! You deserve a big hug  &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_biggrin.gif" style="display : inline;" /&gt;</description>
      <pubDate>Thu, 05 Nov 2009 10:05:32 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Circle-rotation-in-space-Can-t-calculate-x-coordinate/m-p/131387#M22400</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-11-05T10:05:32Z</dc:date>
    </item>
  </channel>
</rss>

