Circle rotation in space. Can't calculate x coordinate.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2009-11-03 12:47 PM
I first put the circle on the horizontal layer (XY-layer and z=0). Center is origo (x=y=z=0) That works fine.
I tilt the circle with an angle to the horizontal layer. I call this angleXY.
The circle cuts through the horizontal layer in the X-axis. The circle is tilted counter-clockwise. This also works fine.
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.
Here is the code (vinkel norwegian for angle):
fromDegrees = 10
toDegrees = 360
stepDegrees = 10
centerX = 0
centerY = 0
centerZ = 0
radiusP = 0.5
vinkelXZ = 45 ! Angle from the X-axis counterclockwise around the Z-axis (centerX and centerY=0)
vinkelXY = 45 ! Angle between the horizontal-layer and the circle.
! Counterclockwise around the X-axis (centerY=0)
angle = 0
GOSUB "GenerateCircularCoordinates"
END
"GenerateCircularCoordinates":
! This routine calculates xyz-coordinates to a circle that tilts against the horizontal-layer
! and rotates around the Z-axis
!
! Calculate the trigonometric factores to angles that do not change in the loop.
sinVinkelXY = SIN(vinkelXY)
cosVinkelXY = COS(vinkelXY)
sinVinkelXZ = SIN(vinkelXZ)
cosVinkelXZ = COS(vinkelXZ)
FOR vinkel = fromDegrees TO toDegrees STEP stepDegrees
deltaX = radiusP * COS (vinkel)
deltaY = radiusP * SIN (vinkel)
deltaZ = radiusP * SIN (vinkel)
x = centerX - deltaX
y = centerY - deltaY
z = centerZ
! ---------------------------------------------------
! Tilt against the horizontal-layer (XY-layer)
! Rotation around the X-axis
!
z = -y * sinVinkelXY + centerZ
y = y * cosVinkelXY + centerY
! ---------------------------------------------------
! Rotation around the Z-axis
!
y = y + x*sinVinkelXZ
x = x*cosVinkelXZ
!
! PUT x, y, z, angle
IF vinkel <> 0 THEN
ADD x, y, z
TEXT 0.005, 0, vinkel
DEL 1
LIN_ x - 0.01, y - 0.01, z - 0.01, x + 0.01, y + 0.01, z + 0.01
ENDIF
NEXT vinkel
RETURN
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2009-11-03 01:33 PM
Perhaps I'm missing something...
Do you know you can use the Circle command in 3d?...
Its in the GDL Reference Manual Page 61.
HTH.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2009-11-03 02:20 PM
I will use the TUBE and SWEEP commands in GDL.
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2009-11-03 07:33 PM
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?
At first it makes me wonder why not generate the coords in the xy plan an rotate it using transformations (RotX, RotY, RotZ)?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2009-11-03 10:17 PM
I just need a formula for calculating the X-coordinate. I think it's actually a matehematic problem.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2009-11-03 10:51 PM
Anne wrote:Cant you just DEL the ROT transformation to return the axis to a default position.
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.
I just need a formula for calculating the X-coordinate. I think it's actually a matehematic problem.
John Hyland : ARINA : www.arina.biz
User ver 4 to 12 - Jumped to v22 - so many options and settings!!!
OSX 10.15.6 [Catalina] : Archicad 22 : 15" MacBook Pro 2019 [/size]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2009-11-04 10:29 AM
But I can see by your code that you perfectly know how to use ROT AND DEL...

Sorry Anne, but I really can't understand why you can't use a simple transformation.

Perhaps if you could describe us whats the final purpose of the object we could help more effectively.
HTH.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2009-11-04 11:38 AM
(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.)
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.
So, that is why I want to make a routine like this.
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.
This is the background.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2009-11-04 12:14 PM

Do you know Andrew Watson's "GDL Handbook"?
In page 251 it has a wonderful 3d cubic spline that would do the job with more smooth and realistic effect.
Sorry I can't help you more.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2009-11-04 03:49 PM
I tested out my husbands brain yesterday. But his solution creates another interesting shape
