# Tag Info

## Hot answers tagged vector-algebra

6

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 ...

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

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 - ...

5

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 ...

4

Assuming you've benchmarked this and are sure this is a bottleneck keep reading. If not stop. Don't worry and be happy :). It's true that you will need to run the collision check algorithm every time you fire a bullet. And depending on how long it takes the bullet/laser to disappear you will have to do it multiple frames. However when you implement a solid ...

3

IIRC: (might have mixed up left & right but that shouldn't matter) Line segment 1 is A to B Line segment 2 is C to D A line is a never ending line, the line segment is a defined part of that line. Check if the two bounding boxes intersect : if no intersection -> No Cross! (calculation done, return false) Check if line seg 1 straddles line seg 2 and ...

2

Take the diagram below; the normal is simply the deviation from the 'reference normal' for any given coordinate system, correct? No, it is not. The simplest way to understand this is to take the simplest possible case of bump mapping. Your geometry is a flat quad. And you're going to apply a normal map to this quad. Now, let's say that all of the ...

2

You can use scalar projection, i.e. the dot product, to do that. You want to project v2 onto v1, so normalize v1 to length 1, then take the dot product: float projection = dot(v2, normalize(v1)); This tells you how far you have to go in the direction of v1 until you are perpendicular to the end of v2, so float scalar = projection / length(v1); tells you ...

1

Im open XNA assembly with reflector and get answer. public Vector3 Up { get { Vector3 vector; vector.X = this.M21; vector.Y = this.M22; vector.Z = this.M23; return vector; } } public Vector3 Down { get { Vector3 vector; vector.X = -this.M21; vector.Y = -this.M22; ...

1

I'm not familiar with XNA, but front/back/left/right(top, bottom?) vectors could make sense in the context of a rotation matrix. If that's what they are about, you could get them by simply doing a matrix multiplication with the unit vectors. i.e. multiplying Matrix * [0,0,1,1], Matrix * [0,1,0,1], Matrix * [1,0,0,1] would give you the z,y, and x axes' ...

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