/// <summary> /// This iterates over three axiis as points /// WARNING: It's up to the caller to make sure each of the three axiis is unique (one for X, one for Y, one for Z) /// </summary> public static IEnumerable<Point3D> Iterate(AxisForDouble axis1, AxisForDouble axis2, AxisForDouble axis3) { foreach (double v1 in axis1.Iterate()) { foreach (double v2 in axis2.Iterate()) { foreach (double v3 in axis3.Iterate()) { double x = 0, y = 0, z = 0; axis1.SetCorrespondingValue(ref x, ref y, ref z, v1); axis2.SetCorrespondingValue(ref x, ref y, ref z, v2); axis3.SetCorrespondingValue(ref x, ref y, ref z, v3); yield return new Point3D(x, y, z); } } } }
/// <summary> /// This iterates over two axiis as points /// WARNING: It's up to the caller to make sure each of the two axiis is unique (one for X, one for Y, nothing for Z) /// </summary> public static IEnumerable<Point> Iterate(AxisForDouble axis1, AxisForDouble axis2) { if (axis1.Axis == Axis.Z || axis2.Axis == Axis.Z) { throw new ArgumentException("Z should never be passed into this 2D method"); } foreach (double v1 in axis1.Iterate()) { foreach (double v2 in axis2.Iterate()) { double x = 0, y = 0, dummy = 0; axis1.SetCorrespondingValue(ref x, ref y, ref dummy, v1); axis2.SetCorrespondingValue(ref x, ref y, ref dummy, v2); yield return new Point(x, y); } } }