Tag Info

Hot answers tagged

9

The graphics pipeline (typically) involves transformation from model space to world space, from world space to view space, and from view space to clip space. There is a transformation matrix associated with each of these (the world, view and projection transformations, respectively). There are of course stages of the pipeline after geometry reaches clip ...


4

Distance d is the integral of velocity v (calculus). Velocity v is the integral of acceleration a. If you start at velocity s, and you travel for time t, then distance will be d = s * t + 1/2 * a * t^2. You will have two cases. If the object does not reach maxspeed, then you'll have one part where you're accelerating and one part when you're ...


3

You get the path the same way you'd move the object when you shoot it. Just have a tight loop that simulates the movement of the object and keep track of the position every so often. Now you have a list of positions, if you draw a dot at each position, you have a dotted line the represents the path of the object if it were to be shot from that angle.


2

You wil want to subtract the touch with the ref point: //180 is inversed? 180 is when touch is on the right side... let dy = (touch.y - refPoint.y) //opposite let dx = (touch.x - refPoint.x) //adjacent This results in the (dx, dy) vector being from the refPoint to the touch point (as you would expect).


2

You're not taking into account the inverted Y axis in comparison to the normal X axis in most (maybe all?) programming languages. The top left corner of the screen is (0, 0), and is positive in the right and down directions. So if the bottom middle of your screen is, for example, (300, 400), and you click at (0, 400), then your triangle will be a first ...


2

A homogenous transformation matrix (aka a "World matrix") is a 4x4 matrix that defines the translation and rotation of one coordinate system with respect to another. It looks like this: H = [xx, xy, xz, tx; yx, yy, yz, ty; zx, zy, zz, tz; 0, 0, 0, 1]; (Note on notation: This just lays out the matrix row by row. Each row is separated by ...


2

Byte56's answer is very good, especially for the example image given where simulating the movement of each "ball" in the line will work well. I'll give you an alternative idea however which might work better, or might be easier to implement if you are trying to work with a dashed line (with or without animation), something like -- -- -- -- Calculate the ...


2

The camera analogy is a lie because there is no camera. Instead all that happens is a transformation of points in 3D space to points on a 2D screen, and the matrices define how that transformation happens. Modelview and projection are conceptually different although mathematically the same (it's all just matrix multiplication). Modelview just moves points ...


2

I also had exactly the same thoughts as you. For my final university project I studied different methods of voxel mesh smoothing. The best method I found was Surface Nets. It produces a result that looks very similar to March Cubes but without all that lookup table hassle. You can also choose how smooth you want the object by performing more passes of the ...


2

In this case, what is wrong with comparisons? It's (in this case) pretty easy, just if(abs(x) > abs(y) if(x > 0) q = "q2"; else q = "q4"; else if(y > 0) q = "q1"; else q = "q3"; Alternatively, you could do something like (hopefully I'll get this right) angle = atan2(y, x); angle -= pi/4; // now (0,pi/2) is all Q1 quadrant = angle / (pi/2); ...


1

Your drawings seem inconclusive with respect to axis names and signs. Just going by the first illustration, you could say approximately: _playerSpeedY = 2 _playerSpeedX = -1 // going to the left, negative! radians = atan2(_playerSpeedY, _playerSpeedX) degrees = radians * 57.29577951 I get radians = 2.0344439357957027 and degrees = 116.56505117080718 ...


1

You're on the right track. The method you describe gives an orthonormal basis for the plane, xAxis & yAxis. Now for any arbitrary point on (or off) the plane, offset = point - center uv = scale * (dot(offset, xAxis), dot(offset, yAxis)) You can also express this operation as a matrix multiplication if you prefer. It's an orthographic projection ...


1

If your 2D convex polygons are defined by an array of 2D Vectors then you are looking for line-line intersection or edge-edge intersection, whichever you prefer. This stackoverflow page has an advanced and precise algorith: http://stackoverflow.com/questions/2255842/detecting-coincident-subset-of-two-coincident-line-segments/2255848#2255848


1

Every point must be greater then 20 and less then 30 away from each other. Red is the Point. Purple is the radius 20 from point. If any point is placed here it means it is inside the radius of another point. Green is radius 30 from point. White is out side. No points should be placed here because it means that point will be 30 units away from any other ...


1

Here's something off the top of my head, trying to minimize expensive operations, without resorting to approximation hacks (ie. with infinite precision real numbers, the algorithm below is exactly correct, although in practice finite precision will introduce numerical errors). Recommendations/edits to improve performance are welcome. Let s be the start ...


1

This is a simple example of linear interpolation. In this formula: timeA and valueA are your first fixpoint timeB and valueB are your second fixpoint timeN and valueN are the point you are looking for valueN = valueA + (valueB-valueA) * ( (timeN - timeA) / (timeB - timeA) ) When you want a smoother interpolation around your fixpoints, you could go for ...


1

Just write a wrapper that takes your input and subtracts it from 100 float GetDamageInverse(int percent) { return GetDamage(100-percent); } Or you can change your equation to replace the 100 - SOURCE_PERCENT with SOURCE_PERCENT.



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