Describe the Hull

Syntax: <hull>
    <point>
        <x>...</x>
        <y>...</y>
    </point>
    ...
</hull>
Default Value: The 4 corners of the image define the hull by default.
Description: The Hull is the convex envelop that contains all the extremity of the part. It is defined by a list of points whose coordinates are in pixel, relative to the top left corner of the part image.

The Hull description is useful for parts that are neither square nor rectangular, such as a rail points or curves. BlueBrick uses the hull for selection picking and to compute the bounding box of the part. The bounding box is the smallest possible rectangular box (aligned on the vertical and horizontal axis) that can contains the whole part. A good hull will increase the usability of your part. The hull definition also has an impact on the amount of memory used by BlueBrick. This is because the hulls shape influences the size of the image needed to draw the part when rotated. Usually a convex hull is good enough, but you may want to define a concave hull to improve the picking selection. Generally speaking, please add as few points to the hull as possible as this influences the performance of the application.

Beware that the hull definition, unlike the previous parameters, is in pixel and not stud coordinates. The reason is that it is much easier to define the hull in pixels by using your image editor and finding the coordinates by moving the mouse over the image.

BlueBrick actually shifts the pixel coordinates that you define in the XML file of 0.5 (half a pixel), in order to set the coordinate at the center of the pixel. However, note that you can use decimal values to define the pixel coordinates in the XML file. It is also allowed to use coordinates which are outside the image (i.e. negative value or value greater than the size of the image).

A wrong hull definition may cause the part to be truncated when it is rotated with a free angle. When you are specifying the hull of your part, a good way to verify it is to draw the Hull by choosing the  View > Hulls > Bricks  menu. Here are two examples: one for the hull definition of the 9V Switch Point Track which is a precise concave hull such as you can click around the yellow lever without selecting it; and one for the 9V Curved Track which is a good enough convex hull.

    

Here is the corresponding XML for the hull of the 9V Curve Track:

<hull>
    <point>
        <x>0</x>
        <y>0</y>
    </point>
    <point>
        <x>74</x>
        <y>5</y>
    </point>
    <point>
        <x>138</x>
        <y>26</y>
    </point>
    <point>
        <x>138</x>
        <y>38</y>
    </point>
    <point>
        <x>121</x>
        <y>77</y>
    </point>
    <point>
        <x>114</x>
        <y>85</y>
    </point>
    <point>
        <x>0</x>
        <y>64</y>
    </point>
</hull>