====================== Rigid body graphics ====================== Fill color =========== Fill color is specified as (red, green, blue, alpha) tuple. Red, green, blue, and alpha are specified as integers between 0 and 255. Without the alpha channel 16,777,216 (256 * 256 * 256) different colors can be defined. With the alpha channel the total number of possible colors become 4,294,967,296 (256 * 256 * 256 * 256). .. code-block:: python >>> circle1.fillColor = (255, 0, 0, 150) >>> polygon2.fillColor = color.navyblue Transparency ------------ When transparency is toggled off, the alpha value in the color definition becomes ineffective. Transparency can be toggled on or off from the menus or from the Python interpreter. Currently, running the models with the transparency option on is significantly slower than running the same model with no transparency due to the limitations of the underlying graphics libraries. Fill style ========== Mekanimo uses the fill styles provided by the `wx` library as listed below. * TRANSPARENT Transparent (no fill). * SOLID Solid. * STIPPLE Uses a bitmap as a stipple. * BDIAGONAL_HATCH Backward diagonal hatch. * CROSSDIAG_HATCH Cross-diagonal hatch. * FDIAGONAL_HATCH Forward diagonal hatch. * CROSS_HATCH Cross hatch. * HORIZONTAL_HATCH Horizontal hatch. * VERTICAL_HATCH Vertical hatch. .. figure:: fillstyles.png :alt: fillstyles Figure 1: Fill styles .. code-block:: python >>> circle1.fillStyle = wx.CROSS_HATCH >>> polygon2.fillColor = color.navyblue Line color ============ Line color is specified as (red, green, blue, alpha) tuple. Red, green, blue, and alpha are specified as integers between 0 and 255. Without the alpha channel 16,777,216 (256 * 256 * 256) different colors can be defined. With the alpha channel the total number of possible colors become 4,294,967,296 (256 * 256 * 256 * 256). .. code-block:: python >>> circle1.lineColor = (255, 0, 0, 150) >>> polygon2.lineColor = color.navyblue Transparency ------------ When transparency is toggled off, the alpha value in the color definition becomes ineffective. Transparency can be toggled on or off from the menus or from the Python interpreter. Currently, running the models with the transparency option on is significantly slower than running the same model with no transparency due to the limitations of the underlying graphics libraries. Line style =========== Mekanimo uses the line styles provided by the wx library as listed below. * SOLID * TRANSPARENT * DOT * LONG_DASH * SHORT_DASH * STIPPLE * USER_DASH * BDIAGONAL_HATCH * CROSSDIAG_HATCH * FDIAGONAL_HATCH * CROSS_HATCH * HORIZONTAL_HATCH * VERTICAL_HATCH .. figure:: linestyles.png :alt: linestyles Figure 2: Line styles Line weight ============ Specifies the width of the border line. If set to zero then no line is drawn. .. figure:: lineweights.png :alt: lineweights Figure 3: Line weights Label ====== :term:`Rigid bodies ` can display user specified labels. .. code-block:: python >>> circle1.label = 'Target' .. figure:: label.png :alt: label Figure 4: Label Labels can be hidden by setting the `showLabel` attribute to `False`. .. code-block:: python >>> circle1.showLabel = False Font size --------- Font family ------------ * DEFAULT * SWISS * ROMAN * SCRIPT * MODERN * DECORATIVE .. code-block:: python >>> circle1.labelFontFamily = SWISS Font style ------------ * NORMAL * SLANT * ITALIC .. code-block:: python >>> circle1.labelFontStyle = ITALIC Font weight ------------ * NORMAL * LIGHT * BOLD .. code-block:: python >>> circle1.labelFontWeight = BOLD Offset ------- Label offset is specified for x and y direction in pixels. Positive Y direction is downwards. .. code-block:: python >>> circle1.labelOffsetX = 20 >>> circle1.labelOffsetY = -20 .. figure:: labeloffset.png :alt: labeloffset Figure 5: Label offset (x = 20 pixels, y = -20 pixels) Tag ===== Tags are element names and they are hidden by default. .. code-block:: python >>> circle1.showTag = True .. figure:: tag.png :alt: tag Figure 5: Tag