# Purpose: Standard definitions
# Created: 08.07.2015
# Copyright (c) 2015-2020, <NAME>
# License: MIT License
# pattern type: predefined (1)

from ezdxf.math import Vec2

PATTERN_NEW = {
    "ANSI31": [[45.0, (0.0, 0.0), (-2.2627, 2.2627), []]],
    "ANSI32": [
        [45.0, (0.0, 0.0), (-6.7882, 6.7882), []],
        [45.0, (4.5255, 0.0), (-6.7882, 6.7882), []],
    ],
    "ANSI33": [
        [45.0, (512.0, 0.0), (-4.5255, 4.5255), []],
        [45.0, (516.5255, 0.0), (-4.5255, 4.5255), [3.2, -1.6]],
    ],
    "ANSI34": [
        [45.0, (0.0, 0.0), (-13.5765, 13.5765), []],
        [45.0, (4.5255, 0.0), (-13.5765, 13.5765), []],
        [45.0, (9.051, 0.0), (-13.5765, 13.5765), []],
        [45.0, (13.5765, 0.0), (-13.5765, 13.5765), []],
    ],
    "ANSI35": [
        [45.0, (-1024.0, -256.0), (-4.5255, 4.5255), []],
        [45.0, (-1019.4745, -256.0), (-4.5255, 4.5255), [8.0, -1.6, 0.0, -1.6]],
    ],
    "ANSI36": [[45.0, (-1024.0, -256.0), (1.6971, 6.2225), [8.0, -1.6, 0.0, -1.6]]],
    "ANSI37": [
        [45.0, (0.0, 0.0), (-2.2627, 2.2627), []],
        [135.0, (0.0, 0.0), (-2.2627, -2.2627), []],
    ],
    "ANSI38": [
        [45.0, (0.0, 0.0), (-2.2627, 2.2627), []],
        [135.0, (0.0, 0.0), (-6.7882, 2.2627), [8.0, -4.8]],
    ],
    "ACAD_ISO02W100": [[0.0, (0.0, 0.0), (0.0, 12.8), [30.72, -7.68]]],
    "ACAD_ISO03W100": [[0.0, (0.0, 0.0), (0.0, 12.8), [30.72, -46.08]]],
    "ACAD_ISO04W100": [[0.0, (0.0, 0.0), (0.0, 12.8), [61.44, -7.68, 1.28, -7.68]]],
    "ACAD_ISO05W100": [
        [0.0, (0.0, 0.0), (0.0, 12.8), [61.44, -7.68, 1.28, -7.68, 1.28, -7.68]]
    ],
    "ACAD_ISO06W100": [
        [0.0, (0.0, 0.0), (0.0, 12.8), [61.44, -7.68, 1.28, -7.68, 1.28, -16.64]],
        [0.0, (0.0, 0.0), (0.0, 12.8), [-87.04, 1.28, -7.68]],
    ],
    "ACAD_ISO07W100": [[0.0, (0.0, 0.0), (0.0, 12.8), [1.28, -7.68]]],
    "ACAD_ISO08W100": [[0.0, (0.0, 0.0), (0.0, 12.8), [61.44, -7.68, 15.36, -7.68]]],
    "ACAD_ISO09W100": [
        [0.0, (0.0, 0.0), (0.0, 12.8), [61.44, -7.68, 15.36, -7.68, 15.36, -7.68]]
    ],
    "ACAD_ISO10W100": [[0.0, (0.0, 0.0), (0.0, 12.8), [30.72, -7.68, 1.28, -7.68]]],
    "ACAD_ISO11W100": [
        [0.0, (0.0, 0.0), (0.0, 12.8), [30.72, -7.68, 30.72, -7.68, 1.28, -7.68]]
    ],
    "ACAD_ISO12W100": [
        [0.0, (0.0, 0.0), (0.0, 12.8), [30.72, -7.68, 1.28, -7.68, 1.28, -7.68]]
    ],
    "ACAD_ISO13W100": [
        [0.0, (0.0, 0.0), (0.0, 12.8), [30.72, -7.68, 30.72, -7.68, 1.28, -16.64]],
        [0.0, (0.0, 0.0), (0.0, 12.8), [-85.76, 1.28, -7.68]],
    ],
    "ACAD_ISO14W100": [
        [0.0, (0.0, 0.0), (0.0, 12.8), [30.72, -7.68, 1.28, -7.68, 1.28, -16.64]],
        [0.0, (0.0, 0.0), (0.0, 12.8), [-56.32, 1.28, -7.68]],
    ],
    "ACAD_ISO15W100": [
        [0.0, (0.0, 0.0), (0.0, 12.8), [30.72, -7.68, 30.72, -7.68, 1.28, -25.6]],
        [0.0, (0.0, 0.0), (0.0, 12.8), [-85.76, 1.28, -7.68, 1.28, -7.68]],
    ],
    "ANGLE": [
        [0.0, (0.0, 0.0), (0.0, 7.04), [5.12, -1.92]],
        [90.0, (0.0, 0.0), (-7.04, 0.0), [5.12, -1.92]],
    ],
    "AR-B816": [
        [0.0, (0.0, 0.0), (0.0, 20.48), []],
        [90.0, (0.0, 0.0), (-20.48, 20.48), [20.48, -20.48]],
    ],
    "AR-B816C": [
        [0.0, (0.0, 0.0), (20.48, 20.48), [40.0, -0.96]],
        [0.0, (-20.48, 0.96), (20.48, 20.48), [40.0, -0.96]],
        [90.0, (0.0, 0.0), (-20.48, 20.48), [-21.44, 19.52]],
        [90.0, (-0.96, 0.0), (-20.48, 20.48), [-21.44, 19.52]],
    ],
    "AR-B88": [
        [0.0, (0.0, 0.0), (0.0, 20.48), []],
        [90.0, (0.0, 0.0), (-10.24, 20.48), [20.48, -20.48]],
    ],
    "AR-BRELM": [
        [0.0, (0.0, 0.0), (0.0, 68.2752), [97.6, -4.8]],
        [0.0, (0.0, 28.8), (0.0, 68.2752), [97.6, -4.8]],
        [0.0, (25.6, 34.1376), (0.0, 68.2752), [46.4, -4.8]],
        [0.0, (25.6, 62.9376), (0.0, 68.2752), [46.4, -4.8]],
        [90.0, (0.0, 0.0), (-102.4, 0.0), [28.8, -39.4752]],
        [90.0, (-4.8, 0.0), (-102.4, 0.0), [28.8, -39.4752]],
        [90.0, (25.6, 34.1376), (-51.2, 0.0), [28.8, -39.4752]],
        [90.0, (20.8, 34.1376), (-51.2, 0.0), [28.8, -39.4752]],
    ],
    "AR-BRSTD": [
        [0.0, (0.0, 0.0), (0.0, 68.2752), []],
        [90.0, (0.0, 0.0), (-102.4, 68.2752), [68.2752, -68.2752]],
    ],
    "AR-CONC": [
        [50.0, (0.0, 0.0), (36.7237, -3.2129), [3.84, -42.24]],
        [355.0, (0.0, 0.0), (-7.1041, 38.5122), [3.072, -33.792]],
        [100.4514, (3.0603, -0.2677), (29.6197, 35.2993), [3.2635, -35.8985]],
        [46.1842, (0.0, 10.24), (54.6428, -8.4746), [5.76, -63.36]],
        [96.6356, (4.5536, 9.5338), (47.8547, 49.8749), [4.8952, -53.8477]],
        [351.1842, (0.0, 10.24), (47.8547, 49.8749), [4.608, -50.688]],
        [21.0, (5.12, 7.68), (30.5616, -20.6141), [3.84, -42.24]],
        [326.0, (5.12, 7.68), (12.4577, 37.1277), [3.072, -33.792]],
        [71.4514, (7.6668, 5.9622), (43.0194, 16.5136), [3.2635, -35.8985]],
        [
            37.5,
            (0.0, 0.0),
            (0.6226, 17.0442),
            [0.0, -33.3824, 0.0, -34.304, 0.0, -33.92],
        ],
        [
            7.5,
            (0.0, 0.0),
            (13.4692, 20.1939),
            [0.0, -19.5584, 0.0, -32.6144, 0.0, -12.928],
        ],
        [
            327.5,
            (-11.4176, 0.0),
            (27.3317, -1.1548),
            [0.0, -12.8, 0.0, -39.936, 0.0, -52.992],
        ],
        [
            317.5,
            (-16.5376, 0.0),
            (29.8591, 5.1254),
            [0.0, -16.64, 0.0, -26.5216, 0.0, -37.632],
        ],
    ],
    "AR-HBONE": [
        [45.0, (0.0, 0.0), (0.0, 28.9631), [61.44, -20.48]],
        [135.0, (14.4815, 14.4815), (0.0, 28.9631), [61.44, -20.48]],
    ],
    "AR-PARQ1": [
        [90.0, (0.0, 0.0), (-61.44, 61.44), [61.44, -61.44]],
        [90.0, (10.24, 0.0), (-61.44, 61.44), [61.44, -61.44]],
        [90.0, (20.48, 0.0), (-61.44, 61.44), [61.44, -61.44]],
        [90.0, (30.72, 0.0), (-61.44, 61.44), [61.44, -61.44]],
        [90.0, (40.96, 0.0), (-61.44, 61.44), [61.44, -61.44]],
        [90.0, (51.2, 0.0), (-61.44, 61.44), [61.44, -61.44]],
        [90.0, (61.44, 0.0), (-61.44, 61.44), [61.44, -61.44]],
        [0.0, (0.0, 61.44), (61.44, -61.44), [61.44, -61.44]],
        [0.0, (0.0, 71.68), (61.44, -61.44), [61.44, -61.44]],
        [0.0, (0.0, 81.92), (61.44, -61.44), [61.44, -61.44]],
        [0.0, (0.0, 92.16), (61.44, -61.44), [61.44, -61.44]],
        [0.0, (0.0, 102.4), (61.44, -61.44), [61.44, -61.44]],
        [0.0, (0.0, 112.64), (61.44, -61.44), [61.44, -61.44]],
        [0.0, (0.0, 122.88), (61.44, -61.44), [61.44, -61.44]],
    ],
    "AR-RROOF": [
        [0.0, (0.0, 0.0), (56.32, 25.6), [384.0, -51.2, 128.0, -25.6]],
        [0.0, (34.048, 12.8), (-25.6, 34.048), [76.8, -8.448, 153.6, -19.2]],
        [0.0, (12.8, 21.76), (133.12, 17.152), [204.8, -35.84, 102.4, -25.6]],
    ],
    "AR-RSHKE": [
        [0.0, (0.0, 0.0), (65.28, 30.72), [15.36, -12.8, 17.92, -7.68, 23.04, -10.24]],
        [0.0, (15.36, 1.28), (65.28, 30.72), [12.8, -48.64, 10.24, -15.36]],
        [0.0, (46.08, -1.92), (65.28, 30.72), [7.68, -79.36]],
        [90.0, (0.0, 0.0), (-21.76, 30.72), [29.44, -93.44]],
        [90.0, (15.36, 0.0), (-21.76, 30.72), [28.8, -94.08]],
        [90.0, (28.16, 0.0), (-21.76, 30.72), [26.88, -96.0]],
        [90.0, (46.08, -1.92), (-21.76, 30.72), [29.44, -93.44]],
        [90.0, (53.76, -1.92), (-21.76, 30.72), [29.44, -93.44]],
        [90.0, (76.8, 0.0), (-21.76, 30.72), [28.16, -94.72]],
    ],
    "AR-SAND": [
        [37.5, (0.0, 0.0), (-1.6126, 49.3267), [0.0, -38.912, 0.0, -43.52, 0.0, -41.6]],
        [
            7.5,
            (0.0, 0.0),
            (45.3063, 72.2469),
            [0.0, -20.992, 0.0, -35.072, 0.0, -13.44],
        ],
        [
            327.5,
            (-31.488, 0.0),
            (79.722, 0.1449),
            [0.0, -12.8, 0.0, -46.08, 0.0, -60.16],
        ],
        [
            317.5,
            (-31.488, 0.0),
            (76.9568, 22.4685),
            [0.0, -6.4, 0.0, -30.208, 0.0, -34.56],
        ],
    ],
    "BOX": [
        [90.0, (0.0, 0.0), (-25.6, 0.0), []],
        [90.0, (6.4, 0.0), (-25.6, 0.0), []],
        [0.0, (0.0, 0.0), (0.0, 25.6), [-6.4, 6.4]],
        [0.0, (0.0, 6.4), (0.0, 25.6), [-6.4, 6.4]],
        [0.0, (0.0, 12.8), (0.0, 25.6), [6.4, -6.4]],
        [0.0, (0.0, 19.2), (0.0, 25.6), [6.4, -6.4]],
        [90.0, (12.8, 0.0), (-25.6, 0.0), [6.4, -6.4]],
        [90.0, (19.2, 0.0), (-25.6, 0.0), [6.4, -6.4]],
    ],
    "BRASS": [
        [0.0, (0.0, 0.0), (0.0, 6.4), []],
        [0.0, (0.0, 3.2), (0.0, 6.4), [3.2, -1.6]],
    ],
    "BRICK": [
        [0.0, (0.0, 0.0), (0.0, 6.4), []],
        [90.0, (0.0, 0.0), (-12.8, 0.0), [6.4, -6.4]],
        [90.0, (6.4, 0.0), (-12.8, 0.0), [-6.4, 6.4]],
    ],
    "BRSTONE": [
        [0.0, (0.0, 0.0), (0.0, 8.448), []],
        [90.0, (23.04, 0.0), (-12.8, 8.448), [8.448, -8.448]],
        [90.0, (20.48, 0.0), (-12.8, 8.448), [8.448, -8.448]],
        [0.0, (23.04, 1.408), (12.8, 8.448), [-23.04, 2.56]],
        [0.0, (23.04, 2.816), (12.8, 8.448), [-23.04, 2.56]],
        [0.0, (23.04, 4.224), (12.8, 8.448), [-23.04, 2.56]],
        [0.0, (23.04, 5.632), (12.8, 8.448), [-23.04, 2.56]],
        [0.0, (23.04, 7.04), (12.8, 8.448), [-23.04, 2.56]],
    ],
    "CLAY": [
        [0.0, (0.0, 0.0), (0.0, 4.8), []],
        [0.0, (0.0, 0.8), (0.0, 4.8), []],
        [0.0, (0.0, 1.6), (0.0, 4.8), []],
        [0.0, (0.0, 3.2), (0.0, 4.8), [4.8, -3.2]],
    ],
    "CORK": [
        [0.0, (0.0, 0.0), (0.0, 3.2), []],
        [135.0, (1.6, -1.6), (-6.4, -6.4), [4.5255, -4.5255]],
        [135.0, (2.4, -1.6), (-6.4, -6.4), [4.5255, -4.5255]],
        [135.0, (3.2, -1.6), (-6.4, -6.4), [4.5255, -4.5255]],
    ],
    "CROSS": [
        [0.0, (0.0, 0.0), (6.4, 6.4), [3.2, -9.6]],
        [90.0, (1.6, -1.6), (-6.4, 6.4), [3.2, -9.6]],
    ],
    "DASH": [[0.0, (0.0, 0.0), (3.2, 3.2), [3.2, -3.2]]],
    "DOLMIT": [
        [0.0, (0.0, 0.0), (0.0, 6.4), []],
        [45.0, (0.0, 0.0), (-12.8, 12.8), [9.051, -18.1019]],
    ],
    "DOTS": [[0.0, (0.0, 0.0), (0.8, 1.6), [0.0, -1.6]]],
    "EARTH": [
        [0.0, (0.0, 0.0), (6.4, 6.4), [6.4, -6.4]],
        [0.0, (0.0, 2.4), (6.4, 6.4), [6.4, -6.4]],
        [0.0, (0.0, 4.8), (6.4, 6.4), [6.4, -6.4]],
        [90.0, (0.8, 5.6), (-6.4, 6.4), [6.4, -6.4]],
        [90.0, (3.2, 5.6), (-6.4, 6.4), [6.4, -6.4]],
        [90.0, (5.6, 5.6), (-6.4, 6.4), [6.4, -6.4]],
    ],
    "ESCHER": [
        [60.0, (0.0, 0.0), (-30.72, -0.0), [28.16, -2.56]],
        [180.0, (0.0, 0.0), (15.36, -26.6043), [28.16, -2.56]],
        [300.0, (0.0, 0.0), (30.72, -0.0), [28.16, -2.56]],
        [60.0, (2.56, 0.0), (-30.72, -0.0), [5.12, -25.6]],
        [300.0, (2.56, 0.0), (30.72, -0.0), [5.12, -25.6]],
        [60.0, (-1.28, 2.217), (-30.72, -0.0), [5.12, -25.6]],
        [180.0, (-1.28, 2.217), (15.36, -26.6043), [5.12, -25.6]],
        [300.0, (-1.28, -2.217), (30.72, -0.0), [5.12, -25.6]],
        [180.0, (-1.28, -2.217), (15.36, -26.6043), [5.12, -25.6]],
        [60.0, (-10.24, 0.0), (-30.72, -0.0), [5.12, -25.6]],
        [300.0, (-10.24, 0.0), (30.72, -0.0), [5.12, -25.6]],
        [60.0, (5.12, -8.8681), (-30.72, -0.0), [5.12, -25.6]],
        [180.0, (5.12, -8.8681), (15.36, -26.6043), [5.12, -25.6]],
        [300.0, (5.12, 8.8681), (30.72, -0.0), [5.12, -25.6]],
        [180.0, (5.12, 8.8681), (15.36, -26.6043), [5.12, -25.6]],
        [0.0, (5.12, 4.4341), (-15.36, 26.6043), [17.92, -12.8]],
        [0.0, (5.12, -4.4341), (-15.36, 26.6043), [17.92, -12.8]],
        [120.0, (1.28, 6.6511), (-30.72, 0.0), [17.92, -12.8]],
        [120.0, (-6.4, 2.217), (-30.72, 0.0), [17.92, -12.8]],
        [240.0, (-6.4, -2.217), (15.36, -26.6043), [17.92, -12.8]],
        [240.0, (1.28, -6.6511), (15.36, -26.6043), [17.92, -12.8]],
    ],
    "FLEX": [
        [0.0, (0.0, 0.0), (0.0, 6.4), [6.4, -6.4]],
        [45.0, (6.4, 0.0), (0.0, 6.4), [1.6, -5.851, 1.6, -9.051]],
    ],
    "GOST_GLASS": [
        [45.0, (0.0, 0.0), (21.7223, -0.0), [12.8, -17.92]],
        [45.0, (5.4306, 0.0), (21.7223, -0.0), [5.12, -25.6]],
        [45.0, (0.0, 5.4306), (21.7223, -0.0), [5.12, -25.6]],
    ],
    "GOST_WOOD": [
        [90.0, (0.0, 0.0), (30.72, -0.0), [51.2, -10.24]],
        [90.0, (10.24, -10.24), (30.72, -0.0), [30.72, -7.68, 15.36, -7.68]],
        [90.0, (20.48, -25.6), (30.72, -0.0), [51.2, -10.24]],
    ],
    "GOST_GROUND": [
        [45.0, (0.0, 0.0), (72.4077, -0.0), [102.4]],
        [45.0, (15.36, 0.0), (72.4077, -0.0), [102.4]],
        [45.0, (30.72, 0.0), (72.4077, -0.0), [102.4]],
    ],
    "GRASS": [
        [90.0, (0.0, 0.0), (-18.1019, 18.1019), [4.8, -31.4039]],
        [45.0, (0.0, 0.0), (-18.1019, 18.1019), [4.8, -20.8]],
        [135.0, (0.0, 0.0), (-18.1019, -18.1019), [4.8, -20.8]],
    ],
    "GRATE": [[0.0, (0.0, 0.0), (0.0, 0.8), []], [90.0, (0.0, 0.0), (-3.2, 0.0), []]],
    "GRAVEL": [
        [228.0128, (18.432, 25.6), (-204.8, -230.4), [3.4441, -340.9687]],
        [184.9697, (16.128, 23.04), (307.2, 25.6), [5.9102, -585.1117]],
        [132.5104, (10.24, 22.528), (256.0, -281.6), [4.1674, -412.5704]],
        [267.2737, (0.256, 16.128), (25.6, 512.0), [5.3821, -532.8271]],
        [292.8337, (0.0, 10.752), (-128.0, 307.2), [5.2776, -522.48]],
        [357.2737, (2.048, 5.888), (-512.0, 25.6), [5.3821, -532.8271]],
        [37.6942, (7.424, 5.632), (-332.8, -256.0), [7.1175, -704.6361]],
        [72.2553, (13.056, 9.984), (179.2, 563.2), [6.7197, -665.2498]],
        [121.4296, (15.104, 16.384), (-204.8, 332.8), [5.4003, -534.6323]],
        [175.2364, (12.288, 20.992), (281.6, -25.6), [6.1653, -302.0995]],
        [222.3974, (6.144, 21.504), (-307.2, -281.6), [7.9731, -789.3344]],
        [138.8141, (25.6, 15.872), (-179.2, 153.6), [2.7213, -269.4104]],
        [171.4692, (23.552, 17.664), (332.8, -51.2), [5.1773, -512.5507]],
        [225.0, (18.432, 18.432), (-0.0, -25.6), [3.6204, -32.5835]],
        [203.1986, (16.64, 21.504), (128.0, 51.2), [1.9496, -193.0141]],
        [291.8014, (14.848, 20.736), (-25.6, 76.8), [2.7572, -135.103]],
        [30.9638, (15.872, 18.176), (76.8, 51.2), [4.4782, -144.7942]],
        [161.5651, (19.712, 20.48), (51.2, -25.6), [3.2382, -77.7161]],
        [16.3895, (0.0, 20.736), (256.0, 76.8), [4.5363, -449.0968]],
        [70.3462, (4.352, 22.016), (-102.4, -281.6), [3.8057, -376.7656]],
        [293.1986, (19.712, 25.6), (-51.2, 128.0), [3.8993, -191.0645]],
        [343.6105, (21.248, 22.016), (-256.0, 76.8), [4.5363, -449.0968]],
        [339.444, (0.0, 4.864), (-128.0, 51.2), [4.3745, -214.352]],
        [294.7751, (4.096, 3.328), (-128.0, 281.6), [3.6654, -362.8709]],
        [66.8014, (19.968, 0.0), (51.2, 128.0), [3.8993, -191.0645]],
        [17.354, (21.504, 3.584), (-332.8, -102.4), [4.2914, -424.8428]],
        [69.444, (7.424, 0.0), (-51.2, -128.0), [2.1873, -216.5392]],
        [101.3099, (18.432, 0.0), (-25.6, 102.4), [1.3053, -129.2296]],
        [165.9638, (18.176, 1.28), (76.8, -25.6), [5.2776, -100.2739]],
        [186.009, (13.056, 2.56), (256.0, 25.6), [4.8909, -484.1964]],
        [303.6901, (15.872, 15.872), (-25.6, 51.2), [3.6921, -88.61]],
        [353.1572, (17.92, 12.8), (435.2, -51.2), [6.4459, -638.1456]],
        [60.9454, (24.32, 12.032), (-102.4, -179.2), [2.6357, -260.9325]],
        [90.0, (25.6, 14.336), (-25.6, 25.6), [1.536, -24.064]],
        [120.2564, (12.544, 3.328), (102.4, -179.2), [3.5565, -352.0901]],
        [48.0128, (10.752, 6.4), (204.8, 230.4), [6.8882, -337.5245]],
        [0.0, (15.36, 11.52), (25.6, 25.6), [6.656, -18.944]],
        [325.3048, (22.016, 11.52), (256.0, -179.2), [4.0477, -400.7238]],
        [254.0546, (25.344, 9.216), (-25.6, -102.4), [3.7274, -182.6434]],
        [207.646, (24.32, 5.632), (-486.4, -256.0), [6.0689, -600.8185]],
        [175.4261, (18.944, 2.816), (-332.8, 25.6), [6.4205, -635.6243]],
    ],
    "HEX": [
        [0.0, (0.0, 0.0), (0.0, 5.5426), [3.2, -6.4]],
        [120.0, (0.0, 0.0), (-4.8, -2.7713), [3.2, -6.4]],
        [60.0, (3.2, 0.0), (-4.8, 2.7713), [3.2, -6.4]],
    ],
    "HONEY": [
        [0.0, (0.0, 0.0), (4.8, 2.7713), [3.2, -6.4]],
        [120.0, (0.0, 0.0), (-4.8, 2.7713), [3.2, -6.4]],
        [60.0, (0.0, 0.0), (0.0, 5.5426), [-6.4, 3.2]],
    ],
    "HOUND": [
        [0.0, (0.0, 0.0), (6.4, 1.6), [25.6, -12.8]],
        [90.0, (0.0, 0.0), (-1.6, -6.4), [25.6, -12.8]],
    ],
    "INSUL": [
        [0.0, (0.0, 0.0), (0.0, 9.6), []],
        [0.0, (0.0, 3.2), (0.0, 9.6), [3.2, -3.2]],
        [0.0, (0.0, 6.4), (0.0, 9.6), [3.2, -3.2]],
    ],
    "LINE": [[0.0, (0.0, 0.0), (0.0, 3.2), []]],
    "MUDST": [[0.0, (0.0, 0.0), (12.8, 6.4), [6.4, -6.4, 0.0, -6.4, 0.0, -6.4]]],
    "NET": [[0.0, (0.0, 0.0), (0.0, 3.2), []], [90.0, (0.0, 0.0), (-3.2, 0.0), []]],
    "NET3": [
        [0.0, (0.0, 0.0), (0.0, 3.2), []],
        [60.0, (0.0, 0.0), (-2.7713, 1.6), []],
        [120.0, (0.0, 0.0), (-2.7713, -1.6), []],
    ],
    "PLAST": [
        [0.0, (0.0, 0.0), (0.0, 6.4), []],
        [0.0, (0.0, 0.8), (0.0, 6.4), []],
        [0.0, (0.0, 1.6), (0.0, 6.4), []],
    ],
    "PLASTI": [
        [0.0, (0.0, 0.0), (0.0, 6.4), []],
        [0.0, (0.0, 0.8), (0.0, 6.4), []],
        [0.0, (0.0, 1.6), (0.0, 6.4), []],
        [0.0, (0.0, 4.0), (0.0, 6.4), []],
    ],
    "SACNCR": [
        [45.0, (0.0, 0.0), (-1.6971, 1.6971), []],
        [45.0, (1.6971, 0.0), (-1.6971, 1.6971), [0.0, -2.4]],
    ],
    "SQUARE": [
        [0.0, (0.0, 0.0), (0.0, 3.2), [3.2, -3.2]],
        [90.0, (0.0, 0.0), (-3.2, 0.0), [3.2, -3.2]],
    ],
    "STARS": [
        [0.0, (0.0, 0.0), (0.0, 5.5426), [3.2, -3.2]],
        [60.0, (0.0, 0.0), (-4.8, 2.7713), [3.2, -3.2]],
        [120.0, (1.6, 2.7713), (-4.8, -2.7713), [3.2, -3.2]],
    ],
    "STEEL": [
        [45.0, (0.0, 0.0), (-2.2627, 2.2627), []],
        [45.0, (0.0, 1.6), (-2.2627, 2.2627), []],
    ],
    "SWAMP": [
        [0.0, (0.0, 0.0), (12.8, 22.1703), [3.2, -22.4]],
        [90.0, (1.6, 0.0), (-12.8, 22.1703), [1.6, -42.7405]],
        [90.0, (2.0, 0.0), (-12.8, 22.1703), [1.28, -43.0605]],
        [90.0, (1.2, 0.0), (-12.8, 22.1703), [1.28, -43.0605]],
        [60.0, (2.4, 0.0), (-12.8, 22.1703), [1.024, -24.576]],
        [120.0, (0.8, 0.0), (-25.6, 0.0), [1.024, -24.576]],
    ],
    "TRANS": [
        [0.0, (0.0, 0.0), (0.0, 6.4), []],
        [0.0, (0.0, 3.2), (0.0, 6.4), [3.2, -3.2]],
    ],
    "TRIANG": [
        [60.0, (0.0, 0.0), (-4.8, 8.3138), [4.8, -4.8]],
        [120.0, (0.0, 0.0), (-9.6, 0.0), [4.8, -4.8]],
        [0.0, (-2.4, 4.1569), (4.8, 8.3138), [4.8, -4.8]],
    ],
    "ZIGZAG": [
        [0.0, (0.0, 0.0), (3.2, 3.2), [3.2, -3.2]],
        [90.0, (3.2, 0.0), (-3.2, 3.2), [3.2, -3.2]],
    ],
}


def load(old_pattern=None):
    from ezdxf.options import options
    if old_pattern is not None:
        use_old = bool(old_pattern)
        options.use_old_predefined_pattern_scaling = use_old
    else:
        use_old = options.use_old_predefined_pattern_scaling
    return PATTERN_OLD if use_old else PATTERN_NEW


def scale_pattern(pattern, factor: float = 1, angle: float = 0, ndigits: int = 4):
    def _scale(iterable):
        return [round(i * factor, ndigits) for i in iterable]

    def _scale_line(line):
        angle0, base_point, offset, dash_length_items = line
        if angle:
            base_point = Vec2(base_point).rotate_deg(angle)
            offset = Vec2(offset).rotate_deg(angle)
            angle0 = (angle0 + angle) % 360.0

        return [
            round(angle0, ndigits),
            tuple(_scale(base_point)),
            tuple(_scale(offset)),
            _scale(dash_length_items)
        ]

    return [_scale_line(line) for line in pattern]


def scale_all(pattern: dict, factor: float = 1, angle: float = 0, ndigits: int = 4):
    return {name: scale_pattern(p, factor, angle, ndigits) for name, p in pattern.items()}


PATTERN_OLD = scale_all(PATTERN_NEW, factor=0.03906836964688205)

# Purpose: Standard definitions
# Created: 08.07.2015
# Copyright (c) 2015-2020, <NAME>
# License: MIT License
# pattern type: predefined (1)

from ezdxf.math import Vec2

PATTERN_NEW = {
    "ANSI31": [[45.0, (0.0, 0.0), (-2.2627, 2.2627), []]],
    "ANSI32": [
        [45.0, (0.0, 0.0), (-6.7882, 6.7882), []],
        [45.0, (4.5255, 0.0), (-6.7882, 6.7882), []],
    ],
    "ANSI33": [
        [45.0, (512.0, 0.0), (-4.5255, 4.5255), []],
        [45.0, (516.5255, 0.0), (-4.5255, 4.5255), [3.2, -1.6]],
    ],
    "ANSI34": [
        [45.0, (0.0, 0.0), (-13.5765, 13.5765), []],
        [45.0, (4.5255, 0.0), (-13.5765, 13.5765), []],
        [45.0, (9.051, 0.0), (-13.5765, 13.5765), []],
        [45.0, (13.5765, 0.0), (-13.5765, 13.5765), []],
    ],
    "ANSI35": [
        [45.0, (-1024.0, -256.0), (-4.5255, 4.5255), []],
        [45.0, (-1019.4745, -256.0), (-4.5255, 4.5255), [8.0, -1.6, 0.0, -1.6]],
    ],
    "ANSI36": [[45.0, (-1024.0, -256.0), (1.6971, 6.2225), [8.0, -1.6, 0.0, -1.6]]],
    "ANSI37": [
        [45.0, (0.0, 0.0), (-2.2627, 2.2627), []],
        [135.0, (0.0, 0.0), (-2.2627, -2.2627), []],
    ],
    "ANSI38": [
        [45.0, (0.0, 0.0), (-2.2627, 2.2627), []],
        [135.0, (0.0, 0.0), (-6.7882, 2.2627), [8.0, -4.8]],
    ],
    "ACAD_ISO02W100": [[0.0, (0.0, 0.0), (0.0, 12.8), [30.72, -7.68]]],
    "ACAD_ISO03W100": [[0.0, (0.0, 0.0), (0.0, 12.8), [30.72, -46.08]]],
    "ACAD_ISO04W100": [[0.0, (0.0, 0.0), (0.0, 12.8), [61.44, -7.68, 1.28, -7.68]]],
    "ACAD_ISO05W100": [
        [0.0, (0.0, 0.0), (0.0, 12.8), [61.44, -7.68, 1.28, -7.68, 1.28, -7.68]]
    ],
    "ACAD_ISO06W100": [
        [0.0, (0.0, 0.0), (0.0, 12.8), [61.44, -7.68, 1.28, -7.68, 1.28, -16.64]],
        [0.0, (0.0, 0.0), (0.0, 12.8), [-87.04, 1.28, -7.68]],
    ],
    "ACAD_ISO07W100": [[0.0, (0.0, 0.0), (0.0, 12.8), [1.28, -7.68]]],
    "ACAD_ISO08W100": [[0.0, (0.0, 0.0), (0.0, 12.8), [61.44, -7.68, 15.36, -7.68]]],
    "ACAD_ISO09W100": [
        [0.0, (0.0, 0.0), (0.0, 12.8), [61.44, -7.68, 15.36, -7.68, 15.36, -7.68]]
    ],
    "ACAD_ISO10W100": [[0.0, (0.0, 0.0), (0.0, 12.8), [30.72, -7.68, 1.28, -7.68]]],
    "ACAD_ISO11W100": [
        [0.0, (0.0, 0.0), (0.0, 12.8), [30.72, -7.68, 30.72, -7.68, 1.28, -7.68]]
    ],
    "ACAD_ISO12W100": [
        [0.0, (0.0, 0.0), (0.0, 12.8), [30.72, -7.68, 1.28, -7.68, 1.28, -7.68]]
    ],
    "ACAD_ISO13W100": [
        [0.0, (0.0, 0.0), (0.0, 12.8), [30.72, -7.68, 30.72, -7.68, 1.28, -16.64]],
        [0.0, (0.0, 0.0), (0.0, 12.8), [-85.76, 1.28, -7.68]],
    ],
    "ACAD_ISO14W100": [
        [0.0, (0.0, 0.0), (0.0, 12.8), [30.72, -7.68, 1.28, -7.68, 1.28, -16.64]],
        [0.0, (0.0, 0.0), (0.0, 12.8), [-56.32, 1.28, -7.68]],
    ],
    "ACAD_ISO15W100": [
        [0.0, (0.0, 0.0), (0.0, 12.8), [30.72, -7.68, 30.72, -7.68, 1.28, -25.6]],
        [0.0, (0.0, 0.0), (0.0, 12.8), [-85.76, 1.28, -7.68, 1.28, -7.68]],
    ],
    "ANGLE": [
        [0.0, (0.0, 0.0), (0.0, 7.04), [5.12, -1.92]],
        [90.0, (0.0, 0.0), (-7.04, 0.0), [5.12, -1.92]],
    ],
    "AR-B816": [
        [0.0, (0.0, 0.0), (0.0, 20.48), []],
        [90.0, (0.0, 0.0), (-20.48, 20.48), [20.48, -20.48]],
    ],
    "AR-B816C": [
        [0.0, (0.0, 0.0), (20.48, 20.48), [40.0, -0.96]],
        [0.0, (-20.48, 0.96), (20.48, 20.48), [40.0, -0.96]],
        [90.0, (0.0, 0.0), (-20.48, 20.48), [-21.44, 19.52]],
        [90.0, (-0.96, 0.0), (-20.48, 20.48), [-21.44, 19.52]],
    ],
    "AR-B88": [
        [0.0, (0.0, 0.0), (0.0, 20.48), []],
        [90.0, (0.0, 0.0), (-10.24, 20.48), [20.48, -20.48]],
    ],
    "AR-BRELM": [
        [0.0, (0.0, 0.0), (0.0, 68.2752), [97.6, -4.8]],
        [0.0, (0.0, 28.8), (0.0, 68.2752), [97.6, -4.8]],
        [0.0, (25.6, 34.1376), (0.0, 68.2752), [46.4, -4.8]],
        [0.0, (25.6, 62.9376), (0.0, 68.2752), [46.4, -4.8]],
        [90.0, (0.0, 0.0), (-102.4, 0.0), [28.8, -39.4752]],
        [90.0, (-4.8, 0.0), (-102.4, 0.0), [28.8, -39.4752]],
        [90.0, (25.6, 34.1376), (-51.2, 0.0), [28.8, -39.4752]],
        [90.0, (20.8, 34.1376), (-51.2, 0.0), [28.8, -39.4752]],
    ],
    "AR-BRSTD": [
        [0.0, (0.0, 0.0), (0.0, 68.2752), []],
        [90.0, (0.0, 0.0), (-102.4, 68.2752), [68.2752, -68.2752]],
    ],
    "AR-CONC": [
        [50.0, (0.0, 0.0), (36.7237, -3.2129), [3.84, -42.24]],
        [355.0, (0.0, 0.0), (-7.1041, 38.5122), [3.072, -33.792]],
        [100.4514, (3.0603, -0.2677), (29.6197, 35.2993), [3.2635, -35.8985]],
        [46.1842, (0.0, 10.24), (54.6428, -8.4746), [5.76, -63.36]],
        [96.6356, (4.5536, 9.5338), (47.8547, 49.8749), [4.8952, -53.8477]],
        [351.1842, (0.0, 10.24), (47.8547, 49.8749), [4.608, -50.688]],
        [21.0, (5.12, 7.68), (30.5616, -20.6141), [3.84, -42.24]],
        [326.0, (5.12, 7.68), (12.4577, 37.1277), [3.072, -33.792]],
        [71.4514, (7.6668, 5.9622), (43.0194, 16.5136), [3.2635, -35.8985]],
        [
            37.5,
            (0.0, 0.0),
            (0.6226, 17.0442),
            [0.0, -33.3824, 0.0, -34.304, 0.0, -33.92],
        ],
        [
            7.5,
            (0.0, 0.0),
            (13.4692, 20.1939),
            [0.0, -19.5584, 0.0, -32.6144, 0.0, -12.928],
        ],
        [
            327.5,
            (-11.4176, 0.0),
            (27.3317, -1.1548),
            [0.0, -12.8, 0.0, -39.936, 0.0, -52.992],
        ],
        [
            317.5,
            (-16.5376, 0.0),
            (29.8591, 5.1254),
            [0.0, -16.64, 0.0, -26.5216, 0.0, -37.632],
        ],
    ],
    "AR-HBONE": [
        [45.0, (0.0, 0.0), (0.0, 28.9631), [61.44, -20.48]],
        [135.0, (14.4815, 14.4815), (0.0, 28.9631), [61.44, -20.48]],
    ],
    "AR-PARQ1": [
        [90.0, (0.0, 0.0), (-61.44, 61.44), [61.44, -61.44]],
        [90.0, (10.24, 0.0), (-61.44, 61.44), [61.44, -61.44]],
        [90.0, (20.48, 0.0), (-61.44, 61.44), [61.44, -61.44]],
        [90.0, (30.72, 0.0), (-61.44, 61.44), [61.44, -61.44]],
        [90.0, (40.96, 0.0), (-61.44, 61.44), [61.44, -61.44]],
        [90.0, (51.2, 0.0), (-61.44, 61.44), [61.44, -61.44]],
        [90.0, (61.44, 0.0), (-61.44, 61.44), [61.44, -61.44]],
        [0.0, (0.0, 61.44), (61.44, -61.44), [61.44, -61.44]],
        [0.0, (0.0, 71.68), (61.44, -61.44), [61.44, -61.44]],
        [0.0, (0.0, 81.92), (61.44, -61.44), [61.44, -61.44]],
        [0.0, (0.0, 92.16), (61.44, -61.44), [61.44, -61.44]],
        [0.0, (0.0, 102.4), (61.44, -61.44), [61.44, -61.44]],
        [0.0, (0.0, 112.64), (61.44, -61.44), [61.44, -61.44]],
        [0.0, (0.0, 122.88), (61.44, -61.44), [61.44, -61.44]],
    ],
    "AR-RROOF": [
        [0.0, (0.0, 0.0), (56.32, 25.6), [384.0, -51.2, 128.0, -25.6]],
        [0.0, (34.048, 12.8), (-25.6, 34.048), [76.8, -8.448, 153.6, -19.2]],
        [0.0, (12.8, 21.76), (133.12, 17.152), [204.8, -35.84, 102.4, -25.6]],
    ],
    "AR-RSHKE": [
        [0.0, (0.0, 0.0), (65.28, 30.72), [15.36, -12.8, 17.92, -7.68, 23.04, -10.24]],
        [0.0, (15.36, 1.28), (65.28, 30.72), [12.8, -48.64, 10.24, -15.36]],
        [0.0, (46.08, -1.92), (65.28, 30.72), [7.68, -79.36]],
        [90.0, (0.0, 0.0), (-21.76, 30.72), [29.44, -93.44]],
        [90.0, (15.36, 0.0), (-21.76, 30.72), [28.8, -94.08]],
        [90.0, (28.16, 0.0), (-21.76, 30.72), [26.88, -96.0]],
        [90.0, (46.08, -1.92), (-21.76, 30.72), [29.44, -93.44]],
        [90.0, (53.76, -1.92), (-21.76, 30.72), [29.44, -93.44]],
        [90.0, (76.8, 0.0), (-21.76, 30.72), [28.16, -94.72]],
    ],
    "AR-SAND": [
        [37.5, (0.0, 0.0), (-1.6126, 49.3267), [0.0, -38.912, 0.0, -43.52, 0.0, -41.6]],
        [
            7.5,
            (0.0, 0.0),
            (45.3063, 72.2469),
            [0.0, -20.992, 0.0, -35.072, 0.0, -13.44],
        ],
        [
            327.5,
            (-31.488, 0.0),
            (79.722, 0.1449),
            [0.0, -12.8, 0.0, -46.08, 0.0, -60.16],
        ],
        [
            317.5,
            (-31.488, 0.0),
            (76.9568, 22.4685),
            [0.0, -6.4, 0.0, -30.208, 0.0, -34.56],
        ],
    ],
    "BOX": [
        [90.0, (0.0, 0.0), (-25.6, 0.0), []],
        [90.0, (6.4, 0.0), (-25.6, 0.0), []],
        [0.0, (0.0, 0.0), (0.0, 25.6), [-6.4, 6.4]],
        [0.0, (0.0, 6.4), (0.0, 25.6), [-6.4, 6.4]],
        [0.0, (0.0, 12.8), (0.0, 25.6), [6.4, -6.4]],
        [0.0, (0.0, 19.2), (0.0, 25.6), [6.4, -6.4]],
        [90.0, (12.8, 0.0), (-25.6, 0.0), [6.4, -6.4]],
        [90.0, (19.2, 0.0), (-25.6, 0.0), [6.4, -6.4]],
    ],
    "BRASS": [
        [0.0, (0.0, 0.0), (0.0, 6.4), []],
        [0.0, (0.0, 3.2), (0.0, 6.4), [3.2, -1.6]],
    ],
    "BRICK": [
        [0.0, (0.0, 0.0), (0.0, 6.4), []],
        [90.0, (0.0, 0.0), (-12.8, 0.0), [6.4, -6.4]],
        [90.0, (6.4, 0.0), (-12.8, 0.0), [-6.4, 6.4]],
    ],
    "BRSTONE": [
        [0.0, (0.0, 0.0), (0.0, 8.448), []],
        [90.0, (23.04, 0.0), (-12.8, 8.448), [8.448, -8.448]],
        [90.0, (20.48, 0.0), (-12.8, 8.448), [8.448, -8.448]],
        [0.0, (23.04, 1.408), (12.8, 8.448), [-23.04, 2.56]],
        [0.0, (23.04, 2.816), (12.8, 8.448), [-23.04, 2.56]],
        [0.0, (23.04, 4.224), (12.8, 8.448), [-23.04, 2.56]],
        [0.0, (23.04, 5.632), (12.8, 8.448), [-23.04, 2.56]],
        [0.0, (23.04, 7.04), (12.8, 8.448), [-23.04, 2.56]],
    ],
    "CLAY": [
        [0.0, (0.0, 0.0), (0.0, 4.8), []],
        [0.0, (0.0, 0.8), (0.0, 4.8), []],
        [0.0, (0.0, 1.6), (0.0, 4.8), []],
        [0.0, (0.0, 3.2), (0.0, 4.8), [4.8, -3.2]],
    ],
    "CORK": [
        [0.0, (0.0, 0.0), (0.0, 3.2), []],
        [135.0, (1.6, -1.6), (-6.4, -6.4), [4.5255, -4.5255]],
        [135.0, (2.4, -1.6), (-6.4, -6.4), [4.5255, -4.5255]],
        [135.0, (3.2, -1.6), (-6.4, -6.4), [4.5255, -4.5255]],
    ],
    "CROSS": [
        [0.0, (0.0, 0.0), (6.4, 6.4), [3.2, -9.6]],
        [90.0, (1.6, -1.6), (-6.4, 6.4), [3.2, -9.6]],
    ],
    "DASH": [[0.0, (0.0, 0.0), (3.2, 3.2), [3.2, -3.2]]],
    "DOLMIT": [
        [0.0, (0.0, 0.0), (0.0, 6.4), []],
        [45.0, (0.0, 0.0), (-12.8, 12.8), [9.051, -18.1019]],
    ],
    "DOTS": [[0.0, (0.0, 0.0), (0.8, 1.6), [0.0, -1.6]]],
    "EARTH": [
        [0.0, (0.0, 0.0), (6.4, 6.4), [6.4, -6.4]],
        [0.0, (0.0, 2.4), (6.4, 6.4), [6.4, -6.4]],
        [0.0, (0.0, 4.8), (6.4, 6.4), [6.4, -6.4]],
        [90.0, (0.8, 5.6), (-6.4, 6.4), [6.4, -6.4]],
        [90.0, (3.2, 5.6), (-6.4, 6.4), [6.4, -6.4]],
        [90.0, (5.6, 5.6), (-6.4, 6.4), [6.4, -6.4]],
    ],
    "ESCHER": [
        [60.0, (0.0, 0.0), (-30.72, -0.0), [28.16, -2.56]],
        [180.0, (0.0, 0.0), (15.36, -26.6043), [28.16, -2.56]],
        [300.0, (0.0, 0.0), (30.72, -0.0), [28.16, -2.56]],
        [60.0, (2.56, 0.0), (-30.72, -0.0), [5.12, -25.6]],
        [300.0, (2.56, 0.0), (30.72, -0.0), [5.12, -25.6]],
        [60.0, (-1.28, 2.217), (-30.72, -0.0), [5.12, -25.6]],
        [180.0, (-1.28, 2.217), (15.36, -26.6043), [5.12, -25.6]],
        [300.0, (-1.28, -2.217), (30.72, -0.0), [5.12, -25.6]],
        [180.0, (-1.28, -2.217), (15.36, -26.6043), [5.12, -25.6]],
        [60.0, (-10.24, 0.0), (-30.72, -0.0), [5.12, -25.6]],
        [300.0, (-10.24, 0.0), (30.72, -0.0), [5.12, -25.6]],
        [60.0, (5.12, -8.8681), (-30.72, -0.0), [5.12, -25.6]],
        [180.0, (5.12, -8.8681), (15.36, -26.6043), [5.12, -25.6]],
        [300.0, (5.12, 8.8681), (30.72, -0.0), [5.12, -25.6]],
        [180.0, (5.12, 8.8681), (15.36, -26.6043), [5.12, -25.6]],
        [0.0, (5.12, 4.4341), (-15.36, 26.6043), [17.92, -12.8]],
        [0.0, (5.12, -4.4341), (-15.36, 26.6043), [17.92, -12.8]],
        [120.0, (1.28, 6.6511), (-30.72, 0.0), [17.92, -12.8]],
        [120.0, (-6.4, 2.217), (-30.72, 0.0), [17.92, -12.8]],
        [240.0, (-6.4, -2.217), (15.36, -26.6043), [17.92, -12.8]],
        [240.0, (1.28, -6.6511), (15.36, -26.6043), [17.92, -12.8]],
    ],
    "FLEX": [
        [0.0, (0.0, 0.0), (0.0, 6.4), [6.4, -6.4]],
        [45.0, (6.4, 0.0), (0.0, 6.4), [1.6, -5.851, 1.6, -9.051]],
    ],
    "GOST_GLASS": [
        [45.0, (0.0, 0.0), (21.7223, -0.0), [12.8, -17.92]],
        [45.0, (5.4306, 0.0), (21.7223, -0.0), [5.12, -25.6]],
        [45.0, (0.0, 5.4306), (21.7223, -0.0), [5.12, -25.6]],
    ],
    "GOST_WOOD": [
        [90.0, (0.0, 0.0), (30.72, -0.0), [51.2, -10.24]],
        [90.0, (10.24, -10.24), (30.72, -0.0), [30.72, -7.68, 15.36, -7.68]],
        [90.0, (20.48, -25.6), (30.72, -0.0), [51.2, -10.24]],
    ],
    "GOST_GROUND": [
        [45.0, (0.0, 0.0), (72.4077, -0.0), [102.4]],
        [45.0, (15.36, 0.0), (72.4077, -0.0), [102.4]],
        [45.0, (30.72, 0.0), (72.4077, -0.0), [102.4]],
    ],
    "GRASS": [
        [90.0, (0.0, 0.0), (-18.1019, 18.1019), [4.8, -31.4039]],
        [45.0, (0.0, 0.0), (-18.1019, 18.1019), [4.8, -20.8]],
        [135.0, (0.0, 0.0), (-18.1019, -18.1019), [4.8, -20.8]],
    ],
    "GRATE": [[0.0, (0.0, 0.0), (0.0, 0.8), []], [90.0, (0.0, 0.0), (-3.2, 0.0), []]],
    "GRAVEL": [
        [228.0128, (18.432, 25.6), (-204.8, -230.4), [3.4441, -340.9687]],
        [184.9697, (16.128, 23.04), (307.2, 25.6), [5.9102, -585.1117]],
        [132.5104, (10.24, 22.528), (256.0, -281.6), [4.1674, -412.5704]],
        [267.2737, (0.256, 16.128), (25.6, 512.0), [5.3821, -532.8271]],
        [292.8337, (0.0, 10.752), (-128.0, 307.2), [5.2776, -522.48]],
        [357.2737, (2.048, 5.888), (-512.0, 25.6), [5.3821, -532.8271]],
        [37.6942, (7.424, 5.632), (-332.8, -256.0), [7.1175, -704.6361]],
        [72.2553, (13.056, 9.984), (179.2, 563.2), [6.7197, -665.2498]],
        [121.4296, (15.104, 16.384), (-204.8, 332.8), [5.4003, -534.6323]],
        [175.2364, (12.288, 20.992), (281.6, -25.6), [6.1653, -302.0995]],
        [222.3974, (6.144, 21.504), (-307.2, -281.6), [7.9731, -789.3344]],
        [138.8141, (25.6, 15.872), (-179.2, 153.6), [2.7213, -269.4104]],
        [171.4692, (23.552, 17.664), (332.8, -51.2), [5.1773, -512.5507]],
        [225.0, (18.432, 18.432), (-0.0, -25.6), [3.6204, -32.5835]],
        [203.1986, (16.64, 21.504), (128.0, 51.2), [1.9496, -193.0141]],
        [291.8014, (14.848, 20.736), (-25.6, 76.8), [2.7572, -135.103]],
        [30.9638, (15.872, 18.176), (76.8, 51.2), [4.4782, -144.7942]],
        [161.5651, (19.712, 20.48), (51.2, -25.6), [3.2382, -77.7161]],
        [16.3895, (0.0, 20.736), (256.0, 76.8), [4.5363, -449.0968]],
        [70.3462, (4.352, 22.016), (-102.4, -281.6), [3.8057, -376.7656]],
        [293.1986, (19.712, 25.6), (-51.2, 128.0), [3.8993, -191.0645]],
        [343.6105, (21.248, 22.016), (-256.0, 76.8), [4.5363, -449.0968]],
        [339.444, (0.0, 4.864), (-128.0, 51.2), [4.3745, -214.352]],
        [294.7751, (4.096, 3.328), (-128.0, 281.6), [3.6654, -362.8709]],
        [66.8014, (19.968, 0.0), (51.2, 128.0), [3.8993, -191.0645]],
        [17.354, (21.504, 3.584), (-332.8, -102.4), [4.2914, -424.8428]],
        [69.444, (7.424, 0.0), (-51.2, -128.0), [2.1873, -216.5392]],
        [101.3099, (18.432, 0.0), (-25.6, 102.4), [1.3053, -129.2296]],
        [165.9638, (18.176, 1.28), (76.8, -25.6), [5.2776, -100.2739]],
        [186.009, (13.056, 2.56), (256.0, 25.6), [4.8909, -484.1964]],
        [303.6901, (15.872, 15.872), (-25.6, 51.2), [3.6921, -88.61]],
        [353.1572, (17.92, 12.8), (435.2, -51.2), [6.4459, -638.1456]],
        [60.9454, (24.32, 12.032), (-102.4, -179.2), [2.6357, -260.9325]],
        [90.0, (25.6, 14.336), (-25.6, 25.6), [1.536, -24.064]],
        [120.2564, (12.544, 3.328), (102.4, -179.2), [3.5565, -352.0901]],
        [48.0128, (10.752, 6.4), (204.8, 230.4), [6.8882, -337.5245]],
        [0.0, (15.36, 11.52), (25.6, 25.6), [6.656, -18.944]],
        [325.3048, (22.016, 11.52), (256.0, -179.2), [4.0477, -400.7238]],
        [254.0546, (25.344, 9.216), (-25.6, -102.4), [3.7274, -182.6434]],
        [207.646, (24.32, 5.632), (-486.4, -256.0), [6.0689, -600.8185]],
        [175.4261, (18.944, 2.816), (-332.8, 25.6), [6.4205, -635.6243]],
    ],
    "HEX": [
        [0.0, (0.0, 0.0), (0.0, 5.5426), [3.2, -6.4]],
        [120.0, (0.0, 0.0), (-4.8, -2.7713), [3.2, -6.4]],
        [60.0, (3.2, 0.0), (-4.8, 2.7713), [3.2, -6.4]],
    ],
    "HONEY": [
        [0.0, (0.0, 0.0), (4.8, 2.7713), [3.2, -6.4]],
        [120.0, (0.0, 0.0), (-4.8, 2.7713), [3.2, -6.4]],
        [60.0, (0.0, 0.0), (0.0, 5.5426), [-6.4, 3.2]],
    ],
    "HOUND": [
        [0.0, (0.0, 0.0), (6.4, 1.6), [25.6, -12.8]],
        [90.0, (0.0, 0.0), (-1.6, -6.4), [25.6, -12.8]],
    ],
    "INSUL": [
        [0.0, (0.0, 0.0), (0.0, 9.6), []],
        [0.0, (0.0, 3.2), (0.0, 9.6), [3.2, -3.2]],
        [0.0, (0.0, 6.4), (0.0, 9.6), [3.2, -3.2]],
    ],
    "LINE": [[0.0, (0.0, 0.0), (0.0, 3.2), []]],
    "MUDST": [[0.0, (0.0, 0.0), (12.8, 6.4), [6.4, -6.4, 0.0, -6.4, 0.0, -6.4]]],
    "NET": [[0.0, (0.0, 0.0), (0.0, 3.2), []], [90.0, (0.0, 0.0), (-3.2, 0.0), []]],
    "NET3": [
        [0.0, (0.0, 0.0), (0.0, 3.2), []],
        [60.0, (0.0, 0.0), (-2.7713, 1.6), []],
        [120.0, (0.0, 0.0), (-2.7713, -1.6), []],
    ],
    "PLAST": [
        [0.0, (0.0, 0.0), (0.0, 6.4), []],
        [0.0, (0.0, 0.8), (0.0, 6.4), []],
        [0.0, (0.0, 1.6), (0.0, 6.4), []],
    ],
    "PLASTI": [
        [0.0, (0.0, 0.0), (0.0, 6.4), []],
        [0.0, (0.0, 0.8), (0.0, 6.4), []],
        [0.0, (0.0, 1.6), (0.0, 6.4), []],
        [0.0, (0.0, 4.0), (0.0, 6.4), []],
    ],
    "SACNCR": [
        [45.0, (0.0, 0.0), (-1.6971, 1.6971), []],
        [45.0, (1.6971, 0.0), (-1.6971, 1.6971), [0.0, -2.4]],
    ],
    "SQUARE": [
        [0.0, (0.0, 0.0), (0.0, 3.2), [3.2, -3.2]],
        [90.0, (0.0, 0.0), (-3.2, 0.0), [3.2, -3.2]],
    ],
    "STARS": [
        [0.0, (0.0, 0.0), (0.0, 5.5426), [3.2, -3.2]],
        [60.0, (0.0, 0.0), (-4.8, 2.7713), [3.2, -3.2]],
        [120.0, (1.6, 2.7713), (-4.8, -2.7713), [3.2, -3.2]],
    ],
    "STEEL": [
        [45.0, (0.0, 0.0), (-2.2627, 2.2627), []],
        [45.0, (0.0, 1.6), (-2.2627, 2.2627), []],
    ],
    "SWAMP": [
        [0.0, (0.0, 0.0), (12.8, 22.1703), [3.2, -22.4]],
        [90.0, (1.6, 0.0), (-12.8, 22.1703), [1.6, -42.7405]],
        [90.0, (2.0, 0.0), (-12.8, 22.1703), [1.28, -43.0605]],
        [90.0, (1.2, 0.0), (-12.8, 22.1703), [1.28, -43.0605]],
        [60.0, (2.4, 0.0), (-12.8, 22.1703), [1.024, -24.576]],
        [120.0, (0.8, 0.0), (-25.6, 0.0), [1.024, -24.576]],
    ],
    "TRANS": [
        [0.0, (0.0, 0.0), (0.0, 6.4), []],
        [0.0, (0.0, 3.2), (0.0, 6.4), [3.2, -3.2]],
    ],
    "TRIANG": [
        [60.0, (0.0, 0.0), (-4.8, 8.3138), [4.8, -4.8]],
        [120.0, (0.0, 0.0), (-9.6, 0.0), [4.8, -4.8]],
        [0.0, (-2.4, 4.1569), (4.8, 8.3138), [4.8, -4.8]],
    ],
    "ZIGZAG": [
        [0.0, (0.0, 0.0), (3.2, 3.2), [3.2, -3.2]],
        [90.0, (3.2, 0.0), (-3.2, 3.2), [3.2, -3.2]],
    ],
}


def load(old_pattern=None):
    from ezdxf.options import options
    if old_pattern is not None:
        use_old = bool(old_pattern)
        options.use_old_predefined_pattern_scaling = use_old
    else:
        use_old = options.use_old_predefined_pattern_scaling
    return PATTERN_OLD if use_old else PATTERN_NEW


def scale_pattern(pattern, factor: float = 1, angle: float = 0, ndigits: int = 4):
    def _scale(iterable):
        return [round(i * factor, ndigits) for i in iterable]

    def _scale_line(line):
        angle0, base_point, offset, dash_length_items = line
        if angle:
            base_point = Vec2(base_point).rotate_deg(angle)
            offset = Vec2(offset).rotate_deg(angle)
            angle0 = (angle0 + angle) % 360.0

        return [
            round(angle0, ndigits),
            tuple(_scale(base_point)),
            tuple(_scale(offset)),
            _scale(dash_length_items)
        ]

    return [_scale_line(line) for line in pattern]


def scale_all(pattern: dict, factor: float = 1, angle: float = 0, ndigits: int = 4):
    return {name: scale_pattern(p, factor, angle, ndigits) for name, p in pattern.items()}


PATTERN_OLD = scale_all(PATTERN_NEW, factor=0.03906836964688205)

# Purpose: Standard definitions # Created: 08.07.2015 # Copyright (c) 2015-2020, <NAME> # License: MIT License # pattern type: predefined (1)