@Override public Vector3 run(double u, double v) { double x = u * (double)width; double y = 0.0; double z = v * (double)height; return new Vector3(x, y, z); } }, slices, stacks);
@Override public Vector3 getPoint(double t) { t = t * 4.0 * Math.PI; // Normalized to 0..1 double a = this.radius / 2.0f; double tx = a * (1.0 + Math.cos(t)); double ty = a * Math.sin(t); double tz = 2.0 * a * Math.sin(t / 2.0); return new Vector3(tx, ty, tz); } }
@Override public Vector3 getPoint(double t) { t *= 2.0 * Math.PI; double R = 10; double s = 50; double tx = s * Math.sin(t); double ty = Math.cos(t) * (R + s * Math.cos(t)); double tz = Math.sin(t) * (R + s * Math.cos(t)); return new Vector3(tx, ty, tz); }
/** * Translates object along x axis by distance. * @param distance * @return */ public Object3D translateX(double distance) { Vector3 v1 = new Vector3( 1.0, 0, 0 ); return this.translateOnAxis( v1, distance ); }
@Override public Vector3 getPoint(double t) { double fi = t * Math.PI * 2; double x = Math.cos(4.0 * fi) * (1.0 + 0.5 * (Math.cos(5.0 * fi) + 0.4 * Math.cos(20.0 * fi))); double y = Math.sin(4.0 * fi) * (1.0 + 0.5 * (Math.cos(5.0 * fi) + 0.4 * Math.cos(20.0 * fi))); double z = 0.35 * Math.sin(15.0 * fi); return new Vector3(x, y, z).multiply(this.scale); } }
public HemisphereLight(int skyColorHex, int groundColorHex, double intensity) { super(skyColorHex); this.groundColor = new Color( groundColorHex ); this.position = new Vector3( 0, 100.0, 0 ); this.intensity = intensity; }
/** * Translates object along z axis by distance. * @param distance * @return */ public Object3D translateZ(double distance) { Vector3 v1 = new Vector3( 0, 0, 1.0 ); return this.translateOnAxis( v1, distance ); }
public DirectionalLight(int hex, double intensity) { super(hex); setIntensity(intensity); this.shadowCascadeOffset = new Vector3(0, 0, -1000); }
@Override public Vector3 getPoint(double t) { double fi = t * Math.PI * 2.0; double x = Math.cos(3.0 * fi) * (1.0 + 0.3 * Math.cos(5.0 * fi) + 0.5 * Math.cos(10.0 * fi)); double y = Math.sin(3.0 * fi) * (1.0 + 0.3 * Math.cos(5.0 * fi) + 0.5 * Math.cos(10.0 * fi)); double z = 0.2 * Math.sin(20.0 * fi); return new Vector3(x, y, z).multiply(this.scale); } }
@Override public Vector3 getPoint(double t) { t = t * 4.0 - 2.0; double tx = Math.pow(t, 3.0) - 3.0 * t; double ty = Math.pow(t, 4.0) - 4.0 * t * t; double tz = 1 / 5.0 * Math.pow(t, 5.0) - 2.0 * t; return new Vector3(tx, ty, tz).multiply(this.scale); }
public ShadowLight(int hex) { super(hex); this.position = new Vector3(0, 1.0, 0); this.target = new Object3D(); }
/** * Translates object along y axis by distance. * @param distance * @return */ public Object3D translateY(double distance) { Vector3 v1 = new Vector3( 0, 1.0, 0 ); return this.translateOnAxis( v1, distance ); }
@Override public Vector3 getPoint(double t) { t = scaleTo(-4, 4, t); double tx = 2 / 5.0 * t * (t * t - 7.0) * (t * t - 10.0); double ty = Math.pow(t, 4.0) - 13.0 * t * t; double tz = 1 / 10.0 * t * (t * t - 4.0) * (t * t - 9.0) * (t * t - 12.0); return new Vector3(tx, ty, tz).multiply(this.scale); }
/** * Translate an object by distance along an axis in object space. The axis is assumed to be normalized. * @param axis A normalized vector in object space. * @param distance The distance to translate. * @return */ public Object3D translateOnAxis ( Vector3 axis, double distance ) { Vector3 v1 = new Vector3(); v1.copy( axis ).apply( this.quaternion ); this.position.add( v1.multiply( distance ) ); return this; }
public Vector3 center() { this.computeBoundingBox(); Vector3 offset = new Vector3(); offset.add( this.boundingBox.getMin(), this.boundingBox.getMax() ); offset.multiply( - 0.5 ); this.applyMatrix( new Matrix4().makeTranslation( offset.getX(), offset.getY(), offset.getZ() ) ); this.computeBoundingBox(); return offset; }
@Override public Vector3 getPoint(double t) { double tx = ShapeUtils.b2(t, this.v0.getX(), this.v1.getX(), this.v2.getX()); double ty = ShapeUtils.b2(t, this.v0.getY(), this.v1.getY(), this.v2.getY()); double tz = ShapeUtils.b2(t, this.v0.getZ(), this.v1.getZ(), this.v2.getZ()); return new Vector3(tx, ty, tz); } }