Java Code Examples for toxi.geom.Vec3D#scale()
The following examples show how to use
toxi.geom.Vec3D#scale() .
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: AlignObjectsToSphere.java From haxademic with MIT License | 6 votes |
protected void firstFrame() { for(int i=0; i<boxes.length; i++) { // create a new direction vector for each box Vec3D dir=new Vec3D(cos(i*TWO_PI/75),sin(i*TWO_PI/50),sin(i*TWO_PI/25)).normalize(); // create a position on a sphere, using the direction vector Vec3D pos=dir.scale(SCALE); // create a box mesh at the origin AABB boxxx = new AABB(new Vec3D(), BOX_SIZE); TriangleMesh b= (TriangleMesh)boxxx.toMesh(); // align the Z axis of the box with the direction vector b.pointTowards(dir); // move the box to the correct position b.transform(new Matrix4x4().translateSelf(pos.x,pos.y,pos.z)); boxes[i]=b; } }
Example 2
Source File: GravityBehavior3D.java From toxiclibs with GNU Lesser General Public License v2.1 | 4 votes |
@Override public void setForce(Vec3D force) { this.force = force; this.scaledForce = force.scale(timeStep * timeStep); }
Example 3
Source File: ConstantForceBehavior3D.java From toxiclibs with GNU Lesser General Public License v2.1 | 4 votes |
/** * @param force * the force to set */ public void setForce(Vec3D force) { this.force = force; scaledForce = force.scale(timeStep); }