• Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

21307 Excellent


About alvaro

Personal Information

  • Interests

Recent Profile Visitors

41380 profile views
  1. You may want to finish implementing the diamond-square algorithm, since you have started it. But you should also consider using Perlin noise instead.
  2. I'm interested in item 4. We would have to build a parametric model of the speaker so we can then tweak the parameters to generate many new speakers. One way to make it happen would be to train something like WaveNet on multiple speakers, conditioning on a small vector that encodes information about the speaker. Part of that vector could describe gender and age, part of the vector could be a learned embedding of the accent (so we can label the speaker as having "British English accent", or "Southern American accent", etc.) and the rest of the vector would be a learned embedding of the speaker. We could then generate new speakers by specifying gender, age and accent, and then generating some random numbers for the specific speaker. While we are at it, the same conditioning mechanism could be used to indicate some rough emotion of the utterance, addressing item 3 to some extent. Does this sound feasible?
  3. Rotation in a sphere

    I'll make the sphere centered at the origin and with radius 1, for simplicity. Your position on the sphere is a unit-length vector, and your forward direction is another unit-length vector which is perpendicular to the position vector. That's the whole state. It's also handy to have a side direction, which can be computed as the cross-product of the other two vectors. You can move by adding a small multiple of the forward direction or the side direction to the current position. You can then renormalize the position (project back to the surface of the sphere, so you don't walk on a tangent) and use the Gram-Schmidt process to adjust the forward and side vectors. From the position, forward and side vectors, you should have all you need to set up the camera.
  4. C++ precision

    That's simple, but also unsafe. How large is the buffer `headingn'? At the very least, you should use snprintf instead. If you can avoid using C-style string manipulation, you are much less likely to introduce a buffer overflow in your program.
  5. C++ precision

    Or, if you don't mind using Boost, this: #include <iostream> #include <boost/format.hpp> #include <string> int main() { double x = 12.3524423; std::string s = boost::str(boost::format("%.2f") % x); std::cout << s << '\n'; }
  6. Gaussian based Weights

    Here's a short C++11 program that roughly produces the same numbers: #include <cmath> #include <iostream> int main() { double sigma = 1.75; int N = 4; double total = std::erf((N+.5) / (std::sqrt(2.0) * sigma)) - std::erf((-N-.5) / (std::sqrt(2.0) * sigma)); for (int i = -N; i <= +N; ++i) { std::cout << (std::erf((i+.5) / (std::sqrt(2.0) * sigma)) - std::erf((i-.5) / (std::sqrt(2.0) * sigma))) / total << '\n'; } }
  7. Simulated annealing is an easy way to find approximate solutions: Define a function that takes an assignment of people to rooms and returns a real number that indicates how unhappy we are with the assignment. This is probably just a weighted sum of penalties. We'll call this function "energy", following some analogy with Physics that I don't quite understand. Start with any assignment (everyone in the same room would do; or everyone unassigned, if you have a way to represent that). Set a temperature parameter T to some high initial value. Try a random perturbation (for instance, move one person to another room, or swap two people). If the energy goes down, accept it. If the energy goes up, accept it with probability exp((E_new - E_old) / T). Keep trying random perturbations and slowly decreasing the temperature parameter T. If you decrease the temperature slowly enough, this will find a low-energy solution. It's surprising how well that simple algorithm works for many discrete optimization problems. Sometimes you can easily compute the effect of a change on the energy, without computing it from scratch. Perhaps you have penalties per room and penalties per person, and you only need to reevaluate the room and people involved in the change. That can make the algorithm much faster.
  8. I see. So you think of the image as providing you with a probability distribution over colors: pick a random pixel in the image and check its color. Then the entropy of that probability distribution is well defined.
  9. I have spent many years writing engines that play games like checkers, chess and go. One thing that we learned as far back as the 80s is that hard-coded rules are fragile and have endless exceptions and unintended consequences. I wouldn't be surprised if we end up imbuing our agents with a sense of morality through examples, the way we do with children.
  10. This question is entirely unrelated with the topic of the forum (i.e., how to make the bad guys move in a video game). Please, feel free to post this kind of question in the lounge.
  11. No, I don't think energy is proportional to frequency. If you want a physical model to think about, think of the power dissipated by a resistor when alternating current is applied to it. You'll see that the power is proportional to the squared amplitude (I^2*R or V^2/R) and independent of the frequency. It is true that "entropy" is not quite the right word for the quantity -log(probability). The correct term is something like "information content", while "entropy" could be defined as "expected information content". But the notion of entropy only makes sense when applied to a probability distribution, not an individual image. Again, I would need to know where you picked up this term or what you want to use it for in order to give you a better answer.
  12. Energy is usually defined as the integral of the squared amplitude. Parseval's theorem says that you can compute this on the Fourier transform of the signal and you'll get the same answer. Entropy critically depends on having a probability distribution over images, and then it's simply defined as -log(probability).
  13. This is not how you use a forum. You can enter the question on Google and see what comes out. If that doesn't give you the results you want, you can try to use this forum. For us to be able to give you better answers than Google, you need to give us the appropriate context: What are you trying to do? What have you tried? What problems did you encounter? Where did you read about these concepts? I bet we can give you decent answers if you pose the question properly.
  14. Boids, a way not to check flock every update?

    You can use a spatial-partitioning method (e.g. quadtrees or kd-trees) to quickly discard most of the N^2 possible interactions. "Broad phase collision detection" could be a useful thing to search the web for.
  15. C++ 2D Math Problem

    If you know how to rotate around the origin, you can rotate around any point P like this: translate the whole picture so P becomes the origin, rotate around the origin, translate back so the origin becomes P Does that help?
  • Advertisement