public Line(MutablePoint _start, MutablePoint _end, Color?_color) { initColor(_color); mutableStart = _start; mutableEnd = _end; isMutableStart = isMutableEnd = true; }
public Text(string _text, MutablePoint _center, float?_fontSize, Color?_color) { initNulls(_fontSize, _color); mutableCenter = _center; text = _text; isCenterMutable = true; }
public Line(MutablePoint _start, PointF _end, Color?_color) { initColor(_color); mutableStart = _start; end = _end; isMutableStart = true; isMutableEnd = false; }
public Circle(PointF _center, float r, bool isFilled = false, bool isActive = false) { center = _center; this.r = r; this.isFilled = isFilled; this.isActive = isActive; mutableCenter = new MutablePoint(center); borderColor = Color.Black; fillColor = Color.Green; activeColor = Color.Red; isDragging = false; }
public Circle(Circle other) { center = other.center; r = other.r; isFilled = other.isFilled; mutableCenter = other.mutableCenter; borderColor = other.borderColor; isDragging = other.isDragging; }
static public Line getLineBetween(Circle from, Circle to) { //bool needToSwap = false; //if (from.Center.X > to.Center.X) //{ // needToSwap = true; // Swap<Circle>(ref from, ref to); //} MutablePoint mutableStart = new MutablePoint(() => { bool needToSwap = false; Circle _from = new Circle(from), _to = new Circle(to); if (from.Center.X >= to.Center.X) { needToSwap = true; Swap <Circle>(ref _from, ref _to); if (from.Center.X == to.Center.X) { //Console.WriteLine("equals"); _to.Center.X += 0.02f; } } float devidor = (_to.MutableCenter.value.X - _from.MutableCenter.value.X); float ang1 = (float)Math.Atan((_to.MutableCenter.value.Y - _from.MutableCenter.value.Y) / (devidor == 0?0.0001f:devidor)), ang2 = (float)Math.PI + ang1; return(needToSwap?_to.calcPointOnCircle(ang2):_from.calcPointOnCircle(ang1)); }), mutableEnd = new MutablePoint(() => { bool needToSwap = false; Circle _from = new Circle(from), _to = new Circle(to); if (from.Center.X >= to.Center.X) { needToSwap = true; Swap <Circle>(ref _from, ref _to); if (from.Center.X == to.Center.X) { //Console.WriteLine("equals"); _to.Center.X += 0.02f; } } float devidor = (_to.MutableCenter.value.X - _from.MutableCenter.value.X); float ang1 = (float)Math.Atan((_to.MutableCenter.value.Y - _from.MutableCenter.value.Y) / (devidor == 0?0.0001f:devidor)), ang2 = (float)Math.PI + ang1; return(!needToSwap ? _to.calcPointOnCircle(ang2) : _from.calcPointOnCircle(ang1)); }); //if (needToSwap) //{ // Swap<MutablePoint>(ref mutableStart, ref mutableEnd); //} Line edge = new Line(mutableStart, mutableEnd, Color.Black); return(edge); }
public MutablePoint(MutablePoint _target, Func <PointF> _func) { target = _target; func = _func; mode = "dynamic_offset"; }
public MutablePoint(MutablePoint _target, PointF fix_offset) { target = _target; offset = fix_offset; mode = "fix_offset"; }