Package com.google.gwt.maeglin89273.game.mengine.physics

Examples of com.google.gwt.maeglin89273.game.mengine.physics.Point.translate()


    Point crossP=new Point(getX(),getTopY()+getWidth()/2);
    Point bmP=this.getPositionAt(PositionType.SOUTH);
    Point blP=bmP.clone();
    Point brP=bmP.clone();
    blP.translate(-7.5f, 0);
    brP.translate(7.5f, 0);
    points=Point.getRotatedPoint(getPosition(), getAngle(),tlP,trP,crossP,bmP,blP,brP);
   
    Vec2 crossV=CoordinateConverter.vectorPixelToWorld(position.delta(crossP));
   
    BodyDef bodyD=new BodyDef();
View Full Code Here


  @Override
  public void update() {
    if(lastShapesCount>0){
      double angle=lastShapesCount*PORTION_ANGLE;
      Point pos=this.position.clone();
      pos.translate(new Vector(spoutDistance,angle,true));
      Vec2 impulse=new Vec2((float)(this.impulseMag*Math.cos(angle)),(float)(this.impulseMag*Math.sin(angle)));
     
      PhysicalShape shape=generateShape(pos,angle);
      if(shape.isVerified()){
        shape.getBody().applyLinearImpulse(impulse,shape.getBody().getWorldCenter());
View Full Code Here

    Point nwP=this.getPositionAt(PositionType.NORTHWEST);
    Point neP=this.getPositionAt(PositionType.NORTHEAST);
    Point seP=nwP.clone();
    Point swP=neP.clone();
    seP.translate(getHeight(), getHeight());
    swP.translate(-getHeight(), getHeight());
    this.points=Point.getRotatedPoint(getPosition(),getAngle(),nwP,neP,seP,swP);
   
    BodyDef bodyD=new BodyDef();
    PolygonShape[] edges=new PolygonShape[]{new PolygonShape(),new PolygonShape(),new PolygonShape(),new PolygonShape()};
   
View Full Code Here

    Vector[] vertices=new Vector[verticesCount];
    for(int c=0;c<vertices.length;c++){
      //angle+=(2*Math.PI-angle)*Random.nextDouble(); this is the other way to create a vertex
      angle=theta*Random.nextDouble()+c*theta;
      verticesP[c]=new Point(circumscribedCircleRadius,angle,true);
      g.translate(verticesP[c].getX(), verticesP[c].getY());
    }
    g.setPosition(g.getX()/verticesCount, g.getY()/verticesCount);
   
    for(int i=0;i<vertices.length;i++){
      vertices[i]=new Vector(verticesP[i].getX()-g.getX(),verticesP[i].getY()-g.getY());
View Full Code Here

      }
    }
     boolean select(Point p){
      if(p.getX()>cornerX&&p.getX()<cornerX+bounds&&p.getY()>cornerY&&p.getY()<cornerY+bounds){
        Point cl=p.clone();
        cl.translate(-cornerX,-cornerY);
       
        int i=(int)(cl.getY()*buttons.length/bounds);
        int j=(int)(cl.getX()*buttons.length/bounds);
        if(buttons[i][j]!=null&&buttons[i][j].onClick(p)){
          return true;
View Full Code Here

      zoomOut=false;
    }
  }
  public Point ConvertToWorldPosition(Point p){
    Point clone=p.clone();
    clone.translate(getLeftX(), getTopY());
    Vector delta=scaledBoundsCorner.delta(clone);
    delta.divided(scale);
    clone.setPosition(bounds.getX()+delta.getVectorX(), bounds.getY()+delta.getVectorY());
    return clone;
  }
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.