public void setLength(float len) { if (this.isNull()) { return; } LDLine v = this.unitVector(); this.pt2 = new LDPoint(this.pt1.x() + v.dx() * len, this.pt1.y() + v.dy() * len); }
public LDLine unitVector() { if (this.length() == 0) { return(this); } LDLine unit = new LDLine(this); unit.setP2(new LDPoint(unit.pt1.x() + unit.dx() / this.length(), unit.pt1.y() + unit.dy() / this.length())); return(unit); }
public LDLine unitVector() { if (this.length() == 0) { return this; } LDLine unit = new LDLine(this); unit.setP2(new LDPoint(unit.pt1.x() + unit.dx() / this.length(), unit.pt1.y() + unit.dy() / this.length())); return unit; }