Code example for PointF

Methods: offset

	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 
	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); }
Contextual code suggestions in your IDE  Get Codota for Java