Code example for PointF

Methods: offset

0
 
	public void update(float dt) {
		//Object has acceleration. Update speed. 
		if(acceleration.x!=0 || acceleration.y!=0) {
			//Accelerate velocity (integration) v=v0+a*dt 
			speed.offset(acceleration.x*dt, acceleration.y*dt);
		} 
		//Object has speed. update position 
		if(speed.x!=0 || speed.y!=0) {
			//Move object according to equation of motion: r=r0+vt+at²/2 
			position.offset(speed.x*dt+acceleration.x*dt*dt/2,
					speed.y*dt+acceleration.y*dt*dt/2);
		} 
	} 
 
 
	public void setPosition(RectF r) { position = r; }
	public void move(float dx,float dy) { position.offset(dx, dy); }
	public RectF getPosition() { return position; }
	public void setSize(float width,float height) { position.inset(-width, -height); }
Connect your IDE to all the code out there  Get Codota for Java