Examples of Transform


Examples of com.bulletphysics.linearmath.Transform

        // For every physics ball ...
        for (RigidBody body : balls) {
            // Push the model-view matrix.
            glPushMatrix();
            // Retrieve the ball's position from the JBullet body object.
            Vector3f ballPosition = body.getWorldTransform(new Transform()).origin;
            // Translate the model-view to the ball's position.
            glTranslatef(ballPosition.x, ballPosition.y, ballPosition.z);
            // Draw the controllable ball green and the uncontrollable balls red.
            // Set the draw style of the sphere drawing object to GLU_SILHOUETTE.
            // LWJGL JavaDoc: "The legal values are as follows: GLU.FILL: Quadrics are rendered with polygon primitives.
View Full Code Here

Examples of com.bulletphysics.linearmath.Transform

        // Create a set of bodies that are to be removed.
        Set<RigidBody> bodiesToBeRemoved = new HashSet<RigidBody>();
        // For every physics ball ...
        for (RigidBody body : balls) {
            // Retrieve the ball's position from the JBullet body object.
            Vector3f position = body.getMotionState().getWorldTransform(new Transform()).origin;
            // If the ball is non-controllable and it is outside the world borders, add it to the set of bodies
            // that are to be removed.
            if (!body.equals(controlBall) && (position.x < -50 || position.x > 50 || position.z < -50 || position.z > 50)) {
                bodiesToBeRemoved.add(body);
            }
        }
        // For every physics ball that is to be removed ...
        for (RigidBody body : bodiesToBeRemoved) {
            // Remove it from the JBullet world.
            dynamicsWorld.removeRigidBody(body);
            // Remove it from the list of balls.
            balls.remove(body);
        }
        // If the attraction between the green ball and the camera is enabled ...
        if (applyForce) {
            // Retrieve the controllable ball's location.
            Transform controlBallTransform = new Transform();
            controlBall.getMotionState().getWorldTransform(controlBallTransform);
            Vector3f controlBallLocation = controlBallTransform.origin;
            Vector3f cameraPosition = new Vector3f(camera.x(), camera.y(), camera.z());
            // Calculate the force that is applied to the controllable ball as following:
            //  force = cameraPosition - controlBallLocation
            Vector3f force = new Vector3f();
            force.sub(cameraPosition, controlBallLocation);
            // Wake the controllable ball if it is sleeping.
            controlBall.activate(true);
            // Apply the force to the controllable ball.
            controlBall.applyCentralForce(force);
        }
        // If a new shape should be created ...
        if (createNewShape) {
            // Create the collision shape (sphere with radius of 3 metres).
            CollisionShape shape = new SphereShape(3);
            // Create the motion state (x and z are the same as the camera's).
            DefaultMotionState motionState = new DefaultMotionState(new Transform(new Matrix4f(new Quat4f(0, 0, 0, 1), new Vector3f(camera.x(), 35, camera.z()), 1.0f)));
            // Calculate the inertia (resistance to movement) using the ball's mass of 1 kilogram.
            Vector3f inertia = new Vector3f(0, 0, 0);
            shape.calculateLocalInertia(1.0f, inertia);
            RigidBodyConstructionInfo constructionInfo = new RigidBodyConstructionInfo(1, motionState, shape, inertia);
            constructionInfo.restitution = 0.75f;
            RigidBody rigidBody = new RigidBody(constructionInfo);
            balls.add(rigidBody);
            dynamicsWorld.addRigidBody(rigidBody);
            createNewShape = false;
        }
        // If the controllable ball's position and orientation should be reset ...
        if (resetControlBall) {
            // Set the position of the ball to (0, 50, 0).
            controlBall.setCenterOfMassTransform(new Transform(new Matrix4f(new Quat4f(0, 0, 0, 1), new Vector3f(0, 50, 0), 1.0f)));
            // Reset the angular velocity (spinning movement) of the ball.
            controlBall.setAngularVelocity(new Vector3f(0, 0, 0));
            // Reset the linear velocity (x,y,z movement) of the ball.
            controlBall.setLinearVelocity(new Vector3f(0, 0, 0));
            resetControlBall = false;
View Full Code Here

Examples of com.bulletphysics.linearmath.Transform

        PhysicsSphere(Vector4f colour, Vector3f position, DynamicsWorld physicsWorld, float mass, float radius, int slices, int stacks) {
            this.colour = colour;
            this.radius = radius;
            this.slices = slices;
            this.stacks = stacks;
            MotionState motion = new DefaultMotionState(new Transform(new Matrix4f(new Quat4f(0, 0, 0, 1), position, 1.0f)));
            CollisionShape shape = new SphereShape(radius);
            this.physicsBody = new RigidBody(mass, motion, shape);
            this.physicsWorld = physicsWorld;
            this.physicsWorld.addRigidBody(physicsBody);
            this.renderSphere = new org.lwjgl.util.glu.Sphere();
View Full Code Here

Examples of com.emitrom.lienzo.client.core.types.Transform

    {
        if (context.isDrag() || isVisible())
        {
            context.save();

            Transform xfrm = getCombinedTransform();

            context.transform(xfrm);

            drawWithoutTransforms(context);
View Full Code Here

Examples of com.google.appengine.api.images.Transform

        float leftX = (float) LX / original.getWidth();
        float topY = (float) TY / original.getHeight();
        float rightX = (float) RX / original.getWidth();
        float bottomY = (float) BY / original.getHeight();

        Transform crop = ImagesServiceFactory.makeCrop(leftX, topY, rightX,
                bottomY);
        imagesService.applyTransform(crop, copy);

        return copy;
    }
View Full Code Here

Examples of com.google.test.metric.method.op.stack.Transform

  public void visitJumpInsn(final int opcode, final Label label) {
    if (opcode == Opcodes.GOTO) {
      recorder.add(new Runnable() {
        public void run() {
          block.addOp(new Transform(lineNumber, "GOTO", null, null, null));
          block.unconditionalGoto(label);
        }
      });
    } else if (opcode == Opcodes.JSR) {
      recorder.add(new Runnable() {
        public void run() {
          block.jumpSubroutine(label, lineNumber);
        }
      });
    } else {
      recorder.add(new Runnable() {
        public void run() {
          cyclomaticComplexity.add(lineNumber);
          switch (opcode) {
            case Opcodes.IFEQ :
              if1("IFEQ");
              break;
            case Opcodes.IFNE :
              if1("IFNE");
              break;
            case Opcodes.IFLT :
              if1("IFLT");
              break;
            case Opcodes.IFGE :
              if1("IFGE");
              break;
            case Opcodes.IFGT :
              if1("IFGT");
              break;
            case Opcodes.IFLE :
              if1("IFLE");
              break;
            case Opcodes.IFNONNULL :
              if1("IFNONNULL");
              break;
            case Opcodes.IFNULL :
              if1("IFNULL");
              break;
            case Opcodes.IF_ACMPEQ :
              if2("IF_ACMPEQ");
              break;
            case Opcodes.IF_ACMPNE :
              if2("IF_ACMPNE");
              break;
            case Opcodes.IF_ICMPEQ :
              if2("IF_ICMPEQ");
              break;
            case Opcodes.IF_ICMPGE :
              if2("IF_ICMPGE");
              break;
            case Opcodes.IF_ICMPGT :
              if2("IF_ICMPGT");
              break;
            case Opcodes.IF_ICMPLE :
              if2("IF_ICMPLE");
              break;
            case Opcodes.IF_ICMPLT :
              if2("IF_ICMPLT");
              break;
            case Opcodes.IF_ICMPNE :
              if2("IF_ICMPNE");
              break;
            default :
              throw new UnsupportedOperationException("" + opcode);
          }
          block.conditionalGoto(label);
        }

        private void if1(String name) {
          block.addOp(new Transform(lineNumber, name, JavaType.INT, null, null));
        }

        private void if2(String name) {
          block.addOp(new Transform(lineNumber, name, JavaType.INT, JavaType.INT, null));
        }
      });
    }
  }
View Full Code Here

Examples of com.google.test.metric.method.op.stack.Transform

            Constant constant = new Constant("new", type);
            block.addOp(new Load(lineNumber, constant));
            break;
          case Opcodes.NEWARRAY :
          case Opcodes.ANEWARRAY :
            block.addOp(new Transform(lineNumber, "newarray", JavaType.INT, null,
                type.toArray()));
            break;
          case Opcodes.INSTANCEOF :
            block.addOp(new Transform(lineNumber, "instanceof", JavaType.OBJECT,
                null, JavaType.INT));
            break;
          case Opcodes.CHECKCAST :
            block
                .addOp(new Transform(lineNumber, "checkcast", type, null, type));
            break;
          default :
            throw new UnsupportedOperationException("" + opcode);
        }
      }
View Full Code Here

Examples of com.google.test.metric.method.op.stack.Transform

        });
        break;
      case Opcodes.NOP:
        recorder.add(new Runnable(){
          public void run() {
            block.addOp(new Transform(lineNumber, "NOP", null, null, null));
          }
        });
    }
  }
View Full Code Here

Examples of com.google.test.metric.method.op.stack.Transform

  private void operation(final String operation, final Type op1,
      final Type op2, final Type result) {
    recorder.add(new Runnable() {
      public void run() {
        block.addOp(new Transform(lineNumber, operation, op1, op2, result));
      }
    });
  }
View Full Code Here

Examples of com.google.test.metric.method.op.stack.Transform

  }

  private void newArray(final int operand, final Type type) {
    recorder.add(new Runnable() {
      public void run() {
        block.addOp(new Transform(lineNumber, "newarray", JavaType.INT, null, type
            .toArray()));
      }
    });
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.