New answers tagged linear-algebra
3
Depending on the circumstances in some physics engines it may happen that two objects that overlap in one frame, and has their collision resolved, still overlap in the next frame. If they therefore have their collision resolved again it will typically reverse the original collision, resulting in the objects getting stuck together as they spend every second ...
3
Neither is better. They are different functions. Their appropriateness is determined by what you are trying to do.
//negate a variable
dx = -dx;
//force a variable to be positive or negative
dx = Math.Abs(dx);
dx = -Math.Abs(dx);
2
(1-1, 3+0) (1+0, 2+0) (1+0, 1+1) (2-1, 2+0)
That's not adding the origin back, that's adding your offset rotation to the initial values.
Adding the origin back looks like:
(0,-1) (0, 0) (0, 1) (-1, 0)
+(1, 2) (1, 2) (1, 2) (1, 2)
-----------------------------
(1, 1) (1, 2) (1, 3) (0, 2)
3
Your example is stuffed with bugs and inconsistencies, it is really hard to read, but your understanding error seems to be in sentence 4:
add the origin coordinates back to each resulting coordinate
That is not the original coordinates, but the coordinates of the origin that you are rotating around, so (1, 2) in the example case.
By the way, should ...
3
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 ...
2
You are experiencing a 2D version of a common rookie 3D mistake: order of transformation matters. Matrix multiplication is not commutative, i.e. A * B is different from B * A.
If you translate the Earth to its correct orbital radius before you rotate it according to the 24 hour clock, you will cause the earth to move along its orbital path (rotating a ...
4
you can concatinate 3 matrices
first a translation to put 1,1 at 0,0, then the rotation and then translate 0,0 back to 1,1
if you use affine transformation matrices this is easy
[1,0,-1][0,1,-1][0,0,1] * rotationMatrix * [1,0,1][0,1,1][0,0,1]
if you don't use affine transformations then just subtract 1,1 on each point then rotate around 0,0, then re-add ...
Top 50 recent answers are included
