# cowcow

Member

66

7 Neutral

• Rank
Member

• Role
Programmer
• Interests
Art
Programming

## Recent Profile Visitors

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

1. ## Help on Optimization Problem for Tennis Ball Physics + prediction

I have coded something like this in 3D, but I lost the source code. I have no idea about applying optimizations. I would avoid optimizations until you have the rest of the code working successfully. Getting the ball's path in 3D space also must take into account the Magnus force. There is also a wind force, if you want to get physical. Here force F = ma, where a = F/m. Getting the server's ball's initial velocity and initial angular velocity, to solve for the region that you've mouse-clicked on, is not simple. The naive method is to serve many balls and find the one that lands closest to the mouse click. What method are you trying now? Are you familiar with the concept of gradient descent? Once you find the landing spot closest to the mouse click, you can use gradient descent to hone the location: https://en.wikipedia.org/wiki/Gradient_descent
2. ## Weird circular orbit problem

Holy cow. I'll implement that in my code sometime soon. Thank you so very much for the nice C++ code!
3. ## Weird circular orbit problem

Can you please provide some code for a symplectic integrator? I need the position vector length and velocity vector length to be constant over time, and RK4 seems to do the trick for the most part, well, much more than Euler integration does anyway. Not sure how much better a symplectic integrator could be.
4. ## Weird circular orbit problem

I finally found my old code for RK2 and RK4 -- it works way better with RK4 as the integrator. https://www.gamedev.net/forums/topic/626392-numerical-integration-methods/
5. ## Weird circular orbit problem

Yes. it was a typo. I got the formula from many sites, including this one: http://orbitsimulator.com/formulas/vcirc.html Trying the factor of 0.5, I get a very eccentric orbit. :(
6. ## Weird circular orbit problem

I am having a strange circular orbit problem. I set up the mass of the Sun, plus Mercury's initial orbit position and velocity: https://github.com/sjhalayka/mercury_orbit_glut/blob/a0213a84badf238618c19bc7eb08d1754a84cb9b/main.h#L50 I use these parameters to calculate Mercury's path through space, via Euler integration: https://github.com/sjhalayka/mercury_orbit_glut/blob/a0213a84badf238618c19bc7eb08d1754a84cb9b/main.cpp#L24 The problem is, if I set Mercury's initial velocity to be sqrt(G*sun_mass/distance), then there is still some eccentricity -- the distance and velocity vector length aren't constant, like you'd expect for a perfectly circular orbit. And the discrepancy is not small, the orbit velocity length varies by 100s of metres per second, so it's not a precision issue. Anyone have any idea why my code produces unwanted results? Thanks for your time and attention.
7. ## Shadows & Ocean Sky-box

That's #*@!in cool, man!
8. ## Books on Unreal Engine 4 and C++

Have you read any books on Unreal Engine 4 and C++? If so, which ones were good? Thanks!
9. ## In need of a PRNG program ASAP

https://en.cppreference.com/w/cpp/numeric/random
10. ## My Math Disability and Learning Calculus for Procedural Generation and Artificial Intelligence

Don't forget that Wolfram Alpha is there to help you calculate derivatives and integrals, if you find yourself stuck: https://www.wolframalpha.com/input/?i=derivative+of+cos(x) You can also unlock the step-by-step mode for an inexpensive price. This shows you how to calculate derivatives and integrals step-by-step: https://www.wolframalpha.com/pro/pricing/students/
11. ## Traveling Santa Problem

So I "solved" the problem by simply removing the municipality layer, and divide the cycle up into countries and provinces. Done.
12. ## Traveling Santa Problem

I have implemented countries and provinces, but I'm having a little bit of trouble with the municipalities: I have the municipal capitols working, but splitting the cities into municipalities seems to be problematic. I am not certain that line 137 is correct (https://github.com/sjhalayka/hamiltonian_cycle_3/blob/3f765ad83e8e52634d4947272d72396ed5cd2bc9/hcycle.cpp#L137). Same with line 238 (https://github.com/sjhalayka/hamiltonian_cycle_3/blob/3f765ad83e8e52634d4947272d72396ed5cd2bc9/hcycle.cpp#L238). Can anyone please help? Once I have this final step done, I will be able to make a normalized database that I can use to recursively find a solution to the TSP, with GA perhaps. I'm not worried about fixing it right away, since I'm not in it for the money. Not really sure why it's so difficult for me...
13. ## Traveling Santa Problem

Yeah, that's very cool!
14. ## Traveling Santa Problem

V-opt eh? Thanks for the advice.
15. ## Traveling Santa Problem

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?