public override string ToString()
 {
     return("Triangle with sides " +
            Side1.ToString() + ", " +
            Side2.ToString() + ", " +
            Side3.ToString());
 }
Example #2
0
 public override string ToString()
 {
     return("Trapeze with sides " +
            Side1.ToString() + ", and " +
            Side2.ToString() + ", and " +
            Side3.ToString() + ", and " +
            Side4.ToString());
 }
        private int NumberOfEqualsSides()
        {
            var equalSides = new[]
            {
                Side1.Equals(Side2),
                Side1.Equals(Side3),
                Side2.Equals(Side3)
            };

            return(equalSides.Count(e => e));
        }
Example #4
0
        private void OnClick(object sender, EventArgs args)
        {
            if (sender.Equals(SideButton))
            {
                Main2.Children.Add(new Image {
                    Source = "Icon.png"
                }, new Rectangle(0, y, 30, 20));

                y += 20;
            }
            else
            {
                Side2.LayoutTo(new Rectangle(Width - 50, 0, 100, 100));
            }
        }
Example #5
0
        public bool Slice(Line2 line)
        {
            Side2 side = Line2.Side(line, this.M);
            bool  flag;

            if (side == Side2.Coincident)
            {
                flag = false;
            }
            else
            {
                bool changed = true;
                this.C = Cell2.SliceConvexNGon(this.C, line, side, ref changed);
                flag   = changed;
            }
            return(flag);
        }
Example #6
0
        protected override void OnSizeAllocated(double width, double height)
        {
            base.OnSizeAllocated(width, height);

            System.Diagnostics.Debug.WriteLine("deg : onSizeAllocated " + width + ", " + height);

            /*
             * SideBounds = new ViewBounds
             * {
             *  X = width
             * };
             *
             * Side.BindingContext = SideBounds;
             */

            Side2.LayoutTo(new Rectangle(Width, 0, 300, 100), 300);
            Side.LayoutTo(new Rectangle(Width, 0, 300, 100), 300);
            Scroller.LayoutTo(new Rectangle(80, 0, 200, 100));
        }
        public int CompareTo(object obj)
        {
            VertexDistance Casted = (VertexDistance)obj;

            if (Side1 == Casted.Side1)
            {
                if (Side2 == Casted.Side2)
                {
                    return(0);
                }
                else
                {
                    return(Side2.CompareTo(Casted.Side2));
                }
            }
            else
            {
                return(Side1.CompareTo(Casted.Side1));
            }
        }
Example #8
0
        /// <summary>
        /// Generic n-gon slicer. If the nodes in V do not represent a valid, convex NGon
        /// then the result will not be reliable.
        /// </summary>
        /// <param name="V">Corners of NGon</param>
        /// <param name="line">The line to slice with</param>
        /// <param name="side">Side of NGon to keep (with respect to line)</param>
        /// <returns>Result. List may share Node instances with V</returns>
        public static List <Node2> SliceConvexNGon(
            List <Node2> V,
            Line2 line,
            Side2 side,
            ref bool changed)
        {
            changed = false;
            List <Node2> node2List1;

            if (V.Count < 2)
            {
                node2List1 = V;
            }
            else
            {
                List <Node2> node2List2 = new List <Node2>(V.Count + 2);
                int          num1       = 0;
                Side2        side2      = Side2.Coincident;
                int          num2       = V.Count - 1;
                for (int index1 = 0; index1 <= num2; ++index1)
                {
                    if (side2 == Side2.Coincident)
                    {
                        side2 = Line2.Side(line, V[index1]);
                        if (side2 != side)
                        {
                            changed = true;
                        }
                    }
                    int index2 = index1 + 1;
                    if (index2 == V.Count)
                    {
                        index2 = 0;
                    }
                    Line2  A = new Line2(V[index1], V[index2]);
                    double t = 0.0;
                    switch (Line2.Intersect(A, line, ref t))
                    {
                    case LineX.None:
                        if (side2 == side)
                        {
                            node2List2.Add(V[index1]);
                            break;
                        }
                        break;

                    case LineX.Parallel:
                        if (side2 == side)
                        {
                            node2List2.Add(V[index1]);
                            break;
                        }
                        break;

                    case LineX.Coincident:
                        changed    = false;
                        node2List1 = V;
                        goto label_28;

                    case LineX.Point:
                        Node2 node2 = A.PointAt(t);
                        if (node2.IsCoincident(V[index1]))
                        {
                            node2List2.Add(V[index1]);
                            side2 = Side2.Coincident;
                            ++num1;
                            changed = true;
                            break;
                        }
                        if (node2.IsCoincident(V[index2]))
                        {
                            if (side2 == side)
                            {
                                node2List2.Add(V[index1]);
                                break;
                            }
                            break;
                        }
                        if (t < 0.0 || t > 1.0)
                        {
                            if (side2 == side)
                            {
                                node2List2.Add(V[index1]);
                                break;
                            }
                            break;
                        }
                        if (side2 == side)
                        {
                            node2List2.Add(V[index1]);
                        }
                        node2List2.Add(node2);
                        side2 = Side2.Coincident;
                        ++num1;
                        changed = true;
                        break;
                    }
                }
                node2List1 = node2List2;
            }
label_28:
            return(node2List1);
        }