Results 1 to 5 of 5

Thread: 3D Tubes: Knot and spiral with physics

  1. #1

    3D Tubes: Knot and spiral with physics

    i will post the code even it is still in spaghetti mode.
    to make a 3D tube, we plot the one dimensional curve point by point then we use frenet frame to extrude points from every point so it form a circle and after many circles (Bands) we connect the points with triangles, look:
    http://www.dbfinteractive.com/forum/...p?topic=5993.0

    download everything needed to run the 2 examples (code + xors3D dlls + pictures all in one folder) from here:
    https://www.mediafire.com/?ffbt3ahu0docy8p

    included:
    1- 3D knot from tube, with concave physical body, and a sphere run inside it
    2- spiral from tube

    you need the DirectX 9 installed in your machine
    http://download.microsoft.com/downlo...010_redist.exe

    Tested in windows xp/32

    knot_tube.JPG

    EDIT: to close the knot (approx) replace:
    While angle <= 2*Pi - 0.1
    with:
    While angle <= 2*Pi
    Last edited by primo; 20-05-2017 at 16:31.

  2. #2
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    67
    Posts
    3,869
    Rep Power
    404
    Really impressive Primo. Both of the examples ran at 61 fps!
    I will look through the code later to study, but just had fun running it right now to test.
    Again, very nice!
    Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
    Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server

  3. #3
    Thanks kryton9, there is not much documentation about xors3d but we can learn more from examples ,there is a version for purebasic here:
    https://github.com/Guevara-chan/Xors3D-for-PB
    which have much more examples from several years.
    there is also a short documentation file in the above link

    but there is not much talk about 3D in general in most basic languages forums.
    it is as if the users prefer 2D graphics.

    i have made an experiment, usually the owners of new computers don't like to install DX9 on there computers. so i have downloaded directx_Jun2010_redist.exe from microsoft, then we extract it to some folder, and since the files have *x86 and *x64 names, we need only x86 for xors3d, then from command prompt:
    C:\DX9>copy *x86.* c:\DX9_x86
    we then go to c:\DX9_x86 and select all the archives and with right click choose extract here, and overright all files. then we need only the dll files begins with d3dx9 it is smaller than x64 versions such as d3dx9_42.dll size is 1.8 MB for x86 while it is 2.4 for x64
    here is all dx9 dlls x86 files
    https://www.mediafire.com/?fu3yd9pvv631hyq
    i have tested the files in xors3d_thinbasic in a laptop with win10_x64 and it seems there is no DX9 installed on it since running the Knot example gives an error like this:
    TB_xors3d_error.jpg
    then i have copied all the DX9 dlls extracted in the above method to the xors3d_thinbasic folder and now the knot example works okay.
    so for distribution we need only to provide dx9 dlls without asking the user to install dx9 on his expensive machine. i am happy this method works , but still not sure for all windows machines which does not have DX9 installed explicitly on it.
    Last edited by primo; 21-05-2017 at 09:25.

  4. #4
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    67
    Posts
    3,869
    Rep Power
    404
    Since thinBasic is a Windows Development Language and anyone interested in 3D is probably also some sort of gamer, they probably have directx installed. DirectX 9 is was a great version for DirectX, so I wouldn't be worried about having it installed. Good to know you can just copy the dll's though. If I ever do a clean install again, I will try to remember that.
    Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
    Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server

  5. #5
    1-
    i have found how to convert your graphics with xors3d to OBJ file
    in the above example http://www.thinbasic.com/community/s...ll=1#post93604 ( https://www.mediafire.com/?ffbt3ahu0docy8p ) add after Line While IsFalse xKeyDown(%KEY_ESCAPE):

    If xKeyUp(%KEY_S) Then
       xSaveMesh(mesh,  "spiral")
    End If
    
    this will save the mesh to spiral.fbx if you press 'S' key
    now download Autodesk FBX Converter 2013, FBX® 2013.3 Converter: http://usa.autodesk.com/adsk/servlet...12&id=22694909

    how to use:
    to view your file spiral.fbx
    Tools -> add fbx viewer
    File -> choose your file
    =======================
    to convert the file to Obj or DXF or DAE collada
    Tools -> add fbx converter
    Add -> choose your fbx file
    Destination Format -> Obj ,DXF, DAE collada
    Convert
    ==============================================

    view your Obj file with a small good viewer :view3dscene from https://castle-engine.sourceforge.io/view3dscene.php

    ********************************************
    2-
    regarding running thinbasic xors3d without installing DX9, i have found that for the above specific knot and spiral examples it is enough to put d3dx9_36.dll only in the folder of the source code together with xors3d dlls files. surprisingly i can't do the same trick with purebasic in windows 10 without DX9
    Last edited by primo; 01-06-2017 at 09:52.

Similar Threads

  1. Sartre Physics
    By zak in forum Shout Box Area
    Replies: 3
    Last Post: 11-08-2011, 17:26
  2. primes spiral with labels (canvas example)
    By zak in forum UI (User Interface)
    Replies: 2
    Last Post: 30-07-2010, 21:07
  3. prime numbers spiral
    By zak in forum Math: all about
    Replies: 4
    Last Post: 08-06-2010, 09:02
  4. Opinions about Bullet Physics
    By cocoflop in forum Experimental modules or library interface
    Replies: 12
    Last Post: 13-06-2009, 11:50
  5. Sphere physics
    By Petr Schreiber in forum TBGL General
    Replies: 39
    Last Post: 20-07-2008, 16:24

Members who have read this thread: 1

Posting Permissions

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