Esempio n. 1
0
        public static BoxSetLengthAngleConstraints FromVertexConstraints(
            VertexConstraints vertexConstraints1, VertexConstraints vertexConstraints2,
            int maxSplitDepth,
            double nonSplittableArea)
        {
            BoxLengthAngleConstraints overallRange = BoxLengthAngleConstraints.FromVertexConstraints(
                vertexConstraints1, vertexConstraints2);

            IEnumerable <VertexConstraints>  split1           = GenerateSplit(vertexConstraints1, maxSplitDepth, nonSplittableArea);
            IEnumerable <VertexConstraints>  split2           = GenerateSplit(vertexConstraints2, maxSplitDepth, nonSplittableArea);
            List <BoxLengthAngleConstraints> childConstraints = new List <BoxLengthAngleConstraints>();

            foreach (VertexConstraints childVertexConstraints1 in split1)
            {
                foreach (VertexConstraints childVertexConstraints2 in split2)
                {
                    childConstraints.Add(BoxLengthAngleConstraints.FromVertexConstraints(childVertexConstraints1, childVertexConstraints2));
                }
            }

            return(new BoxSetLengthAngleConstraints(childConstraints, overallRange));
        }
 private static void DrawLengthAngleConstraintBox(Graphics graphics, Pen pen, BoxLengthAngleConstraints constraints, double lengthScale)
 {
     if (constraints.AngleBoundary.Outside)
     {
         graphics.DrawRectangle(
             pen,
             (float)(constraints.LengthBoundary.Left * lengthScale),
             0,
             (float)(constraints.LengthBoundary.Length * lengthScale),
             (float)(MathHelper.ToDegrees(constraints.AngleBoundary.Left) + 180));
         graphics.DrawRectangle(
             pen,
             (float)(constraints.LengthBoundary.Left * lengthScale),
             (float)(MathHelper.ToDegrees(constraints.AngleBoundary.Right) + 180),
             (float)(constraints.LengthBoundary.Length * lengthScale),
             (float)(180 - MathHelper.ToDegrees(constraints.AngleBoundary.Right)));
     }
     else
     {
         graphics.DrawRectangle(
             pen,
             (float)(constraints.LengthBoundary.Left * lengthScale),
             (float)(MathHelper.ToDegrees(constraints.AngleBoundary.Left) + 180),
             (float)(constraints.LengthBoundary.Length * lengthScale),
             (float)(MathHelper.ToDegrees(constraints.AngleBoundary.Right) - MathHelper.ToDegrees(constraints.AngleBoundary.Left)));
     }
 }
Esempio n. 3
0
 private BoxSetLengthAngleConstraints(IEnumerable <BoxLengthAngleConstraints> constraints, BoxLengthAngleConstraints overallRange)
 {
     this.childConstraints = new List <BoxLengthAngleConstraints>(constraints);
     this.OverallRange     = overallRange;
 }
 private BoxSetLengthAngleConstraints(IEnumerable<BoxLengthAngleConstraints> constraints, BoxLengthAngleConstraints overallRange)
 {
     this.childConstraints = new List<BoxLengthAngleConstraints>(constraints);
     this.OverallRange = overallRange;
 }