ID:2162438
 
(See the best response by Nadrew.)
So when I transform an atom with a matrix do I just change the graphics??

Also is it heavy on the proccesor??

I am using it to rotate my projectiles with the turn proc.
And projectiles are moved following a vector with Move() the matrix rotation wont mess up my bounds anyhow??
First time using a matrix and have a minimal idea of how they are implemented in byond.
Best response
The transform and related variables tell the client to alter the way something is drawn on their end, it's not really being processed on the server's end (animate() does require letting the server know which variables it has changed).

It uses very little processor power and it the best method of transforming and performing special drawing routines on anything.

Transforms don't change bounds, so you will need to account for shifts in transform that should change the bounding box on your own.
Thanks for the explanation.
Here's a little more background on matrices without getting too much in the weeds. There are, in general, three basic transforms you'll ever want to do to a set of coordinates:

Scaling is where you multiply the x and y coordinates by a scaling factor; it can be different scaling factors for both X and Y.

x' = x * sx
y' = y * sy

Translation is simply adding to the coordinates.

x' = x + tx
y' = y + ty

Rotation is of course when you want to rotate around an angle. (The math that shows how this works is kind of interesting, but no need to get into that.)

x' = x * cos(angle) + y * sin(angle)
y' = y * cos(angle) - x * sin(angle)

There's also skew, but that can be done by rotating, scaling, then rotating back; so no need to go into it.

The interesting thing about all of these transforms is that the equations are linear. That is, x' and y' (the new coordinates) can be defined strictly in terms of a multiple of x, a multiple of y, and a constant; there's no x2 or xy or anything like that. Matrices are part of linear algebra; they're perfect for dealing with these exact kinds of formulas.

Multiplying a vector (the original coordinates) by a matrix (the transform) can reproduce all of these formulas; you just have to know how to build the matrix, or in our case BYOND can do it for you. And you can combine multiple transforms.

The order that you multiply matrices in matters; A*B is not the same as B*A; in math we say that matrix multiplication is not commutative, unlike when you multiply regular numbers together. For transforms, this means that multiplying by one matrix and then by another is like doing those two transforms in that exact order. Doing them in a different order would produce a different result. (Example: If you rotate and then translate, you end up with a rotated icon at offset coordinates. If you translate and then rotate, it's like moving the icon out on a swing arm and then moving the arm around its center pivot.)

But matrices are associative, which means (A*B)*C = A*(B*C). And in the world of transforms, that means you can combine two or more transforms together into a single matrix just by multiplying them together in the order that you want. One matrix can represent an infinite number of transforms.