Categories
3d

Utils3D.projectVectors vs Utils3D.projectVector vs matrix.transformVector… note to self

just a note to self really…

given:
Utils3D.projectVectors(matrix, vertices, projected, uvt);
vector1 = Utils3D.projectVector(vector0);
vector2 = matrix.transformVector(vector0);

then:
projected[0] == vector2.x/vector2.w ≈≈ vector1.x
projected[1] == vector2.y/vector2.w ≈≈ vector1.y
uvt[2] == 1/vector2.w == 1/vector1.w

not sure why projectVector != projectVectors result but its close enough… wasted too much time trying to find out why they are not the same so any ideas on why that is – let me know!

1 reply on “Utils3D.projectVectors vs Utils3D.projectVector vs matrix.transformVector… note to self”

You may know this already as I’m a year late to this post, but floating point arithmetic has rounding errors due to limited precision. For more info read the wikipedia article on IEEE 754

Leave a Reply

Your email address will not be published. Required fields are marked *