示例#1
0
文件: LDLine.cs 项目: johndpope/math
        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);
        }
示例#2
0
文件: LDLine.cs 项目: johndpope/math
        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);
        }
示例#3
0
文件: LDLine.cs 项目: KajitaLD/math
 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;
 }