Jump to content
  • Advertisement

cowcow

Member
  • Content Count

    54
  • Joined

  • Last visited

Community Reputation

4 Neutral

About cowcow

  • Rank
    Member

Personal Information

  • Role
    Programmer
  • Interests
    Art
    Programming

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. cowcow

    Traveling Santa Problem

    Yeah, that's very cool!
  2. cowcow

    Traveling Santa Problem

    V-opt eh? Thanks for the advice.
  3. I am trying to find a solution for the Kaggle Traveling Santa 2018 - Prime Paths contest (https://www.kaggle.com/c/traveling-santa-2018-prime-paths). Once my code is complete, it will become public domain, for anyone to use in the contest. I'm not in it for the money. I have tried several simple algorithms (including brute force), but they're not suitable for large numbers of cities (the Kaggle contest consists of ~200,000 cities). The next algorithm that I'm going to try will divide the cities up into countries, provinces, and counties. If I have 25 countries, 25 provinces per country, and 25 counties per province, then it works out to be roughly 13 or so cities per county. This way the maximum path segment is 25 vertices long. One can then just use one of the simpler algorithms (but not brute force), if they like, because the problem has been divided into simple chunks. Does anyone have any experience with the Traveling Salesman Problem? Care to share the algorithm that you used?
  4. cowcow

    Sharp / cusp knot cubic Bézier fitting

    You could drop the number of points down to 2 for those lines that are to be straight. https://en.wikipedia.org/wiki/Bézier_curve#Linear_Bézier_curves For reference, below is the C++ code that I use to calculate Bezier curves of arbitrary degree. I found the C version at https://stackoverflow.com/questions/785097/how-do-i-implement-a-bézier-curve-in-c vector_4 getBezierPoint(vector<vector_4> points, float t) { int i = points.size() - 1; while (i > 0) { for (int k = 0; k < i; k++) { points[k].x += t * (points[k + 1].x - points[k].x); points[k].y += t * (points[k + 1].y - points[k].y); points[k].z += t * (points[k + 1].z - points[k].z); points[k].w += t * (points[k + 1].w - points[k].w); } i--; } return points[0]; }
  5. I wrote a multithreaded, nonblocking TCP server: https://github.com/sjhalayka/tcpspeed3_multithreaded_listener
  6. cowcow

    Marching Cubes and Dual Contouring Tutorial

    I even performed Taubin smoothing on the mini-meshes. It didn't work out. I have code for it.
  7. I posted some code on GitHub, thanks to you guys: https://github.com/sjhalayka/python_cpp_interface_mat_char_array
  8. Thanks for the help!
  9. I'm trying to get void** pointers working with Python's ctypes. Has anyone ever had this kind of experience? I'm trying to print out the value 123.456f; in the Python code. My code is: #define DLLEXPORT extern "C" __declspec(dllexport) DLLEXPORT int func(void **ptr) { float *p = new float; p[0] = 123.456f; ptr = reinterpret_cast<void**>(&p); return 0; } and import ctypes as ct """ DLLEXPORT int func(void **ptr) """ lib = ct.CDLL("void_dll.dll") x = ct.pointer(ct.c_vo) lib.func(ct.byref(x)) print(x)
  10. cowcow

    FreeGLUT - Making Planets Orbit

    Maybe share your code on GitHub to see what went wrong. I think the idea of rotation is good, but it would only handle orbits that are circular (no eccentricity).
  11. cowcow

    FreeGLUT - Making Planets Orbit

    Just in case it's not clear... The gravitation constant G is 6.673e-11. The sun's mass M is 1.989e30. For the planet Mercury: The aphelion distance is 69817079000. The perihelion distance is 46001200000. The semi major axis A is the (perihelion distance + the aphelion distance) / 2 is 57909100000. The eccentricity e is 0.20563069. The orbit speed at aphelion is v = sqrt((G*M/A) * (1 - e)/(1 + e)) = 38860.5.
  12. cowcow

    FreeGLUT - Making Planets Orbit

    Yes, every time the idle function is called, one will do these things to calculate the position and velocity: https://gist.github.com/sjhalayka/a499a7f0429884bf3fd6ef38151ecd58 There is also this Mercury fact sheet, from which you can obtain the speed of mercury at perihelion (closest approach) and aphelion (furthest approach): https://nssdc.gsfc.nasa.gov/planetary/factsheet/mercuryfact.html That is, the speed (the length of the velocity vector) of Mercury at aphelion is 38860 metres per second, like in the code I posted. I'm not super experienced with scene graphs, sorry. In my code I don't use a scene graph -- I just alter the planet object's position and velocity, and then pass the position directly into glVertex3f(). That's right, I use OpenGL 1.x for the demo. All I know is that scene graphs become very important when it comes to solving for inverse kinematics? There's a hierarchy going on there? I checked out Mario Kart for Switch, and they got some serious physics + inverse kinematics to model the idle animations of the contestants. LOL
  13. cowcow

    FreeGLUT - Making Planets Orbit

    I also put up a C++/OpenGL 1.x/GLUT application that draws Mercury's path as it orbits the Sun. To start the simulation, the planet is placed at the aphelion (0, 69817079000, 0), with an initial velocity (-38860, 0, 0), and everything is taken care of from there. https://github.com/sjhalayka/mercury_orbit_glut Check out idle_func() in main.cpp. That's where the integration occurs.
  14. cowcow

    FreeGLUT - Making Planets Orbit

    You alter the position and velocity of each planet by integrating (adding). Your position is updated by the velocity, and the velocity is updated by the acceleration. Here is some math related to calculating a position and velocity for the orbiting body:
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!