Java Code Examples for javax.vecmath.Vector3f#add()

The following examples show how to use javax.vecmath.Vector3f#add() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FaceBakery.java    From The-5zig-Mod with MIT License 5 votes vote down vote up
private void a(Vector3f vector, clz var1) {
	if (var1 != null) {
		Matrix4d var2 = this.a();
		Vector3f var3 = new Vector3f(0.0F, 0.0F, 0.0F);
		switch (var1.b) {
			case a:
				var2.mul(a(new AxisAngle4d(1.0D, 0.0D, 0.0D, var1.c * 0.017453292519943295D)));
				var3.set(0.0F, 1.0F, 1.0F);
				break;
			case b:
				var2.mul(a(new AxisAngle4d(0.0D, 1.0D, 0.0D, var1.c * 0.017453292519943295D)));
				var3.set(1.0F, 0.0F, 1.0F);
				break;
			case c:
				var2.mul(a(new AxisAngle4d(0.0D, 0.0D, 1.0D, var1.c * 0.017453292519943295D)));
				var3.set(1.0F, 1.0F, 0.0F);
		}

		if (var1.d) {
			if (Math.abs(var1.c) == 22.5F) {
				var3.scale(fieldA);
			} else {
				var3.scale(fieldB);
			}

			var3.add(new Vector3f(1.0F, 1.0F, 1.0F));
		} else {
			var3.set(1.0F, 1.0F, 1.0F);
		}

		this.a(vector, new Vector3f(var1.a), var2, var3);
	}
}
 
Example 2
Source File: FaceBakery.java    From The-5zig-Mod with MIT License 5 votes vote down vote up
private void a(Vector3f var, Vector3f var1, Matrix4d var2, Vector3f var3) {
	var.sub(var1);
	var2.transform(var);
	var.x *= var3.x;
	var.y *= var3.y;
	var.z *= var3.z;
	var.add(var1);
}
 
Example 3
Source File: Stroke.java    From justaline-android with Apache License 2.0 5 votes vote down vote up
private void subdivideSection(int s, float maxAngle, int iteration) {
    if (iteration == 6) {
        return;
    }

    Vector3f p1 = points.get(s);
    Vector3f p2 = points.get(s + 1);
    Vector3f p3 = points.get(s + 2);

    Vector3f n1 = new Vector3f();
    n1.sub(p2, p1);

    Vector3f n2 = new Vector3f();
    n2.sub(p3, p2);

    float angle = n1.angle(n2);

    // If angle is too big, add points
    if (angle > maxAngle) {
        n1.scale(0.5f);
        n2.scale(0.5f);
        n1.add(p1);
        n2.add(p2);

        points.add(s + 1, n1);
        points.add(s + 3, n2);

        subdivideSection(s + 2, maxAngle, iteration + 1);
        subdivideSection(s, maxAngle, iteration + 1);
    }
}
 
Example 4
Source File: Bezier3.java    From Robot-Overlord-App with GNU General Public License v2.0 5 votes vote down vote up
/**
 * interpolate between two Vector3f
 * @param a
 * @param b
 * @param i
 * @return
 */
protected Vector3f interpolate(Vector3f a,Vector3f b,float i) {
	Vector3f c = new Vector3f(b);
	c.sub(a);
	c.scale(i);
	c.add(a);
	return c;
}