override public void draw(DrawInfo di, Object selected) { Pen pen = new Pen(mColor); if (this == selected) { pen = new Pen(Color.Blue); } di.drawEllipse(pen, mParent.getScreenFromWorld(mPos0), 10, 10); di.drawEllipse(pen, mParent.getScreenFromWorld(mPos1), 10, 10); di.drawLine(pen, mParent.getScreenFromWorld(mPos0), mParent.getScreenFromWorld(mPos1)); for (int i = 0; i < mSeg - 1; i++) { double alpha = (double)(i + 1) / (mSeg); Vec pos = mPos0.mult(alpha).plus(mPos1.mult(1 - alpha)); di.drawEllipse(pen, mParent.getScreenFromWorld(pos), 5, 5); } }
public Vec mult(Vec pos) { return(mAxisX.mult(pos.mX).plus(mAxisY.mult(pos.mY))); }