Class Mechanism2d

    • Constructor Detail

      • Mechanism2d

        public Mechanism2d​(double width,
                           double height)
        Create a new Mechanism2d with the given dimensions and default color (dark blue).

        The dimensions represent the canvas that all the nodes are drawn on.

        Parameters:
        width - the width
        height - the height
      • Mechanism2d

        public Mechanism2d​(double width,
                           double height,
                           Color8Bit backgroundColor)
        Create a new Mechanism2d with the given dimensions.

        The dimensions represent the canvas that all the nodes are drawn on.

        Parameters:
        width - the width
        height - the height
        backgroundColor - the background color. Defaults to dark blue.
    • Method Detail

      • getRoot

        public MechanismRoot2d getRoot​(String name,
                                       double x,
                                       double y)
        Get or create a root in this Mechanism2d with the given name and position.

        If a root with the given name already exists, the given x and y coordinates are not used.

        Parameters:
        name - the root name
        x - the root x coordinate
        y - the root y coordinate
        Returns:
        a new root joint object, or the existing one with the given name.
      • setBackgroundColor

        public void setBackgroundColor​(Color8Bit color)
        Set the Mechanism2d background color.
        Parameters:
        color - the new color