/// <summary> /// 延长直线段 /// </summary> /// <param name="type">延长类型:0都延长,1延长尾点,-1延长首点</param> /// <param name="expandDis"></param> /// <returns></returns> public LineSegment Expand(int type, double expandDis) { switch (type) { case 0: return(new LineSegment(BeginPoint.GetNextPoint(GetDirection() + Math.PI, expandDis), EndPoint.GetNextPoint(GetDirection(), expandDis))); case -1: return(new LineSegment(BeginPoint.GetNextPoint(GetDirection() + Math.PI, expandDis), EndPoint)); case 1: return(new LineSegment(BeginPoint, EndPoint.GetNextPoint(GetDirection(), expandDis))); default: break; } throw new ArgumentOutOfRangeException("扩展线段(LineSegment.Expand)时,出现了非法的延长类型"); }
/// <summary> /// 根据指定方向和距离平移直线段 /// </summary> /// <param name="radian"></param> /// <param name="distance"></param> public override void Move(double radian, double distance) { SetBeginPoint(BeginPoint.GetNextPoint(radian, distance)); SetEndPoint(EndPoint.GetNextPoint(radian, distance)); }