diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..5472856 --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,18 @@ +{ + "configurations": [ + { + "name": "windows-gcc-x64", + "includePath": [ + "${workspaceFolder}/**" + ], + "compilerPath": "C:/mingw64/bin/gcc.exe", + "cStandard": "${default}", + "cppStandard": "${default}", + "intelliSenseMode": "windows-gcc-x64", + "compilerArgs": [ + "" + ] + } + ], + "version": 4 +} \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..a9941a8 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,35 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "C/C++ Runner: Debug Session", + "type": "cppdbg", + "request": "launch", + "args": [], + "stopAtEntry": false, + "externalConsole": true, + "cwd": "c:/Users/612500/ThinkPython", + "program": "c:/Users/612500/ThinkPython/build/Debug/outDebug", + "MIMode": "gdb", + "miDebuggerPath": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ] + }, + { + "name": "(Windows) Launch", + "type": "cppvsdbg", + "request": "launch", + "program": "enter program name, for example ${workspaceFolder}/a.exe", + "args": [], + "stopAtEntry": false, + "cwd": "${fileDirname}", + "environment": [], + "console": "externalTerminal" + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..09736b4 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,62 @@ +{ + "C_Cpp_Runner.cCompilerPath": "gcc", + "C_Cpp_Runner.cppCompilerPath": "g++", + "C_Cpp_Runner.debuggerPath": "gdb", + "C_Cpp_Runner.cStandard": "", + "C_Cpp_Runner.cppStandard": "", + "C_Cpp_Runner.msvcBatchPath": "C:/Program Files/Microsoft Visual Studio/VR_NR/Community/VC/Auxiliary/Build/vcvarsall.bat", + "C_Cpp_Runner.useMsvc": false, + "C_Cpp_Runner.warnings": [ + "-Wall", + "-Wextra", + "-Wpedantic", + "-Wshadow", + "-Wformat=2", + "-Wcast-align", + "-Wconversion", + "-Wsign-conversion", + "-Wnull-dereference" + ], + "C_Cpp_Runner.msvcWarnings": [ + "/W4", + "/permissive-", + "/w14242", + "/w14287", + "/w14296", + "/w14311", + "/w14826", + "/w44062", + "/w44242", + "/w14905", + "/w14906", + "/w14263", + "/w44265", + "/w14928" + ], + "C_Cpp_Runner.enableWarnings": true, + "C_Cpp_Runner.warningsAsError": false, + "C_Cpp_Runner.compilerArgs": [], + "C_Cpp_Runner.linkerArgs": [], + "C_Cpp_Runner.includePaths": [], + "C_Cpp_Runner.includeSearch": [ + "*", + "**/*" + ], + "C_Cpp_Runner.excludeSearch": [ + "**/build", + "**/build/**", + "**/.*", + "**/.*/**", + "**/.vscode", + "**/.vscode/**" + ], + "C_Cpp_Runner.useAddressSanitizer": false, + "C_Cpp_Runner.useUndefinedSanitizer": false, + "C_Cpp_Runner.useLeakSanitizer": false, + "C_Cpp_Runner.showCompilationTime": false, + "C_Cpp_Runner.useLinkTimeOptimization": false, + "C_Cpp_Runner.msvcSecureNoWarnings": false, + "cSpell.words": [ + "Thom" + ] +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..4035ce2 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,28 @@ +{ + "tasks": [ + { + "type": "cppbuild", + "label": "C/C++: gcc.exe build active file", + "command": "C:\\mingw64\\bin\\gcc.exe", + "args": [ + "-fdiagnostics-color=always", + "-g", + "${file}", + "-o", + "${fileDirname}\\${fileBasenameNoExtension}.exe" + ], + "options": { + "cwd": "${fileDirname}" + }, + "problemMatcher": [ + "$gcc" + ], + "group": { + "kind": "build", + "isDefault": true + }, + "detail": "Task generated by Debugger." + } + ], + "version": "2.0.0" +} \ No newline at end of file diff --git a/hello.c b/hello.c new file mode 100644 index 0000000..d912bd4 --- /dev/null +++ b/hello.c @@ -0,0 +1,7 @@ +#include + +int main(int argc, char const *argv[]) +{ + printf("Hello, World!\n"); + return 0; +} diff --git a/import sqlite3.py b/import sqlite3.py new file mode 100644 index 0000000..3bdab82 --- /dev/null +++ b/import sqlite3.py @@ -0,0 +1,16 @@ +import sqlite3 +from sqlite3 import Error + + +def create_connection(path): + connection = None + try: + connection = sqlite3.connect(path) + print("Connection to SQLite DB successful") + except Error as e: + print(f"The error '{e}' occurred") + + return connection + + +connection = create_connection("U:\\sm_app.sqlite") diff --git a/tube.c b/tube.c new file mode 100644 index 0000000..4e8cee2 --- /dev/null +++ b/tube.c @@ -0,0 +1,73 @@ +/* + * tube.c + * + * Thom Nijdam + */ +#include +#include +#include +#include + +#define PI 3.14159265359 +#define RADIAL (PI / 180) +#define TIMES 180 + +float tmp, y_start, x_start, x_end, outside_radius_brace; + +int main(void) +{ + float const rad = RADIAL; + float pi, A, r1, r2, Alpha, Alpha_hlp1, Alpha_hlp2, Alpha_hlp3; + float outside_diameter_leg, outside_diameter_brace, wall_thickness_brace, angle, outside_radius_leg, inside_radius_brace, x_axis[TIMES], y_axis[TIMES], units; + int i; + char unit; + + printf("\nEnter the following values:\n\n"); + printf("Dimensions Metric or Imperial [M/I]?: "); + scanf("%s", &unit); + printf("Outside diameter Leg\t\t: "); + scanf("%f", &outside_diameter_leg); + printf("Outside diameter Brace\t\t: "); + scanf("%f", &outside_diameter_brace); + printf("Wallthickness Brace\t\t: "); + scanf("%f", &wall_thickness_brace); + printf("Angle between Leg and Brace\t: "); + scanf("%f", &angle); + + if (angle > 90) + angle = 180 - angle; + if (toupper(unit) == 'I') + { + units = 25.4; + } + else + { + units = 1.0; + } + + /* + * Calculate the x-axis + */ + outside_radius_leg = (outside_diameter_leg / 2.0); + inside_radius_brace = (outside_diameter_brace - (2.0 * wall_thickness_brace)) / 2.0; + outside_radius_brace = (outside_diameter_brace / 2.0); + angle = angle * rad; + r1 = powf(inside_radius_brace, 2.0f); + r2 = powf(outside_radius_leg, 2.0f); + // Debug info + // printf("outside_radius_leg: %7.2lf, inside_radius_brace: %7.2lf, outside_radius_brace: %7.2lf, angle in rad: %lf\n", outside_radius_leg, + // inside_radius_brace, outside_radius_brace, angle); + for (i = 0; i <= 180; i += 10) + { + Alpha = i * 1.0f; + Alpha = Alpha * rad; + Alpha_hlp1 = sinf(Alpha); + Alpha_hlp3 = cosf(Alpha); + Alpha_hlp2 = powf(Alpha_hlp1, 2.0f); + A = 1.0f - sqrtf(1.0f - ((r1 / r2) * Alpha_hlp2)); + x_axis[i] = ((outside_radius_leg / sinf(angle)) * A) + ((inside_radius_brace / tanf(angle)) * (1.0f - Alpha_hlp3)); + y_axis[i] = fabsf(outside_radius_brace * Alpha_hlp3); + printf("x[%3i] = %8.3f, y[%3i] = %8.3f\n", i, x_axis[i], i, y_axis[i]); + } + system("pause"); +} diff --git a/tube.exe b/tube.exe new file mode 100644 index 0000000..4d05238 Binary files /dev/null and b/tube.exe differ