public virtual void Redo() { m_owner.P1 = HitUtil.PointOncircle(m_owner.Center, m_endValue, HitUtil.DegressToRadians(Angle1)); m_owner.P2 = HitUtil.PointOncircle(m_owner.Center, m_endValue, HitUtil.DegressToRadians(Angle2)); m_owner.P3 = HitUtil.PointOncircle(m_owner.Center, m_endValue, HitUtil.DegressToRadians(Angle3)); m_owner.Radius = m_endValue; }
UnitPoint RadiusNodePoint(ICanvas canvas) { double r = Radius + canvas.ToUnit(8); float angle = StartAngle + SweepAngle / 2; return(HitUtil.PointOncircle(m_center, r, HitUtil.DegressToRadians(angle))); }
private UnitPoint EndAngleNodePoint(ICanvas canvas) { try { double r = Radius + canvas.ToUnit(8); return(HitUtil.PointOncircle(m_center, r, HitUtil.DegressToRadians(EndAngle))); } catch (Exception ex) { throw ex; } }
public void UpdateCenterNodeFromAngles() { try { float angle = StartAngle + SweepAngle / 2; P2 = HitUtil.PointOncircle(m_center, m_radius, HitUtil.DegressToRadians(angle)); } catch (Exception ex) { throw ex; } }
private UnitPoint RadiusNodePoint(ICanvas canvas) { try { double r = Radius + canvas.ToUnit(8); float angle = StartAngle + SweepAngle / 2; return(HitUtil.PointOncircle(m_center, r, HitUtil.DegressToRadians(angle))); } catch (Exception ex) { throw ex; } }
public virtual void Finish() { //float Angle1 = (float)HitUtil.RadiansToDegrees(HitUtil.LineAngleR(m_owner.Center,m_owner.P1, 0)); //float Angle2 = (float)HitUtil.RadiansToDegrees(HitUtil.LineAngleR(m_owner.Center, m_owner.P2, 0)); //float Angle3 = (float)HitUtil.RadiansToDegrees(HitUtil.LineAngleR(m_owner.Center, m_owner.P3, 0)); //Console.WriteLine(Angle1); m_owner.P1 = HitUtil.PointOncircle(m_clone.Center, m_clone.Radius, HitUtil.DegressToRadians(Angle1)); m_owner.P2 = HitUtil.PointOncircle(m_clone.Center, m_clone.Radius, HitUtil.DegressToRadians(Angle2)); m_owner.P3 = HitUtil.PointOncircle(m_clone.Center, m_clone.Radius, HitUtil.DegressToRadians(Angle3)); m_endValue = m_clone.Radius; m_owner.Radius = m_clone.Radius; m_owner.Selected = true; m_clone = null; }
/* * UnitPoint GetPoint() * { * if (m_curPoint == Arc3Point.eCurrentPoint.p1) * return m_clone.P1; * if (m_curPoint == Arc3Point.eCurrentPoint.p2) * return m_clone.P2; * if (m_curPoint == Arc3Point.eCurrentPoint.p3) * return m_clone.P3; * if (m_curPoint == Arc3Point.eCurrentPoint.startangle) * return m_clone.P1; * if (m_curPoint == Arc3Point.eCurrentPoint.endangle) * return m_clone.P3; * if (m_curPoint == Arc3Point.eCurrentPoint.radius) * return m_clone.P2; * return UnitPoint.Empty; * } * */ void SetPoint(Arc3Point arc, UnitPoint pos) { if (m_curPoint == Arc3Point.eCurrentPoint.p1) { arc.P1 = pos; } if (m_curPoint == Arc3Point.eCurrentPoint.p2) { arc.P2 = pos; } if (m_curPoint == Arc3Point.eCurrentPoint.p3) { arc.P3 = pos; } double angleToRound = 0; if (Control.ModifierKeys == Keys.Control) { angleToRound = HitUtil.DegressToRadians(45); } double angleR = HitUtil.LineAngleR(arc.Center, pos, angleToRound); if (m_curPoint == Arc3Point.eCurrentPoint.startangle) { arc.P1 = HitUtil.PointOncircle(arc.Center, arc.Radius, angleR); } if (m_curPoint == Arc3Point.eCurrentPoint.endangle) { arc.P3 = HitUtil.PointOncircle(arc.Center, arc.Radius, angleR); } if (m_curPoint == Arc3Point.eCurrentPoint.radius) { double radius = HitUtil.Distance(arc.Center, pos); arc.P1 = HitUtil.PointOncircle(arc.Center, radius, HitUtil.DegressToRadians(arc.StartAngle)); arc.P2 = pos; arc.P3 = HitUtil.PointOncircle(arc.Center, radius, HitUtil.DegressToRadians(arc.EndAngle)); } arc.UpdateArcFrom3Points(); if ((m_curPoint == Arc3Point.eCurrentPoint.startangle) || (m_curPoint == Arc3Point.eCurrentPoint.endangle)) { arc.UpdateCenterNodeFromAngles(); } }
public virtual void OnMouseMove(ICanvas canvas, UnitPoint point) { m_lastPoint = point; if (m_curPoint == eCurrentPoint.p1) { m_p1 = point; Center = point; return; } if (m_curPoint == eCurrentPoint.p2) { StartAngle = 0; EndAngle = 360; Center = HitUtil.LineMidpoint(m_p1, point); m_radius = (float)HitUtil.Distance(m_center, point); return; } if (m_curPoint == eCurrentPoint.center) { Center = point; } if (m_curPoint == eCurrentPoint.radius) { //StartAngle = 0; //EndAngle = 360; m_radius = (float)HitUtil.Distance(m_center, point); } double angleToRound = 0; if (Control.ModifierKeys == Keys.Control) { angleToRound = HitUtil.DegressToRadians(45); } if (m_curPoint == eCurrentPoint.startAngle) { StartAngle = (float)HitUtil.RadiansToDegrees(HitUtil.LineAngleR(m_center, point, angleToRound)); } if (m_curPoint == eCurrentPoint.endAngle) { EndAngle = (float)HitUtil.RadiansToDegrees(HitUtil.LineAngleR(m_center, point, angleToRound)); } }
UnitPoint EndAngleNodePoint(ICanvas canvas) { double r = Radius + canvas.ToUnit(8); return(HitUtil.PointOncircle(m_center, r, HitUtil.DegressToRadians(EndAngle))); }
/// <summary> /// 根据角度来更新圆弧的中点 /// </summary> public void UpdateCenterNodeFromAngles() { float angle = StartAngle + SweepAngle / 2; P2 = HitUtil.PointOncircle(m_center, m_radius, HitUtil.DegressToRadians(angle)); }
protected UnitPoint AnglePoint(float angle) { return(HitUtil.PointOncircle(m_center, m_radius, HitUtil.DegressToRadians(angle))); }