I am trying to implement and understand how to perform a simple translation in GLSL. In order to do that, I am making a simple test in Octave to ensure that I am understanding the transformation itself.
I have the following vector that represents a 2D coordinates embedded into a 4 dimension vector:
candle = [1586266800, 11812, 0, 0]
Which means that the point has locations x=1586266800 and y=11812
.
I am trying to apply a translation using the following values:
priceBottom = 11800
timestampOrigin = 1586266800
Which means that the new origin of coordinates will be x=1586266800
and y=11800
.
I build the following translation matrix:
[ 1 0 0 tx ]
[ 0 1 0 ty ]
[ 0 0 1 tz ]
[ 0 0 0 1 ]
translation1 = [1, 0, 0, -timestampOrigin; 0, 1, 0, -priceBottom; 0, 0, 1, 0; 0, 0, 0, 1]
Is this matrix correct? How shall I apply it to the vector?
I have tried:
>> candle * translation1
ans =
1.5863e+009 1.1812e+004 0.0000e+000 -2.5162e+018
Which obviously does not work.