Exemple #1
0
        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);
        }
Exemple #2
0
        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);
        }
Exemple #3
0
 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;
 }