Example #1
0
def trafficlights_head(height=0.8, depth=0.3):

    head = ddd.rect([-0.15, 0, 0.15, height], name="TrafficLight Box").material(ddd.mats.metal_paint_green).extrude(depth)
    disc_green = ddd.disc(ddd.point([0, 0.2]), r=0.09, name="TrafficLight Disc Green").material(ddd.mats.light_green).extrude(0.05)
    disc_orange = ddd.disc(ddd.point([0, 0.4]), r=0.09, name="TrafficLight Disc Green").material(ddd.mats.light_orange).extrude(0.05)
    disc_red = ddd.disc(ddd.point([0, 0.6]), r=0.09, name="TrafficLight Disc Green").material(ddd.mats.light_red).extrude(0.05)

    discs = ddd.group([disc_green, disc_orange, disc_red], name="TrafficLight Discs").translate([0, 0, depth])  # Put discs over head
    head = ddd.group([head, discs], name="TrafficLight Head").translate([0, -height / 2.0, 0])  # Center vertically
    head = head.rotate([math.pi / 2.0, 0, 0])
    head = ddd.uv.map_cubic(head)

    return head
Example #2
0
def basketball_hoop():
    """
    """

    ring_r = 0.45 / 2
    ring = ddd.disc(
        r=ring_r,
        name="Basketball hoop ring").outline().buffer(0.015).extrude(-0.03)
    ring = ring.material(ddd.mats.steel)
    #ring = ddd.uv.map_cubic(ring)

    board_w = 1.80
    board_h = 1.20
    board_ring_h = 0.30
    board_shape = ddd.rect(
        [board_w, board_h],
        name="Basketball hoop board").recenter().extrude(-0.05)
    board_shape = board_shape.material(ddd.mats.plastic_transparent)
    #board_shape = ddd.uv.map_cubic(board_shape)
    board_shape = board_shape.rotate(ddd.ROT_FLOOR_TO_FRONT)
    board_shape = board_shape.translate(
        [0, ring_r + 0.15, board_h / 2 - board_ring_h])

    board = ddd.group3([ring, board_shape], name="Basketball hoop")
    board = board.translate([0, 0, 3.05])

    pole = curvedpost(3.25, arm_length=1.5,
                      corner_radius=0.4).rotate(ddd.ROT_TOP_CCW)
    pole = pole.material(ddd.mats.metal_paint_red)
    pole.prop_set('uv', None, True)
    pole = pole.translate([0, ring_r + 0.15 + 0.05 + 1.5, 0])

    hoop = ddd.group3([pole, board], name="Basketball hoop with pole")

    return hoop
Example #3
0
def bell(r=1.00, height=2.6, thick=0.10):
    """
    The bell is hung on 0, 0, 0.
    """
    base = ddd.disc(r=r, resolution=4, name="Bell").subtract(ddd.disc(r=r - thick, resolution=4))
    extrude_steps = ((4.45, 0), (4.5, 0.25), (4.3, 1), (3.7, 2), (3.0, 3), (2.5, 4), (2.3, 5), (2.4, 6), (2.6, 7))
    bell = extrude_step_multi(base, extrude_steps, base=True, cap=False, scale_y=height / 10)
    bell = bell.twosided()

    cap = extrude_dome(ddd.disc(r=r * (2.6 / 4.45), resolution=4), height=1.5 / 10)
    cap = cap.translate([0, 0, 7 / 10 * height])

    bell = ddd.group([bell, cap]).combine()
    bell = bell.material(ddd.mats.bronze)
    bell = ddd.uv.map_cylindrical(bell)
    bell = bell.translate([0, 0, -height])

    return bell
Example #4
0
def fountain(r=1.5):
    # Base
    base = ddd.disc(r=r, resolution=2).extrude(0.30).material(ddd.mats.stone)
    base = ddd.uv.map_cylindrical(base)

    # Fountain
    fountain = ddd.sphere(r=r, subdivisions=1).subtract(ddd.cube(d=r * 1.2)).subtract(ddd.sphere(r=r - 0.2, subdivisions=1))
    fountain = fountain.translate([0, 0, 1.2])  # TODO: align
    fountain = fountain.material(ddd.mats.stone)
    fountain = ddd.uv.map_spherical(fountain)
    #.subtract(base)
    # Water
    water = ddd.disc(r=r-0.2, resolution=2).triangulate().translate([0, 0, 1.1]).material(ddd.mats.water)
    water.extra['ddd:collider'] = False
    water.extra['ddd:occluder'] = False
    water.extra['ddd:shadows'] = False

    item = ddd.group([base, fountain, water])
    return item
Example #5
0
def features_gen(pipeline, root, logger):

    area = ddd.disc(r=100.0)

    points_coords = area.random_points(num_points=200)
    points = ddd.group2([ddd.point(c) for c in points_coords], name="Points")
    points.extra['points_coords'] = points_coords

    root.find("/Features2").append(area)
    root.find("/Features2").append(points)
Example #6
0
def trash_bin_hung(height=0.70, r=0.25):
    base = ddd.disc(r=r - 0.05, resolution=3)
    item = base.extrude_step(base, 0.10)
    item = item.extrude_step(base.buffer(0.05, join_style=ddd.JOIN_MITRE), height)
    item = item.extrude_step(base.buffer(0.03, join_style=ddd.JOIN_MITRE), 0.0)
    item = item.extrude_step(base, -(height - 0.2))
    item = item.translate([0, -r, -height + 0.05])
    item = item.material(ddd.mats.steel)
    item = item.smooth()
    item = ddd.uv.map_cylindrical(item, split=True)
    return item
Example #7
0
def trash_bin(height=1.20, r=0.35):
    base = ddd.disc(r=r - 0.05, resolution=3)
    item = base.extrude_step(base, 0.10)
    item = item.extrude_step(base.buffer(0.05, join_style=ddd.JOIN_MITRE), 0.0)
    item = item.extrude_step(base.buffer(0.05, join_style=ddd.JOIN_MITRE), height - 0.15)
    item = item.extrude_step(base, 0.05)
    item = item.extrude_step(base.buffer(-0.05), 0.0)
    item = item.extrude_step(base.buffer(-0.05), -(height - 0.4))
    item = item.material(ddd.mats.steel)
    item = item.smooth()
    item = ddd.uv.map_cylindrical(item, split=True)
    return item
Example #8
0
def create_base(root, obj):
    year = int(
        obj.extra['element:year']) if obj.extra['element:year'] else -10000
    age = 2020 - year
    height = (math.log(age, 2) - 1) * 0.4 + 0.02
    base = ddd.disc(r=1.5, name="Base").material(ddd.mats.stone)
    base = base.extrude(height)

    obj = obj.translate([0, 0, height])
    obj.append(base)

    return obj
Example #9
0
def create_base(root, obj):
    year = int(obj.extra['element:year']) if obj.extra['element:year'] else -10000
    age = 2021 - year
    height = 1 + (math.log(age, 2) - 1) * 0.4 + 0.02
    obj.set('baseheight', height)
    disc = ddd.disc(r=1.5, name="Base").material(ddd.mats.marble_white)
    base = disc.extrude_step(disc, 0.5)
    base = base.extrude_step(disc.buffer(-0.2), 0.0)
    base = base.extrude_step(disc.buffer(-0.2), height - 0.5 - 0.2)
    base = base.extrude_step(disc.buffer(0.2), 0.0)
    base = base.extrude_step(disc.buffer(0.2), 0.2)

    #base = ddd.uv.map_cylindrical(base)
    #base = base.merge_vertices()
    base = base.smooth(angle=math.pi * 0.40)
    base = ddd.uv.map_cylindrical(base, split=False)

    obj = obj.translate([0, 0, height])
    obj.append(base)

    return obj
Example #10
0
# Jose Juan Montes 2019-2021
"""
Tests several 2D and 3D geometry operations.
"""

from ddd.pack.sketchy import urban, landscape
from ddd.ddd import ddd
import math
import sys
from ddd.text import fonts

items = ddd.group3()

# Extrusion with optional caps
fig = ddd.disc().extrude(5)
items.append(fig)
fig = ddd.disc().extrude(5, base=False)
items.append(fig)
fig = ddd.disc().extrude(5, cap=False)
items.append(fig)
fig = ddd.disc().extrude(5, cap=False, base=False)
items.append(fig)

# Extrude line (to faces, not volume)
fig1 = ddd.line([[-2, 0], [0, 0], [2, 2]])
fig = fig1.extrude(2.0)
items.append(fig)

# Extrusion to line (explicit)
fig1 = ddd.rect([-4, -2, 4, 2])
fig2 = ddd.line([[-4, 0], [4, 0]])
Example #11
0
def pipeline_start(pipeline, root):
    """
    Generate different geometric objects.
    """

    items = ddd.group3()

    # Remember to use JOIN_ROUND so resolution is applied when buffering points
    fig = ddd.point([0, 0]).buffer(1.0, resolution=2, join_style=ddd.JOIN_ROUND, cap_style=ddd.CAP_ROUND).triangulate()
    items.append(fig)
    fig = ddd.point([0, 0]).buffer(1.0, resolution=3, join_style=ddd.JOIN_ROUND, cap_style=ddd.CAP_ROUND).triangulate()
    items.append(fig)
    fig = ddd.point([0, 0]).buffer(1.0, resolution=4, join_style=ddd.JOIN_ROUND, cap_style=ddd.CAP_ROUND).triangulate()
    items.append(fig)

    # Extrusion with optional caps
    fig = ddd.disc().extrude(5)
    items.append(fig)
    fig = ddd.disc().extrude(5, base=False)
    items.append(fig)
    fig = ddd.disc().extrude(5, cap=False)
    items.append(fig)
    fig = ddd.disc().extrude(5, cap=False, base=False)
    items.append(fig)


    # Extrude line (to faces, not volume)
    fig1 = ddd.line([[-2, 0], [0, 0], [2, 2]])
    fig = fig1.extrude(2.0).twosided()
    items.append(fig)

    # Extrusion to line (explicit)
    fig1 = ddd.rect([-4, -2, 4, 2])
    fig2 = ddd.line([[-4, 0], [4, 0]])
    fig = fig1.extrude_step(fig2, 1.0)
    items.append(fig)

    # Extrusion to line (explicit)
    fig1 = ddd.rect([-4, -2, 4, 2])
    fig2 = ddd.line([[-3, 0], [3, 0]])
    fig = fig1.extrude_step(fig2, 1.0)
    items.append(fig)

    # Extrusion to line (explicit, method subtract)
    fig1 = ddd.rect([-4, -2, 4, 2])
    fig2 = ddd.line([[-3, 0], [3, 0]])
    fig = fig1.extrude_step(fig2, 1.0, method=ddd.EXTRUSION_METHOD_SUBTRACT)  # TODO: this currently fails but should be fixed
    items.append(fig)

    # Extrusion to line with vertical (explicit) for skillion roofs
    fig1 = ddd.rect([-4, -2, 4, 2])
    fig2 = ddd.line([[-4, 2], [4, 2]])
    fig = fig1.extrude_step(fig2, 1.0)  # TODO: this currently fails but should be fixed
    items.append(fig)

    # Extrusion to line (axis middle)
    fig1 = ddd.rect([-4, -2, 4, 2]) #.rotate(math.pi * 1.5)
    axis_major, axis_minor, axis_angle = ddd.geomops.oriented_axis(fig1)
    fig = fig1.extrude_step(axis_minor, 1.0)
    items.append(fig)

    # Extrusion to line (axis middle)
    fig1 = ddd.rect([-4, -2, 4, 2]) #.rotate(math.pi * 1.5)
    axis_major, axis_minor, axis_angle = ddd.geomops.oriented_axis(fig1)
    fig = fig1.extrude_step(axis_major, 1.0)
    items.append(fig)

    # Extrusion to line (buffered geometry) - currently fails (shapely does not return the reduced polygon linestring)
    fig1 = ddd.rect([-4, -2, 4, 2])
    fig = fig1.extrude_step(fig1.buffer(-2.5), 1.0)
    items.append(fig)

    # Extrusion to line (buffered geometry) and back (fails, extrusion from point to shape)
    fig1 = ddd.rect([-4, -2, 4, 2])
    fig = fig1.extrude_step(fig1.buffer(-2.5), 1.0)
    fig = fig.extrude_step(fig1, 1.0)
    items.append(fig)

    # Triangulation with hole
    fig1 = ddd.rect([-4, -2, 4, 2])
    fig2 = ddd.rect([-3, -1, -1, 1])
    fig = fig1.subtract(fig2).triangulate()
    items.append(fig)

    # Extrusion with hole
    fig1 = ddd.rect([-4, -2, 4, 2])
    fig2 = ddd.rect([-3, -1, -1, 1])
    fig = fig1.subtract(fig2).extrude(1.0)
    items.append(fig)

    # Extrusion with steps with hole
    fig1 = ddd.rect([-4, -2, 4, 2])
    fig2 = ddd.rect([-3, -1, -1, 1])
    figh = fig1.subtract(fig2)
    fig = figh.extrude_step(figh, 1.0, base=False)
    fig = fig.extrude_step(figh.buffer(-0.25), 1.0)
    items.append(fig)

    # Extrusion with steps with hole 2
    fig1 = ddd.rect([-4, -2, 4, 2])
    fig2 = ddd.rect([-3, -1, -1, 1])
    figh = fig1.subtract(fig2)
    fig = figh.extrude_step(figh, 1.0, base=False, method=ddd.EXTRUSION_METHOD_SUBTRACT)
    fig = fig.extrude_step(figh.buffer(-0.25), 1.0, method=ddd.EXTRUSION_METHOD_SUBTRACT)
    items.append(fig)


    # Simple extrusion
    fig = ddd.point([0, 0]).buffer(1.0, cap_style=ddd.CAP_ROUND).extrude(5.0)
    items.append(fig)

    # Simple extrusion
    fig = ddd.regularpolygon(5).extrude(5.0)
    items.append(fig)


    # Simple extrusion no caps
    fig = ddd.point([0, 0]).buffer(1.0, cap_style=ddd.CAP_ROUND)
    fig = fig.extrude_step(fig, 5.0, base=False, cap=False)
    items.append(fig)

    # Extrusion between shapes
    fig1 = ddd.point([0, 0]).buffer(1.0)
    fig2 = ddd.point([0, 0]).buffer(1.0, cap_style=ddd.CAP_ROUND)
    fig3 = ddd.point([0, 0]).buffer(1.0)
    fig = fig1.extrude_step(fig2, 3.0).extrude_step(fig3, 2.0)
    items.append(fig)

    # Extrusion
    fig = ddd.point([0, 0]).buffer(1.0)
    for i in range(10):
        fign = ddd.point([0, 0]).buffer(1.0).rotate(math.pi / 12 * i)
        fig = fig.extrude_step(fign, 0.5)
    items.append(fig)

    # Pointy end
    fig = ddd.point().buffer(2.0, cap_style=ddd.CAP_ROUND)
    fig = fig.extrude_step(ddd.point(), 5.0)
    items.append(fig)

    # Convex shapes (this fails)
    coords = [[10, 10], [5, 9], [3, 12], [1, 5], [-8, 0], [10, 0]]
    #coords.reverse()
    fig = ddd.polygon(coords).scale(0.25)
    fig = fig.extrude_step(fig.buffer(-0.5), 1)
    items.append(fig)

    # Convex shapes - subtract method (works)
    coords = [[10, 10], [5, 9], [3, 12], [1, 5], [-8, 0], [10, 0]]
    #coords.reverse()
    fig = ddd.polygon(coords).scale(0.25)
    fig = fig.extrude_step(fig.buffer(-0.5), 1, method=ddd.EXTRUSION_METHOD_SUBTRACT)
    items.append(fig)

    # Extrude-subtract to bigger
    fig = ddd.point([0, 0]).buffer(1.0, cap_style=ddd.CAP_ROUND)
    fig = fig.extrude_step(fig.buffer(1.0), 5.0, method=ddd.EXTRUSION_METHOD_SUBTRACT)
    items.append(fig)

    # Extrude-subtract downwards
    shape = ddd.disc().scale([3, 2])
    fig = shape.extrude_step(shape.buffer(-0.5), -1.0, base=False, method=ddd.EXTRUSION_METHOD_SUBTRACT)
    fig = fig.extrude_step(shape.buffer(-1.0), -0.5, method=ddd.EXTRUSION_METHOD_SUBTRACT)
    items.append(fig)

    # Extrude-subtract vertical case
    fig = ddd.point([0, 0]).buffer(1.0, cap_style=ddd.CAP_ROUND)
    fig = fig.extrude_step(fig, 5.0, method=ddd.EXTRUSION_METHOD_SUBTRACT)
    items.append(fig)

    # Convex shapes with holes - subtract method
    fig = ddd.group3()
    text = Text3D.quick_text("86A").scale(2.0)
    for f in text.children:
        #f.replace(f.subtract(f.buffer(-0.2)))
        fe = f.extrude_step(f.buffer(-0.05), 0.2, method=ddd.EXTRUSION_METHOD_SUBTRACT)
        fig.append(fe)
    items.append(fig)

    # Extrude to point
    fig = ddd.point([0, 0]).buffer(1.0, cap_style=ddd.CAP_ROUND)
    fig = fig.extrude_step(fig.centroid(), 2.0)
    items.append(fig)
    """
    fig = ddd.point([0, 0]).buffer(1.0, cap_style=ddd.CAP_ROUND)
    fig = fig.extrude_step(fig.centroid(), 2.0, method=ddd.EXTRUSION_METHOD_SUBTRACT)
    items.append(fig)
    """

    # Extrude to empty
    fig = ddd.point([0, 0]).buffer(1.0, cap_style=ddd.CAP_ROUND)
    fig = fig.extrude_step(fig.buffer(-2.0), 2.0)
    items.append(fig)
    fig = ddd.point([0, 0]).buffer(1.0, cap_style=ddd.CAP_ROUND)
    fig = fig.extrude_step(fig.buffer(-2.0), 2.0, base=False, method=ddd.EXTRUSION_METHOD_SUBTRACT)
    items.append(fig)


    # Extrude with division
    fig1 = ddd.disc().translate([1.5, 0]).union(ddd.disc())
    fig = fig1.extrude_step(fig1.buffer(-0.2), 0.5, method=ddd.EXTRUSION_METHOD_SUBTRACT)
    fig = fig.extrude_step(fig1.buffer(-0.5), 0.5, method=ddd.EXTRUSION_METHOD_SUBTRACT)
    items.append(fig)


    # Extrude multiple with empty geometry
    fig1 = ddd.point([0, 0]).buffer(2.0, cap_style=ddd.CAP_ROUND)
    fig = fig1.extrude_step(fig1.buffer(-0.5), 0.5, method=ddd.EXTRUSION_METHOD_SUBTRACT)
    fig = fig.extrude_step(fig1.buffer(-1.5), 0.5, method=ddd.EXTRUSION_METHOD_SUBTRACT)
    fig = fig.extrude_step(fig1.buffer(-2.5), 0.5, method=ddd.EXTRUSION_METHOD_SUBTRACT)
    fig = fig.extrude_step(fig1.buffer(-2.5), 0.5, method=ddd.EXTRUSION_METHOD_SUBTRACT)
    items.append(fig)

    # Triangulate/Extrude with colinear segments
    fig1 = ddd.polygon([[0, 0], [1, 0], [2, 0], [2, 1], [1, 1], [0, 1]])
    #fig = fig1.triangulate()
    fig = fig1.extrude(1.0)
    items.append(fig)


    # All items
    items = ddd.align.grid(items, space=10.0)
    #items.append(ddd.helper.all())
    items.show()

    root.append(items)
Example #12
0
def football_field_lines(length=105.0, width=67.5, line_width=0.10):
    """
    Playground fields are seen x: length, y: width
    """

    item = ddd.group3(name="Football lines")

    rectangle = ddd.rect([-length / 2, -width / 2, length / 2, width / 2])

    coords = rectangle.geom.exterior.coords
    width_seg = ddd.line([coords[0], coords[1]])
    length_seg = ddd.line([coords[1], coords[2]])
    width2_seg = ddd.line([coords[2], coords[3]])
    length2_seg = ddd.line([coords[3], coords[0]])
    width_l = width_seg.geom.length
    length_l = length_seg.geom.length

    exterior = rectangle.outline().buffer(
        line_width,
        cap_style=ddd.CAP_SQUARE).triangulate().material(ddd.mats.painted_line)
    exterior.name = "Bounds line"
    exterior.extra['ddd:collider'] = False
    exterior.extra['ddd:shadows'] = False

    midline_2d = ddd.line(
        [length_seg.geom.centroid, length2_seg.geom.centroid], name="Mid line")
    midline = midline_2d.buffer(
        line_width,
        cap_style=ddd.CAP_SQUARE).triangulate().material(ddd.mats.painted_line)
    midline.extra['ddd:collider'] = False
    midline.extra['ddd:shadows'] = False

    midcircle_radius_ratio = 9.15 / 67.5
    midcircle = ddd.disc(center=midline_2d.geom.centroid.coords,
                         r=width_l * midcircle_radius_ratio).outline()
    midcircle = midcircle.buffer(
        line_width,
        cap_style=ddd.CAP_SQUARE).triangulate().material(ddd.mats.painted_line)
    midcircle.extra['ddd:collider'] = False
    midcircle.extra['ddd:shadows'] = False

    item.append(exterior)
    item.append(midline)
    item.append(midcircle)

    centralline_2d = ddd.line(
        [width_seg.geom.centroid, width2_seg.geom.centroid],
        name="Central line")
    goal_width = 7.2

    smallarea_width_ratio = (goal_width + 5.5 * 2) / 67.5
    smallarea_length_ratio = 5.5 / 67.5
    largearea_width_ratio = 40.3 / 67.5
    largearea_length_ratio = 16.5 / 105.5

    for side in (-1, 1):
        smallarea = ddd.line([[0, -1], [1, -1], [1, 1], [0, 1]])
        smallarea = smallarea.scale([
            smallarea_length_ratio * length,
            smallarea_width_ratio * width * 0.5
        ])
        if side == 1: smallarea = smallarea.rotate(math.pi)
        smallarea = smallarea.translate([side * length_l / 2, 0])
        smallarea = smallarea.buffer(
            line_width, cap_style=ddd.CAP_SQUARE).triangulate().material(
                ddd.mats.painted_line)
        smallarea.extra['ddd:collider'] = False
        smallarea.extra['ddd:shadows'] = False
        item.append(smallarea)

        largearea = ddd.line([[0, -1], [1, -1], [1, 1], [0, 1]])
        largearea = largearea.scale([
            largearea_length_ratio * length,
            largearea_width_ratio * width * 0.5
        ])
        if side == 1: largearea = largearea.rotate(math.pi)
        largearea = largearea.translate([side * length_l / 2, 0])
        largearea = largearea.buffer(
            line_width, cap_style=ddd.CAP_SQUARE).triangulate().material(
                ddd.mats.painted_line)
        largearea.extra['ddd:collider'] = False
        largearea.extra['ddd:shadows'] = False
        item.append(largearea)

        # TODO: shall depend on the soccer type, assign earlier maybe
        if width > 30: goal = football_goal11()
        elif width > 15: goal = football_goal9()
        elif width > 9: goal = football_goal7()
        else: goal = football_goal_small()

        goal = goal.rotate(ddd.ROT_TOP_CCW)
        if side == 1: goal = goal.rotate(ddd.ROT_TOP_HALFTURN)
        goal = goal.translate([side * length_l / 2, 0, 0])
        item.append(goal)

    item = ddd.uv.map_cubic(item)

    return item
Example #13
0
def basketball_field_lines(length=28, width=15, line_width=0.075):
    """
    Note that an additional 2m around the field shall be granted.

    Playground fields are seen x: length, y: width
    """

    item = ddd.group3(name="Basketball lines")

    length = min(length, 28)
    width = min(width, 15)
    (length, width) = enforce_aspect_ratio(length, width, 28 / 15)

    rectangle = ddd.rect([-length / 2, -width / 2, length / 2, width / 2])
    coords = rectangle.geom.exterior.coords
    width_seg = ddd.line([coords[0], coords[1]])
    length_seg = ddd.line([coords[1], coords[2]])
    width2_seg = ddd.line([coords[2], coords[3]])
    length2_seg = ddd.line([coords[3], coords[0]])
    width_l = width_seg.geom.length
    length_l = length_seg.geom.length

    exterior = rectangle.outline().buffer(
        line_width,
        cap_style=ddd.CAP_SQUARE).triangulate().material(ddd.mats.painted_line)
    exterior.name = "Bounds line"
    exterior.extra['ddd:collider'] = False
    exterior.extra['ddd:shadows'] = False

    midline_2d = ddd.line(
        [length_seg.geom.centroid, length2_seg.geom.centroid], name="Mid line")
    midline = midline_2d.buffer(
        line_width,
        cap_style=ddd.CAP_SQUARE).triangulate().material(ddd.mats.painted_line)
    midline.extra['ddd:collider'] = False
    midline.extra['ddd:shadows'] = False

    midcircle_radius_ratio = (3.60 / 2) / 15
    midcircle = ddd.disc(center=midline_2d.geom.centroid.coords,
                         r=width_l * midcircle_radius_ratio).outline()
    midcircle = midcircle.buffer(
        line_width,
        cap_style=ddd.CAP_SQUARE).triangulate().material(ddd.mats.painted_line)
    midcircle.extra['ddd:collider'] = False
    midcircle.extra['ddd:shadows'] = False

    item.append(exterior)
    item.append(midline)
    item.append(midcircle)

    centralline_2d = ddd.line(
        [width_seg.geom.centroid, width2_seg.geom.centroid],
        name="Central line")

    # Sides
    for side in (-1, 1):
        if width > 12.0:
            smallarea = ddd.line([[0, -3], [5.80, -(3 - 1.80)]
                                  ]).arc_to([5.80, 3 - 1.80],
                                            center=[5.80, 0],
                                            ccw=True).line_to([0, 3])
            #smallarea = smallarea.scale([smallarea_length_ratio * length, smallarea_width_ratio * width * 0.5])
            if side == 1: smallarea = smallarea.rotate(math.pi)
            smallarea = smallarea.translate([side * length_l / 2, 0])
            smallarea = smallarea.buffer(
                line_width, cap_style=ddd.CAP_SQUARE).triangulate().material(
                    ddd.mats.painted_line)
            smallarea.extra['ddd:collider'] = False
            smallarea.extra['ddd:shadows'] = False
            item.append(smallarea)

            smallline = ddd.line([[5.80, -(3 - 1.80)], [5.80, 3 - 1.80]])
            if side == 1: smallline = smallline.rotate(math.pi)
            smallline = smallline.translate([side * length_l / 2, 0])
            smallline = smallline.buffer(
                line_width, cap_style=ddd.CAP_SQUARE).triangulate().material(
                    ddd.mats.painted_line)
            smallline.extra['ddd:collider'] = False
            smallline.extra['ddd:shadows'] = False
            item.append(smallline)

        if width > 14.0:
            largearea = ddd.line([[0, -6.75],
                                  [1.575,
                                   -6.75]]).arc_to([1.575, 6.75],
                                                   center=[1.575, 0],
                                                   ccw=True).line_to([0, 6.75])
            if side == 1: largearea = largearea.rotate(math.pi)
            largearea = largearea.translate([side * length_l / 2, 0])
            largearea = largearea.buffer(
                line_width, cap_style=ddd.CAP_SQUARE).triangulate().material(
                    ddd.mats.painted_line)
            largearea.extra['ddd:collider'] = False
            largearea.extra['ddd:shadows'] = False
            item.append(largearea)

        goal = basketball_hoop().rotate(ddd.ROT_TOP_CCW)
        if side == 1: goal = goal.rotate(ddd.ROT_TOP_HALFTURN)
        goal = goal.translate([side * (length_l / 2 - 1.22 - 0.15), 0, 0])
        item.append(goal)

    item = ddd.uv.map_cubic(item)

    #hoop = basketball_hoop(width=width + 0.5, net_height_center=net_height_center, net_height_post=net_height_post)
    #item.append(hoop)

    return item