Results 1 to 1 of 1

Thread: Simple Beautiful Curves

  1. #1

    Simple Beautiful Curves

    i have found these shapes while experimenting with a variations of the Mystery Curve i have posted before here.
    triangleX.PNGtoonX.PNGhexagonX.PNG
    note that they all have smooth vertices, look at the triangle carefully it has a slight concave edges so i consider it beautiful. it is suitable as a road sign, and all the people in the city will wonder why the Municipal make the sign concave a little !!.
    some suggestions for other shapes:
    1-to make it a convex triangle change s2 = 1/3 to s2 = 1/7
    2- s = 1/19: s2 = 1/6 ' toon triangle
    k = 3
    suitable for Fred Flintstone mathematics school and also as a funny road sign
    3- s = 0: s2 = 1/19 ' hexagon
    k = 6 ' k=4 'square
    4- uncomment lines 63 and 64 and you get full circle
    there are many shapes by just changing the parameters.
    5- note that they all can be considered a deformation of a circle made by a sewing thread manually
    6- the usefulness of plotting these shapes in 3D engine instead of 2D canvas is to be able to rotate the shapes in any direction, and to be able to look at it from any perspective, also we can surround the curves by tubes (as demonstrated somewhere here) for 3D printing

    Uses "TBGL"
    Uses "math"
    Begin Const
      %listPoints = 1
    End Const
    
    Function TBMain()
      Local hWnd      As DWord
      Local FrameRate As Double
      ' -- Create and show window
      hWnd = TBGL_CreateWindowEx("Triangle proposed as a Road Sign - press ESC to quit", 600, 600, 32, %TBGL_WS_WINDOWED)' Or %TBGL_WS_CLOSEBOX) 
      TBGL_ShowWindow 
      TBGL_BackColor 255,255,255 
      
      FillArrays ' call the sub to create the List of vertices and color
        
      ' -- Resets status of all keys 
      TBGL_ResetKeyState()
      TBGL_PointSize 2 'if you want thick points uncomment this line
        ' -- Main loop
      While TBGL_IsWindow(hWnd)
      'init 
        FrameRate = TBGL_GetFrameRate
        TBGL_ClearFrame
          TBGL_Camera(0, 0, 5, 0, 0, 0)
          ' -- Turn triangle around Z axis
          TBGL_Rotate GetTickCount/50, 0, 0, 1
          
          ' -- Render it                              
          TBGL_CallList %listPoints
          TBGL_DrawFrame
         ' -- ESCAPE key to exit application
        If TBGL_GetWindowKeyState(hWnd, %VK_ESCAPE) Then Exit While
      Wend       
      ' -- Destroying the buffer is not necessary,
      ' -- the garbage collector will take care of it
      
      ' -- Destroy window
      TBGL_DestroyWindow
    End Function 
     
    Sub FillArrays()
    Dim x, y, z, t As Single
    Dim N As DWord = 1
    local s, s2, k as single
    
    s =  0:  s2 = 1/3 ' triangle
    k = 3
    
    's =  1/19: s2 = 1/6 ' toon triangle
    'k = 3
    
    's = 0: s2 = 1/19 ' hexagon
    'k = 6
    
    TBGL_NewList %listPoints
    TBGL_BeginPoly(%GL_POINTS)   
        
    While t <= 2*Pi
              
             x = s*Sin(t)* Sin(k* t) - s* Cos(k* t)* Cos(t) + Cos(t) + s2* Sin(k* t)* Cos(t) - s2* Sin(t)* Cos(k* t)
             y = Sin(t) + s2* Sin(t)* Sin(k* t) + s2* Cos(t)* Cos(k* t) - s* Sin(t)* Cos(k* t) - s* Sin(k* t)* Cos(t)
             'x = Cos(t) + s* Sin(k* t)* Cos(t) - s* Sin(t)* Cos(k* t)
             'y = Sin(t) + s* Sin(t)* Sin(k* t) + s* Cos(t)* Cos(k* t)
              
              TBGL_Color 255, 0, 0
              TBGL_Vertex x, y , z
              t + 2*PI/1000               
        
    Wend
    TBGL_EndPoly
      TBGL_EndList
      
    End Sub
    
    Last edited by primo; 22-07-2018 at 14:06.

Similar Threads

  1. searching for Curves and Surfaces in the space
    By primo in forum TBGL General
    Replies: 10
    Last Post: 17-10-2017, 15:25
  2. Nice Windows 8 ad with a beautiful end
    By ErosOlmi in forum Technology
    Replies: 2
    Last Post: 26-12-2012, 05:06
  3. Beautiful view on Earth
    By Petr Schreiber in forum Shout Box Area
    Replies: 1
    Last Post: 15-11-2011, 09:45
  4. Replies: 1
    Last Post: 19-10-2010, 17:55
  5. Data can be beautiful
    By kryton9 in forum Shout Box Area
    Replies: 0
    Last Post: 29-07-2008, 07:17

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •