What's the deal with Deno? We talk with a major contributor to find out. Listen now.
23

An Affine Transform is a Linear Transform + a Translation Vector. $$ \begin{bmatrix}x'& y'\end{bmatrix} = \begin{bmatrix}x& y\end{bmatrix} \cdot \begin{bmatrix}a& b \\ c&d\end{bmatrix} + \begin{bmatrix}e& f\end{bmatrix} $$ It can be applied to individual points or to lines or even Bezier curves. For lines, it preserves the property that ...


7

I found a solution to my specific problem. Instead of computing the determinant and hitting the precision wall, I use the Gauss-Jordan method step by step. In my specific case of affine transformation matrices and the range of values I use, I don't hit any precision problem this way.


6

Note: I have answered before the edit from trichoplax and I thought you were searching for other transformations other than the one you mentioned. The informations below are still useful so I will keep the answer here, but it does not directly answer your question. Affine transformations (surprise!) map affine spaces to affine spaces. An affine space is ...


6

An affine transformation doesn't have enough freedom to do what you want. Affine transforms can be constructed to map any triangle to any other triangle, but they can't map any quadrilateral to any other quadrilateral. One way to see this is that the matrix for a 2D affine transform has only 6 free coefficients. That's enough to specify what it does to 3 ...


5

If you have a 3x3 matrix representing some transformation, you will actually have the X,Y,Z vectors of that transformation in the rows or columns (depending on if it's a row major or column major matrix). In other words, if you have a 3x3, you can look at it and immediately get the up, right(*), forward vectors (asterisk due to handedness, it could be the ...


4

In a linear transformation system, your origin is always a fixed point, since 0*anything = 0. So imagine you have a cinema screen, and the origin is at the centre of the screen. Using linear transformations, you can rotate, scale or shear the image, what you can't do is move it, since you have a fixed point in the middle. Now add a dimension, and move your ...


4

It is not necessarily affine. An affine matrix in homogeneous coordinates has a form like: $$\begin{bmatrix} a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23} \\ 0 & 0 & 1 \end{bmatrix}$$ (assuming you use a column vector convention). Here, the upper-left 2×2 submatrix is the linear part, and $(a_{13}, a_{23})$ is the ...


3

A matrix can be used to transform a coordinate system into a new one. More specifically, it can be used to transform the basis vectors of a coordinate system. That's how it defines a new coordinate system. It is of course always in relation to another coordinate system but that is often implicit. local coordinate system usually means a coordinate system ...


3

Because all matrices are column-major, the translation matrix $\mathbf{T}$ should be $$ \mathbf{T}=\begin{bmatrix} 1 & 0 & 0 & e_x \\ 0 & 1 & 0 & e_y \\ 0 & 0 & 1 & e_z \\ 0 & 0 & 0 & 1 \end{bmatrix} $$ I thought you mistakenly treat the eye as a row vector just because they were written as a single line in ...


2

For others who might have this question, here a perhaps more straight forward numeric answer (I'm now working myself on this book as well). Consider that: We are given object space coordinates that need to be transformed into upright and subsequently world space coordinates. We know that a vector $\vec{v}$ can be represented as a linear transformation of ...


2

A rotation around the x-axis is achieved by this matrix $$ \mathtt{T}_\mathrm{rot X} = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0& \cos \alpha & -\sin \alpha& 0 \\ 0 & \sin \alpha & \cos \alpha & 0 \\ 0 & 0 & 0 &1 \\ \end{bmatrix} $$ In order to rotate around the x-axis in the viewing space, one needs to ...


1

Let's talk about linear geometric transformations in homogeneous coordinates. In your question there are mainly two kind of geometric transformations involved: planar rotation and planar scaling, the computation-friendly analytical re-definitions of which are found hereUnified frameworks of elementary geometric transformations. The 2D homogenous rotation ...


1

Let me try to translate the problem statement in a mathematical way so that it can be understood more easily. Assume that the robot is at the position (1, 10, 3) Assume there are a set of basis $\mathbf{e}_i$ and origin $\mathbf{O}$, then the robot position $\mathbf{P}$ expressed in this basis is the origin plus a linear combination of the basis and the ...


1

Your understanding of the matrix structure in Q3 is correct. This code just does not construct a matrix explicitly and the matrix multiplication is applied implicitly. I think this part might cause your confusion. Instead of deciphering the code, I would rather derive the transform and compare it with the code. The affine (6 degrees of freedom) and ...


1

If I understand correctly, you want to draw 2 objects mirrored with respect to an arbitrary line. Then when you move 1 object you want the other (reflection) to move with respect to that reflected line. A more sophisticated way of doing this would be using transformation matrices. That way you wouldn't have to worry about moving the mirrored triangle. You ...


1

To mirror an object in relation to an arbitrary line, you first have to find the coordinates of that object in the frame of reference of that line. For convenience, we will define a frame of reference where the $X$ axis is colinear with the line itself and the $Y$ axis will be perpendicular to the line. Then, we can flip the Y coordinate in that frame of ...


1

You can put the translation first, and then the rotation, but have the translation happen in the direction of the cow's head. To do that, you need a vector from the center of the cow to its head. Then you need the length of the translation. You can then do the translation in that direction. Like this: float direction_x; float direction_y; float direction_z; ...


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