# alvaro

Members

7768

21240 Excellent

• Rank
Contributor

## Personal Information

• Location
New York (USA)

## Recent Profile Visitors

37634 profile views

1. ## |SOLVED| Rotation matrix multiplication causes Gimbal lock

That's closer, but I don't know what me is, or what SetAngles does. It probably doesn't take that much to turn what you posted into a complete C++ program that we can try.
2. ## |SOLVED| Rotation matrix multiplication causes Gimbal lock

I am not sure what you mean by those quaternions that are specified using only two numbers. At the very least you need three, and you have to be more descriptive that "[x: 35.21, y: 181.58]" if you want me to understand what you are saying. Just demonstrate your last post with the exact code you are using. I'll try to reproduce the results and see if I can figure out where the confusing is coming from.
3. ## |SOLVED| Rotation matrix multiplication causes Gimbal lock

I don't think the issue has to do with the matrix representation, and it certainly doesn't seem to be gimbal lock to me. Have you tried multiplying the matrices the other way around? me.rotation = CreateRotation( 5.0, 0.0, 0.0 ) * me.rotation;
4. ## C++ Problem with enum and binary or operator

It's not just allowed: It's completely idiomatic. Take for instance std::ios_base::openmode . I just looked at its implementation in gcc 7.1.0 and it's an enum, where a few constants have been defined as powers of 2 and you then use them like this: std::ofstream ofs; ofs.open ("test.txt", std::ofstream::out | std::ofstream::app); If you are not familiar with this idiom, you just don't know C++. [EDIT: By the way, in gcc 7.1.0 <bits/ios_base.h> defines the operators &, |, ^, ~, |=, &= and ^= for this type.]
5. ## C++ Problem with enum and binary or operator

This is very strange. Can someone point me to the part of the standard that says that a variable with an enum type can only hold values that are named constants? I have looked, and I haven't found it. Also, using powers of 2 as constants so you can do bit arithmetic is so common in C that I very much doubt C++ disallows it. EDIT: I found this paragraph in section 7.2: "For an enumeration whose underlying type is fixed, the values of the enumeration are the values of the underlying type. Otherwise, for an enumeration where e min is the smallest enumerator and e max is the largest, the values of the enumeration are the values in the range b min to b max , defined as follows: Let K be 1 for a two’s complement representation and 0 for a one’s complement or sign-magnitude representation. b max is the smallest value greater than or equal to max(|e min | − K, |e max |) and equal to 2 M − 1, where M is a non-negative integer. b min is zero if e min is non-negative and −(b max + K) otherwise. The size of the smallest bit-field large enough to hold all the values of the enumeration type is max(M, 1) if b min is zero and M + 1 otherwise. It is possible to define an enumeration that has values not defined by any of its enumerators. If the enumerator-list is empty, the values of the enumeration are as if the enumeration had a single enumerator with value 0." In Hodgman's example, b min is 0 and b max is 7. So cases 0, 5, 6 and 7 are kosher.
6. ## Gravity systems?

This is the  eternal issue, isn't it. What bothers me is that my brain keeps telling me that there should be a way to compress all the forces into a single equation (possibly one per particle) and find the position of the particle as a function of time. Like if you calculate two bodies influencing each other; you can (to simplify it) calculate a barycenter and simply input the point in time you want to sample their positions and voila, the equation returns the positions. There would be no need for timestep, and CPU pressure is next to nothing (compared tot he current options available, anyway). I have even done some theoretical work on how to move from two to three bodies, hoping that it will let me figure out how to do it with n bodies, but it seems a bit.... challenging. So for now, lesser methods apparently need to be used.... I really can't tell if you are trolling, at this point. I'll feed you a Wikipedia page about the subject: https://en.wikipedia.org/wiki/N-body_problem . No, you will not find an analytical solution to anything beyond n=3.
7. ## Gravity systems?

If you give particles a radius, so they represent ghostly spheres that can go through each other, the force between two particles is proportional to the 1/distance^2 if they are farther away than 2 radii, but it's proportional to distance if the spheres intersect. That gets rid of the problem of huge forces when the particles are too close together.
8. ## perceptive height and width of object from distance

i think formula will lok like : 1/(100-D) because for example if distance of screen from eye is 10 meter. so it means if you want goal to be look like in 100 meter so goal have to be look like 90 meter distant. am I right? +----------+ ^ | / | | / | | / | | / | | / 100 | / | +---+--- ^ | | / | | | / D | |/ | | * v v Picture the eye at the `*' in that diagram. The screen is at a distance D and the object is at a distance 100. There are two similar triangles in that diagram, so you can see that apparent_size / D = real_size / 100 So apparent_size = real_size * D / 100
9. ## perceptive height and width of object from distance

You are missing [at least] one important number. Let's imagine there is a screen in front of the viewer, at a fixed distance D. Then 1 meter at 100 meters of distance will appear as something at the screen with size 1*(D/100)). You can get that formula by drawing a simple picture of the situation and identifying similar triangles.
10. ## Neural Network AI Discussion Group

I doubt he has that. Sometimes all you have is a database of previous games, where you have game situations you can feed into a neural network and have it try to predict the outcome of the game. You train an ANN to estimate the expected reward at the end of the game, which can then be used in a utility-maximization setup.
11. ## How to create through C++ code a drop-down toolbar like this one?

I know nearly nothing about VS but, why did you make it a "Console Application" if you want a GUI?
12. ## Gravity systems?

This is a huge area of study. You can easily make a PhD thesis about this, and many people have. So you have N particles that interact through gravity. You would normally model them as spheres of uniform density and fixed radius, so when two of them get really close things don't blow up. You then need to do two things per time step: (1) Compute the net force on each particle. (2) Integrate the equations of motion. (1) is the expensive part. Naively, it takes time proportional to N^2. It turns out there is some very clever trick called the "multipole method" that is explained terribly in the papers I have found, but it can approximate (to very high precision) the forces really well using time O(N). I have only ever needed a 1-D version of this and it was quite challenging. I don't know how much harder it would be in 3D.
13. ## Breaking out of for loop

How about this? void CInputManager::SetRawButtonState(const RAW_BUTTON pButton, const bool pState, const bool pPrevState) { for(auto &context : mContexts) { if(!context.IsActive()) continue; if(pState && !pPrevState && context.MapButtonToAction(pButton)) break; if(context.MapButtonToState(pButton, pState)) break; } }
14. ## Neural Network AI Discussion Group

No, Giraffe's Elo on CCRL 40/4 is 2411, which is quite mediocre. There are many engines that are hundreds of Elo points stronger, including my own, RuyDos.
15. ## Neural Network AI Discussion Group

Actually, I am not so sure. There have been several attempts at using neural networks for chess, and the results are generally poor. I've tried myself without much success. My last attempt was this past weekend, when I tried to train a very simple ANN to learn the value of material imbalances (including subtleties like the strength of the pair of bishops, the loss of value of the bishop with the presence of lots of your own pawns, etc.). I couldn't get it to work better than a few hand-crafted rules, and that seems to always be the story with chess.