Search code examples
javajava-3d

Difference between Vector4f and Vector3f java3d


Can anyone explain me the difference between vector3f and vector4f

i know that vector3f contains of xyz however a vector4f contains xyzw

but what if I want to convert 3f to 4f what value i put for w as?


Solution

  • if you don't use the fourth value, set it to zero.

    there is a constructor for vector4f that takes a Tuple3f, and what that constructor does is set the W value to 0.

    Vector3f vector3 = new Vector3f(x,y,z);
    Vector4f vector4 = new Vector4f((Tuple3f)vector3);