Exemple #1
0
        private static void AddCurveRule(params int[] npointValues)
        {
            HilbertCurve2D curve = new HilbertCurve2D(npointValues);
            Direction2D    name  = curve.Name();

            if (!_curves.ContainsKey(name))
            {
                _curves[name] = curve;
            }
        }
Exemple #2
0
        private static void SetChildren(Direction2D parent, params Direction2D[] children)
        {
            HilbertCurve2D curve = _curves[parent];

            HilbertCurve2D[] childCurves = new HilbertCurve2D[children.Length];
            for (int i = 0; i < children.Length; i++)
            {
                childCurves[i] = _curves[children[i]];
            }
            curve.Children = childCurves;
        }
Exemple #3
0
 static HilbertSpaceFillingCurve2D()
 {
     AddCurveRule(0, 1, 3, 2);
     AddCurveRule(0, 2, 3, 1);
     AddCurveRule(3, 1, 0, 2);
     AddCurveRule(3, 2, 0, 1);
     SetChildren(UP, RIGHT, UP, UP, LEFT);
     SetChildren(RIGHT, UP, RIGHT, RIGHT, DOWN);
     SetChildren(DOWN, LEFT, DOWN, DOWN, RIGHT);
     SetChildren(LEFT, DOWN, LEFT, LEFT, UP);
     _curveUp = _curves[UP];
 }