GMovingBall

Retired DISLab
이동: 둘러보기, 찾기
import acm.graphics.*;
 
public class GMovingBall extends GBall {
 
    /** Creates a new ball with radius r centered at the origin 
     * @param w Weight of this ball (radius)
     * @param vecX x 축 방향의 벡터 크기
     * @param vecY y 축 방향의 벡터 크기
     */
    public GMovingBall(double weight, GDimension vec) {
        super(weight);
        vector = new GDimension(vec);
    }
 
    /** Creates a new ball with radius r centered at (x, y) */
    public GMovingBall(double weight, GDimension vec, double x, double y) {
        this(weight, vec);
        setLocation(x, y);
    }
 
    public GDimension getVector() {
        return new GDimension(vector);
    }
 
    public double getVectorX() {
        return vector.getWidth();
    }
 
    public double getVectorY() {
        return vector.getHeight();
    }
 
    public void setVector(GDimension vector) {
        this.vector = vector;
    }
 
    public void setVector(double dx, double dy) {
        vector.setSize(dx, dy);
    }
 
    private GDimension vector;  // vector(dx, dy)
}
개인 도구
이름공간
변수
행위
둘러보기
구성원
연구
연구실
기타
도구모음
인쇄/내보내기