Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - solomon

Pages: [1]
1
QB64 Discussion / Re: elliptic hyperboloid
« on: April 18, 2020, 10:57:16 am »
unfortunately the program I should use is qb64. I think it is not natural to limit it, but I have to come to the conclusion with the data I have. I'm sorry to say that I can't give feedback because I don't understand most of them. I really thank everyone who has worked. I try to reach the result around what I know. I think I cannot draw this form with the code I tried.

@Ashish and @_vince e thanx a lot, really good shape and turning :)
@Petr thanx :) I guess this shape is torus?

but what I want to tell before returning is
The ellipse forming the elliptical hyperboloid rotate and form the elliptic hyperboloid.
that is, the rotation in the formation of the shape.

When I run the shape, it doesn't need to rotate.

2
QB64 Discussion / Re: elliptic hyperboloid
« on: April 18, 2020, 03:26:06 am »
@STxAxTIC
I have beginner level knowledge and I have to draw this shape according to the code information I have.
also

Rotation algorithm:

Let there be a point P (x, y) in the plane. If we rotate this point counterclockwise around the origin by an angle of t (Theta), that point will come to the point Pt.
The coordinates of the Pt point are found as follows:
Pt.x = x * cos (t) - y * sin (t)
and
Pt.y = x * sin (t) + y * cos (t)

Code: QB64: [Select]
  1. TYPE point3d
  2.     x AS SINGLE
  3.     y AS SINGLE
  4.     z AS SINGLE
  5.  
  6. TYPE Elips
  7.     Center AS point3d
  8.     A AS SINGLE
  9.     B AS SINGLE
  10.  
  11. DIM elip AS Elips
  12. PRINT "please define elips:"
  13. INPUT "Elips Center (x, y): ", elip.Center.x, elip.Center.y
  14. INPUT "Elips 'A': ", elip.A
  15. INPUT "Elips 'B': ", elip.B
  16.  
  17. INPUT "Vertex number: ", n
  18.  
  19. OPEN "C:\scr\deneme2.scr" FOR OUTPUT AS #1
  20.  
  21.  
  22. CONST pi = 4 * ATN(1)
  23. dt = 2 * pi / n
  24.  
  25. DIM ElipsKoor(1 TO n) AS point3d
  26. FOR d = 1 TO n
  27.     t = (d - 1) * dt
  28.     r = Elips_R(elip.A, elip.B, t)
  29.  
  30.     DIM v AS point3d
  31.     v.z = 0
  32.     v.x = elip.Center.x + r * COS(t)
  33.     v.y = elip.Center.y + r * SIN(t)
  34.     ElipsKoor(d) = v
  35.  
  36.  
  37. INPUT "Elliptic hyperboloid height: ", h
  38.  
  39. DIM elip2 AS Elips
  40. PRINT "Please elip2 define:"
  41. INPUT "Elips2 Center (x, y): ", elip2.Center.x, elip2.Center.y
  42. INPUT "Elips 'A': ", elip2.A
  43. INPUT "Elips 'B': ", elip2.B
  44.  
  45. DIM Elips2Koor(1 TO n) AS point3d
  46. FOR k = 1 TO n
  47.     t2 = (k - 1) * dt
  48.     r2 = Elips_R(elip2.A, elip2.B, t)
  49.  
  50.     DIM v2 AS point3d
  51.     v2.z = h
  52.     v2.x = elip2.Center.x + r * COS(t2)
  53.     v2.y = elip2.Center.y + r * SIN(t2)
  54.  
  55.  
  56.  
  57. FOR d = 1 TO n
  58.     sv = d + 1
  59.     IF d = n THEN sv = 1
  60.     Write3DFace3 ElipsKoor(d), ElipsKoor(sv), Elip2Koor(k), Elip2Koor(sv)
  61.  
  62.  
  63. FUNCTION Elips_R (a AS SINGLE, b AS SINGLE, t AS SINGLE)
  64.     Elips_R = (a * b) / SQR((b * COS(t)) ^ 2 + (a * SIN(t)) ^ 2)
  65.  
  66.  
  67. SUB Write3DFace3 (v1 AS point3d, v2 AS point3d, v3 AS point3d)
  68.     PRINT #1, "3DFace"
  69.     WRITE #1, v1.x, v1.y, v1.z
  70.     WRITE #1, v2.x, v2.y, v2.z
  71.     WRITE #1, v3.x, v3.y, v3.z
  72.     PRINT #1, ""
  73.     PRINT #1, ""
  74.  
  75. SUB Write3DFace (v1 AS point3d, v2 AS point3d, v3 AS point3d, v4 AS point3d)
  76.     PRINT #1, "3DFace"
  77.     WRITE #1, v1.x, v1.y, v1.z
  78.     WRITE #1, v2.x, v2.y, v2.z
  79.     WRITE #1, v3.x, v3.y, v3.z
  80.     WRITE #1, v4.x, v4.y, v4.z
  81.     PRINT #1, ""
  82.     PRINT #1, ""
  83.  
  84. SUB WriteLine (v1 AS point3d, v2 AS point3d)
  85.     PRINT #1, "Line"
  86.     WRITE #1, v1.x, v1.y, v1.z
  87.     WRITE #1, v2.x, v2.y, v2.z
  88.     PRINT #1, ""
  89.  
  90.  

3
QB64 Discussion / Re: elliptic hyperboloid
« on: April 18, 2020, 03:19:16 am »
I am trying to draw elliptical hyperboloid using ellipse code in this code. I tried to define two ellipses. I don't know how successful it is. I am trying. but I think these ellipses have to turn. as in the video I added. but I can't find how these ellipses will rotate in the code section.

I will also assign the scr file of this code to the AUTOCAD drawing program. and I'll see the shape there.






@STxAxTIC, @_vince, @Petr

4
QB64 Discussion / Re: elliptic hyperboloid
« on: April 17, 2020, 11:03:57 am »
Could the rotation code be like this?

5
QB64 Discussion / Re: elliptic hyperboloid
« on: April 17, 2020, 11:01:20 am »
I don't know how to do the rotation code. I just tried to draw ellipse.

6
QB64 Discussion / Re: elliptic hyperboloid
« on: April 17, 2020, 10:51:54 am »
form like that;


I tried a code for this shape and added

7
QB64 Discussion / Re: elliptic hyperboloid
« on: April 17, 2020, 08:49:11 am »
Hello, I'm sorry, I am an architect student and I have never taken a code lesson during my education life. but firstly this semester I had 3 hours of lesson. and the corona virus appeared and lessons were canceled. so I asked for help. It was misunderstood. I'm doing a trial course. I will load what I tried.

8
QB64 Discussion / elliptic hyperboloid
« on: April 17, 2020, 03:37:10 am »
Hi everyone, I don't know how to write this code, can you help? this topic my homework. I need it very fast :(

[odin edit]: restored solomon's original post, so as not to make following replies sound out of context.

Pages: [1]