I made a math vector class for thinBasic. It is focused on ease of use rather than efficiency. I based a lot of the methods of the class from the Processing language, hope that it might bring more users to thinBasic. Because of name conflicts in thinBasic I had to change my method names, but the functional use is there. You can download a zip from github here:
https://github.com/kryton9/thinBasic-cVec
cVec.tbasicu is the include file needed to use this class.
cVecUnitTests.tbasic is a complete unit test of this class. A good way to see the use of all the methods.
testcVecOutMethod.tbasic is a test focused more in depth on the out method of the class.
all tests green thanks to Primo
cVecTests.jpg
You don't need Git to use these files. Just follow the link and click on the following to download a zip file of all the needed code:
Click image for larger version.
gitUse.jpg
Last edited by kryton9; 10-05-2017 at 12:27.
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
Thanks a lot for using GitHub.
This improve thinBasic visibility.
Do you know ... #INCLUDE also works loading data directly from a web page.
If in GitHub you go into your source code file https://github.com/kryton9/thinBasic...r/cVec.tbasicu and click on raw, you will get direct file link and you can use into a script.
Of course you need to be connected on internet.
Example:
Uses "Console" #INCLUDE "https://raw.githubusercontent.com/kryton9/thinBasic-cVec/master/cVec.tbasicu" ' a 3d vector Dim t As cVec 10.12345678, 23.12345678, 5.12345678 PrintL "Testing out function for 3d vectors" t.out ' no parameters prints default 2 decimals, x and y and z t.out 1 ' prints 1 decimal, x and y and z t.out 2 ' prints 2 decimals, x and y and z t.out 3 ' prints 3 decimals, x and y and z t.out 4 ' prints 4 decimals, x and y and z t.out 5 ' prints 5 decimals, x and y and z PrintL PrintL ' a 2d vector Dim p As cVec 2.12345678, 12.12345678 PrintL "Testing out function for 2d vectors" p.out ' no parameters prints default 2 decimals, x and y p.out 1 ' prints 1 decimal, x and y p.out 2 ' prints 2 decimals, x and y p.out 3 ' prints 3 decimals, x and y p.out 4 ' prints 4 decimals, x and y p.out 5 ' prints 5 decimals, x and y PrintL PrintL "Press a key to end program" WaitKey
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
@Eros I had no idea, that is really cool to be able to do that. I will update my code, so it will be there as an option commented out.
@Michael That is what I thought, but I was getting errors with name conflicts with keywords.
Last edited by kryton9; 10-05-2017 at 12:28.
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
All updated and working.
http://www.thinbasic.com/community/s...ll=1#post93522
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
Hi Kent,
thanks a lot for this contribution!
I run into odd thingy - when I clone your repository, all files are immediately marked as changed.
Did you perform any specific setup of git on your PC by any chance?
Steps to replicate:
git clone https://github.com/kryton9/thinBasic-cVec.git git status
Petr
Last edited by Petr Schreiber; 11-05-2017 at 19:06.
Learn 3D graphics with ThinBASIC, learn TBGL!
Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB
Petr, github had driven me nuts. I tried both the desktop program and the command line shell, but I found many times it would say things were fine but when I manually checked the latest version was not where it should be.
So, I deleted the repositories and recreated but from then on have been manually uploading files and downloading them using the buttons
on the webpage at github.
This works best for me, but not great if working together with anyone else.
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
Hmm,
Kent, I will guide you through GitHub desktop application step by step. We need to crack this down!
For now, I would recommend to download the latest files, delete the repository (in Settings), create new with the same name and open it in GitHub for Desktop.
Once you reach this point, let me know here and I will guide you further. Deal?
Petr
Learn 3D graphics with ThinBASIC, learn TBGL!
Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB
I have done that Petr many times already, believe me. I will focus on the command line as you can do more there than with Desktop program. That is why I switched to the command line because it told me in the desktop program that it did all it could do and the rest would need to be done by command line.
Thanks for help offer.
I will do as you said and delete the repositories again and not upload manually.
Will post here when that is finished.
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
I am finished recreating the repositories Petr. I did notice, one of the repositories worked as expected, but the other didn't doing the same thing... I then realized it took 4 minutes for the second repository to show up. So perhaps my previous problems were not seeing the changes right away. I did use the GitHub Program.
Last edited by kryton9; 12-05-2017 at 15:03.
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
Bookmarks