# Tag Info

8

If you do know the distribution you want, you can use rejection sampling. Simplest way: In the graph above, pick points at random until you find one is below the curve. Then just use the x-coordinate. For the actual distribution, there are various plausible approaches. For example, for planet number i at location p, and some strength parameter k (e.g. ...

4

New Answer: Lets look at the image. The player (represented by a circle) can jump to the left or to the right. What makes the difference is how much time passes since the moment the play jumps until the moments she lands on another platform. If we randomize a direction, either left or right and a value for time t than we can place a platform in that ...

3

Cross product the two vectors N = V x Z where N is the rotation axis. Calculate the angle to get an axis angle representation. dot( A, B) = len(A)*len(B)*cos(theta) if A and B where normalized vectors then dot( A, B) = 1 * cos(theta) So we can get the angle using cos-1 theta = cos-1( dot(A,B) ) 3.Now we have an axis angle representation ...

2

Prepare your polygon Set up your polygon as a directed sequence of points / lines. This is described in any point-in-polygon test, for which there are countless resources online and on Stackoverflow / Stackexchange, so I won't repeat here. Prepare your map for querying Assign every grid square a unique ID. Construct a list of all unique vertices ...

2

If the targets velocity is V and the interceptors desired speed is S: Calculate the normalized vector U between the interceptors current position and the targets current position Tp - Ip. Find a such that the length of Vi + aU equals S. aU is the desired speed. It will take distance / (Vi + aU).length time to intercept. If you get a negative value for a ...

1

I am not sure the problem is fully specified by the question, but I can provide some simple ideas, the second of these will provide numbers roughly in accordance with what your picture indicates you want. Either way as you may realize the distribution function is changing after each number generated, and has a memory (ie: it is non-Markovian) and either ...

1

If the incoming points are indeed represented as a vector then you have to touch every single one of them, or else you wouldn't be able to tell if it is within radius distance. But, you might be able to speed up your computation if you have control over the data structure used to represent your point set. For the sake of simplicity, let's assume the task ...

1

Add this to your Sprite creation: spatial.rotate90(false); This will rotate the sprite's texture 90 degrees. From the docs: Rotates this sprite 90 degrees in-place by rotating the texture coordinates. This rotation is unaffected by setRotation(float) and rotate(float).

1

Since vector V had been normalized you know the length of vector V and Z will be the same; V has length 1 since it had been normalized, and Z has length of 1 since it is( 0, 0, 1). Good job :D now the only thing left to take care of in order to make Z vector V is it's orientation. You will want to get rotation matrix of V then combine it with ...

1

The following code creates the desired result. _ViewMatrix = Matrix.CreateTranslation(-Position.X, -Position.Y, 0) * Matrix.CreateScale(_Zoom, _Zoom, 1.0f) * Matrix.CreateTranslation(_Width / 2, _Height / 2, 0.0f); This will cause the camera to zoom into the center of the screen instead of the top left corner. ...

Only top voted, non community-wiki answers of a minimum length are eligible