/** * converts the provided {@link Vector3f} into a {@link Color} object. * * @param vector3f The vector of three floats representing color * @return The color object */ public static Color of(Vector3f vector3f) { return new Color(Math.round(vector3f.getX()), Math.round(vector3f.getY()), Math.round(vector3f.getZ())); }
public Vector2f(Vector3f v) { this(v.getX(), v.getY()); }
public boolean isWithin(Vector3f vector) { Preconditions.checkNotNull(vector, "vector"); return Float.compare(vector.getX(), start.getX()) >= 0 && Float.compare(vector.getX(), end.getX()) <= 0 && Float.compare(vector.getY(), start.getY()) >= 0 && Float.compare(vector.getY(), end.getY()) <= 0 && Float.compare(vector.getZ(), start.getZ()) >= 0 && Float.compare(vector.getZ(), end.getZ()) <= 0; }
private static boolean isZero(Vector3f v) { return Math.abs(v.getX()) <= GenericMath.FLT_EPSILON && Math.abs(v.getY()) <= GenericMath.FLT_EPSILON && Math.abs(v.getZ()) <= GenericMath.FLT_EPSILON; }
public VectorNf(Vector3f v) { this(v.getX(), v.getY(), v.getZ()); }
/** * Copies the value from a specified {@link Vector3f} instance into a {@link Rotation} instance. * @param vector3f the vector to use * @return the Rotation instance */ public static Rotation fromVector3f(Vector3f vector3f) { Preconditions.checkNotNull(vector3f, "vector3f"); return new Rotation(vector3f.getX(), vector3f.getY(), vector3f.getZ()); }
/** * Creates a new quaternion from the rotation float angle in radians around the axis vector. * * @param angle The rotation angle in radians * @param axis The axis of rotation * @return The quaternion defined by the rotation around the axis */ public static Quaternionf fromAngleRadAxis(float angle, Vector3f axis) { return fromAngleRadAxis(angle, axis.getX(), axis.getY(), axis.getZ()); }
/** * Converts this complex to a quaternion by * using the provided vector as a rotation axis. * * @param axis The rotation axis * @return A quaternion of this rotation around the given axis */ public Quaternionf toQuaternion(Vector3f axis) { return toQuaternion(axis.getX(), axis.getY(), axis.getZ()); }
/** * Converts this complex to a quaternion by * using the provided vector as a rotation axis. * * @param axis The rotation axis * @return A quaternion of this rotation around the given axis */ public Quaternionf toQuaternion(Vector3f axis) { return toQuaternion(axis.getX(), axis.getY(), axis.getZ()); }
/** * Rotates a vector by this quaternion. * * @param v The vector to rotate * @return The rotated vector */ public Vector3f rotate(Vector3f v) { return rotate(v.getX(), v.getY(), v.getZ()); }
/** * Creates a new quaternion from the rotation float angle in radians around the axis vector. * * @param angle The rotation angle in radians * @param axis The axis of rotation * @return The quaternion defined by the rotation around the axis */ public static Quaternionf fromAngleRadAxis(float angle, Vector3f axis) { return fromAngleRadAxis(angle, axis.getX(), axis.getY(), axis.getZ()); }
/** * Rotates a vector by this quaternion. * * @param v The vector to rotate * @return The rotated vector */ public Vector3f rotate(Vector3f v) { return rotate(v.getX(), v.getY(), v.getZ()); }
public static Matrix4f createTranslation(Vector3f v) { return createTranslation(v.getX(), v.getY(), v.getZ()); }
public static Matrix3f createScaling(Vector3f v) { return createScaling(v.getX(), v.getY(), v.getZ()); }
public Matrix3f scale(Vector3f v) { return scale(v.getX(), v.getY(), v.getZ()); }
private static void addVector(TFloatList to, Vector3f v) { if (to != null) { to.add(v.getX()); to.add(v.getY()); to.add(v.getZ()); } }
public static void writeVector3f(ByteBuf buf, Vector3f vector3f) { writeFloatLE(buf, vector3f.getX()); writeFloatLE(buf, vector3f.getY()); writeFloatLE(buf, vector3f.getZ()); }
public static JsonObject serialize(Vector3f vector3f) { return JsonBuilder.object() .add("x", vector3f.getX()) .add("y", vector3f.getY()) .add("z", vector3f.getZ()) .build(); }
public static JsonObject serialize(Vector3f vector3f) { return JsonBuilder.object() .add("x", vector3f.getX()) .add("y", vector3f.getY()) .add("z", vector3f.getZ()) .build(); }