Tag Info

22

Yes, To name a few: Pannini Mercator Fisheye Miller The Pannini projection, for example, can capture wide fields of view in nice ways. (totally just my opinion) I think implementation details would be beyond the scope of this specific question. EDIT: Thanks for the comment, I did misspell Pannini. And to make this edit worthwhile here are a few more: ...

15

So long as the matrix M is invertible (which it generally will be, unless you're doing something very unusual), then computing the matrix inverse of M will give you a matrix that does what you want. That is, if M performs some transformation, inverse(M) performs the "opposite" transformation. Most matrix/vector libraries provide a means for computing the ...

14

Not a book, but you should check out the math curriculum over at the Khan Academy. I'm in the process of using these videos to brush up on my own math skills. They cover an extremely broad range of material, and the author has been praised for his teaching style. IMO, truly an amazing resource. http://www.khanacademy.org/#Linear Algebra

14

It depends on what you mean by "that could be used in a 3D system such as OpenGL". :) Narrowly speaking, 3D graphics hardware and APIs like OpenGL only deal correctly with linear projections - projections that map straight lines in world space to straight lines on the image. They never distort something into a curved shape (unless it was curved to begin ...

12

speed = constant_factor / distance With constant_factor at 60, you get: 50->function->1.2 20->function->3.0 If you want to damp the curve a bit, add an exponentiation: speed = (constant_factor / distance) ^ (1 / damping_factor) With constant_factor at 80, and damping_factor at 2, you get: 50->function->1.26 20->function->2.0 ...

11

The point is between the 2 parallel lines if it's one side of one line and the other side of the other line (providing the lines point in the same direction). You can use the top answer from this question at stackoverflow to work out which side of a line (defined by 2 points on it) a point lies on. An alternative method would be to calculate the distance ...

11

I use the following method which is pretty much just an implementation of this algorithm. It's in C# but translating it to ActionScript should be trivial. bool IsIntersecting(Point a, Point b, Point c, Point d) { float denominator = ((b.X - a.X) * (d.Y - c.Y)) - ((b.Y - a.Y) * (d.X - c.X)); float numerator1 = ((a.Y - c.Y) * (d.X - c.X)) - ((a.X - c....

10

Sergio you might want to aim more toward a Game Development math book like Essential Mathematics for Games and Interactive Applications, Second Edition: A Programmer's Guide Instead of the classical Linear Algebra you would learn in college. Also like Ron Warholic said, stating what your math comfort level is would better help us taylor a specific book.

10

Linear Algebra is the foremost discipline for 3d graphics programming simply because it's the mathematical language for describing spatial geometry. Your other three topics are really just subsets of linear algebra: Vectors are a way of thinking about points in space Matrices are ways of thinking about transformations of space and objects: translating ...

10

Why choose? You can have both. (Without any added complexity to logic and without any additional memory requirement thanks to unions.) struct Mat4 { union { struct { float m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44; }; float[...

10

Vector3 vT = v2 + headingNorm * 3; Be careful though, if v2 and v1 happen to be closer than 3 units away this will put you on the far side of v1. Maybe you want this to make the unit step back to make room for the attack. But then again be careful, because that means as you approach that attack point you will overshoot then correct and overshoot the ...

9

In openGl matrices are transposed in memory. So transpose the matrix is OK. But your code doesn't look correct. So you are in OpenGl. OpenGl uses right handed coordinate system. And for RH is lookat function defined like this: zaxis = normal(cameraPosition - cameraTarget) xaxis = normal(cross(cameraUpVector, zaxis)) yaxis = cross(zaxis, xaxis) xaxis.x ...

9

You'll need to duplicate the normal for the corner N times (where N is the number of "sides" it is shared amongst). If you try to use one value for all "sides," you'll end up averaging it, and your lighting will not appear to have that hard edge that you're looking for.

9

To get the 2D vector perpendicular to another 2D vector simply swap the X and Y components and negate the new Y component. So { x, y } becomes { y | -x }.

9

A 2D vector has two values (x and y), and it basically says how far you go from the point of origin in the x- and in the y-direction. For example, a vector of (3,4) goes 3 units in x direction and 4 units in the y direction, resulting in an angled line with a length of 5 (3² + 4² = 9+16 = 25, root of that is 5). So the vector basically gives you two pieces ...

7

First of all, re: "why we cannot just use the normalised sum of the sampled-normal vector, and the surface-normal?" If they're in the same space already, summing these two just has the effect of halving the strength of the normal map - it effectively blends 50% between the normal map and the non-normal-mapped geometric normals. If they're not in the same ...

7

Calculate a vector from B to A, normalize it (divide by the vector's length), then multiply by the circle size: vx = A.x - B.x vy = A.y - B.y length = sqrt(vx*vx + vy*vy) C.x = vx / length * size + A.x C.y = vy / length * size + A.y For the angle you can use the atan2 function, if your language has it.

6

This is by far the best ball to ball collision detection article I have come across. Pool Hall Lessons: Fast, Accurate Collision Detection Between Circles or Spheres

6

You can do that with different approaches; segment vs segment using parametric lines plus some verifications (because lines are not segments). segment vs box segment vs circle (this one would be my favorite) . But as you request for a segment vs segment intersection test, here is a pseudo C++ example extracted from the very interesting book "Real time ...

6

To get a smooth random walk, you could use Catmull-Rom splines. This kind of spline takes a sequence of points and generates smooth curves that pass through each point. So, you could generate random waypoints for the sprite to move through and animate it along a Catmull-Rom spline through the waypoints. For the spline to work you'll need a total of four ...

6

Ahh yes. I threw my math at it and I think I hit it. You're correct it does involve the Pythagorean theorem and some scaling. You start with your normalized vector that represents your ray. It has an x component and a y component. First we want to see how long it is when it travels one unit in the x direction. So what do we do? We want to scale the ...

6

Mathematically, the quantity you're asking about is called the operator norm. Unfortunately, there's no simple formula for it. If it's a fully general affine transformation - for instance, if it could have an arbitrary combination of rotations and nonuniform scales, in any order - then I'm afraid there's nothing for it but to use singular value ...

5

P = t * (B-A) + A Px = t * (Bx-Ax) + Ax Py = t * (By-Ay) + Ay Px - Ax Py - Ay ------- = ------- (Bx-Ax) (By-Ay) (By - Ay) Py = (Px - Ax) * --------- + Ay (Bx - Ax) (5 - -1) 6 Py = (Px - 2) * -------- + -1 = (Px -2) * --- - 1 (4 - 2) ...

5

For your first question, about vRayOrig & vRayDir, you should use what you need to use -- certainly the plane and the ray must be defined in the same space, or the results you get out of the intersection test will be meaningless. So you need to either define or transform the plane into the same space as the ray, or the other way around. For the second ...

5

Looks like V = p1 - p0. Since then t = 0 when p2 = p0, and t = 1 when p2 = p1.

5

Here is an algorithm for intersection only (doesn't cover touching) that I believe is fast. if t0, t1 and t2 are all on the same side of line P0P1, return NOT INTERSECTING if P0 AND P1 are on the other side of line t0t1 as t2, return NOT INTERSECTING if P0 AND P1 are on the other side of line t1t2 as t0, return NOT INTERSECTING if P0 AND P1 are on the ...

5

Short Answer Because adding two vectors together and normalizing the result will give you a vector that is halfway between the two of them. I don't think that corresponds to what you were thinking it would do. Long Answer Take for instance the following picture from an unrelated subject (Blinn-Phong shading model) and pay attention to the H vector: The ...

5

This answer still ignores the attempt to use matrix rotation, but I realized that there was a simple yet general solution. First, assuming that the shape is encoded as coordinates of blocks in a grid, you have an arbitrary shape containing blocks with coordinates in the X and Y axes from 0 to n, where n+1 is the maximum size of a block (traditional Tetris ...

5

You have incorrectly implemented the formula as a function. The function is missing + 1 after the call to Math.sin(), which moves the wave to the range [0, 2]. Regarding your second problem, I don't see anything wrong. In fact the screenshot looks exactly like it should and seems to match the plotted curve. Try with k=10 and you should see the difference ...

5

Why are all three lines of the formula seperated by commas? P(x,y,t) is a vector valued function. Its values are thus 3D vectors. The commas just separate these components, probably akin to a Matlab style of coding. D refers to a directional vector (i think) D is a 2D vector in the (x,y) plane. It describes the direction (and magnitude, if not ...

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