• Content count

  • Joined

  • Last visited

Community Reputation

21246 Excellent

1 Follower

About alvaro

  • Rank

Personal Information

  • Interests

Recent Profile Visitors

37728 profile views
  1. Quadcopter simulation and PIDs

    What are the two forces involved? A PID that overshoots usually can be reigned in by tweaking the D term. You may need a smaller P term too.
  2. Real progress in AI requires a metric by which to evaluate progress. If you can define quantitatively how satisfied you are with the behavior of your agents, you can always tweak things to improve it. Otherwise, you'll be flying blind. What you describe is an open-ended project with ill-defined [if at all defined] goals. I don't believe this will lead anywhere. Hey, you asked.
  3. Resources to get good at math?

    If I had to come up with a formula for the rotation matrix you describe, I would probably start from the quaternion representation (axis-angle to quaternion is a fairly trivial formula, which is cos(theta/2)+sin(theta/2)*(u_x*i+u_y*j+u_z*k)) and then apply the rotation to (1,0,0), (0,1,0) and (0,0,1). That will give you the three columns of the matrix. It would probably take me like 10 or 20 minutes of computation.
  4. I watched the video on JPS+ and goal bounds. It's really interesting and I could probably reproduce it from the level of detail given in the talk, but it would be challenging.
  5. Resources to get good at math?

    I'm going to give you a different perspective, which may not be what you were looking for in this thread, but I want to put it out there anyway: Getting good at math is not about accumulating math knowledge, but about learning how to solve problems. When I use the word "problem" here I don't mean an exercise to verify that you understood and can immediately apply some math content you just learned. I mean something closer to a real-life situation, where it's not easy to see initially what the path to a solution might look like, you explore some, you find some patterns, you hypothesize and solve intermediate problems... Here's a good example: "We have 100 lockers, initially all closed, numbered 1 to 100. 100 people are going to pass by the lockers, and they are labelled 1 to a 100. Person 1 will visit all the lockers; person 2 will visit only the even lockers; person 3 will visit only the lockers whose numbers are multiples of 3; etc. When a person visits a locker, it changes its state; so if the locker was open they will close it, and if it was closed they will open it. So to be clear, person 1 will open all the lockers; person 2 will close all the even lockers and leave the odd ones open; person 3 will close locker 3 (because it was open), open locker 6 (because it was closed), etc. After all 100 people have pass by the lockers, how many of them will be open?" You only learn to solve such problems by practicing. Give it a try, and don't be frustrated if you don't get very far. There are spoilers later in this paragraph, so I recommend you stop reading now and try it. Try to simulate the situation by hand, perhaps substituting 100 by a more manageable number like 10. Perhaps you'll observe some pattern so now you just need to prove it. Or you'll find some way to reformulate the problem in simpler terms, something about how many divisors a number has. Maybe you will explore a few numbers in light of this reformulation and you'll learn how the divisors can be paired together in some natural way. Finally, you'll understand the problem in some new, more informative way, which will allow you to crack it. I don't know very many resources that teach this skill. There is a classic book by Pólya called "How to Solve It", which is a good place to start. There are websites with collections of problems, like Project Euler . Or perhaps you can find training materials for Math Olympiad. One point of view on math education is that all the algebra, geometry, combinatorics, etc. that we go through in school is just a collection of classic situations where we can hone our problem-solving skills. Once you get good at solving problems, any math content you learn becomes a tool in your belt, and having a good collection of tools allows you to solve more problems, or solve them more easily. But just teaching the content without actually solving problems is like giving someone a tool box and pretending they can now fix anything.
  6. C++ Well-defined shifts

    I for one think this is a good idea. I would like to be able to shift something to the left some number of times as a way to divide it by a power of 2. If I shift by too much, the result should be 0 (at least for unsigned integer types). The current C++ rules are written so shifts can be translated to machine-code shifts, and those have semantics that made the hardware easy to implement (usually several decades ago). There are natural semantics for shifts with any number of bits, and it would be good to have them available. A similar "feature" of C++ that bothers me even more is the rules on integer modulo and division when it comes to signs. a % b should always return a number in the interval [0, abs(b)), and a / b should round down. The fact that 7 % 10 and -3 % 10 can be different boggles the mind. The whole point of arithmetic modulo 10 is that you should not see any difference between numbers that are a multiple of 10 apart. Just ask your mathematician friends.
  7. If you can get an ear-clipping algorithm to work, try it. If that's not fast enough for your purpose, try something fancier. For instance, CGAL has functions for partitioning a polygon into convex polygons, and then triangulating those is trivial:
  8. 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.
  9. 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.
  10. 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;
  11. 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; ("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.]
  12. 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.
  13. 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: . No, you will not find an analytical solution to anything beyond n=3.
  14. 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.
  15.   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