示例#1
0
 // Left and right represent the bank A and B, respectively
 public LeafPair(double left, double right,
                 double width, double top, Jaw jaw)
 {
     Position = new Rect(left, top, right, top - width);
     Width    = width;
     Jaw      = jaw;
 }
示例#2
0
 private LeafPair[] CreateLeafPairs
     (double[,] positions, double[] widths, Jaw jaw)
 {
     double[] leafTops = GetLeafTops(widths);
     return((from i in Algebra.Sequence(widths.Length)
             select new LeafPair(positions[0, i], positions[1, i],
                                 widths[i], leafTops[i], jaw)).ToArray());
 }
示例#3
0
        // The first dimension of leafPositions corresponds to the bank,
        // and the second dimension corresponds to the leaf pair.
        // Leaf coordinates follow the IEC 61217 standard:
        //
        //                   Negative Y         x = isocenter (0, 0)
        //                       -
        //                       |
        //                       |
        //                       |
        // Negative X |----------x----------| Positive X
        //                       |
        //                       |
        //                       |
        //                       -
        //                   Positive Y

        // leafPositions and leafWidths must not be null,
        // and they must have the same number of leaves

        // jaw is the position of the jaw (cannot be null), given as
        // left, top, right, bottom; for a completely open jaw, use:
        //     new double[] { double.MinValue, double.MinValue,
        //                    double.MaxValue, double.MaxValue };

        public Aperture(double[,] leafPositions, double[] leafWidths, double[] jaw)
        {
            Jaw       = CreateJaw(jaw);
            LeafPairs = CreateLeafPairs(leafPositions, leafWidths, Jaw);
        }