Interface Mountable

All Known Implementing Classes:
ArmSim, LinearSim, RollerSim

public interface Mountable
Mixin interface for simulation components that can be attached to a Mount. Provides default geometry helpers that compute the component's updated canvas position each simulation period, taking the parent mount's type, current position, and current angle into account.
  • Method Summary

    Modifier and Type
    Method
    Description
    static double
    getAngleOffset(double initialX, double initialY, double mountX, double mountY, double startingAngle)
    Returns the radians a mounted object should be away from a mount based on their initial positions
    static double
    getDistance(double x1, double y1, double x2, double y2)
    Computes the straight-line distance between two points on the canvas.
    default double
    Convenience overload that derives all geometry parameters from an ArmConfig.
    default double
    Convenience overload that derives all geometry parameters from a LinearConfig.
    default double
    getUpdatedX(Mount.MountType mountType, double initialX, double initialY, double initMountX, double initMountY, double initMountAngle, double mountX, double mountY, double displacementX, double displacementY, double mountAngle)
    Computes the updated X position of a mounted component given full explicit geometry parameters.
    default double
    Convenience overload that derives all geometry parameters from a RollerConfig.
    default double
    Convenience overload that derives all geometry parameters from an ArmConfig.
    default double
    Convenience overload that derives all geometry parameters from a LinearConfig.
    default double
    getUpdatedY(Mount.MountType mountType, double initialX, double initialY, double initMountX, double initMountY, double initMountAngle, double mountX, double mountY, double displacementX, double displacementY, double mountAngle)
    Computes the updated Y position of a mounted component given full explicit geometry parameters.
    default double
    Convenience overload that derives all geometry parameters from a RollerConfig.
    static double
    getXWithAngle(double radius, double angle, double displacementX)
    Computes the X coordinate of a point at radius distance from displacementX in the direction of angle.
    static double
    getYWithAngle(double radius, double angle, double displacementY)
    Computes the Y coordinate of a point at radius distance from displacementY in the direction of angle.
  • Method Details

    • getUpdatedX

      default double getUpdatedX(Mount.MountType mountType, double initialX, double initialY, double initMountX, double initMountY, double initMountAngle, double mountX, double mountY, double displacementX, double displacementY, double mountAngle)
      Computes the updated X position of a mounted component given full explicit geometry parameters.
      Parameters:
      mountType - type of the parent mount (ARM or LINEAR)
      initialX - component's initial X position on the canvas (metres)
      initialY - component's initial Y position on the canvas (metres)
      initMountX - mount's X position at simulation start (metres)
      initMountY - mount's Y position at simulation start (metres)
      initMountAngle - mount's angle at simulation start (radians)
      mountX - mount's current X position (metres)
      mountY - mount's current Y position (metres)
      displacementX - mount's current horizontal displacement from its initial position (metres)
      displacementY - mount's current vertical displacement from its initial position (metres)
      mountAngle - mount's current angle (radians)
      Returns:
      updated X position of the component on the canvas (metres)
    • getUpdatedY

      default double getUpdatedY(Mount.MountType mountType, double initialX, double initialY, double initMountX, double initMountY, double initMountAngle, double mountX, double mountY, double displacementX, double displacementY, double mountAngle)
      Computes the updated Y position of a mounted component given full explicit geometry parameters.
      Parameters:
      mountType - type of the parent mount (ARM or LINEAR)
      initialX - component's initial X position on the canvas (metres)
      initialY - component's initial Y position on the canvas (metres)
      initMountX - mount's X position at simulation start (metres)
      initMountY - mount's Y position at simulation start (metres)
      initMountAngle - mount's angle at simulation start (radians)
      mountX - mount's current X position (metres)
      mountY - mount's current Y position (metres)
      displacementX - mount's current horizontal displacement from its initial position (metres)
      displacementY - mount's current vertical displacement from its initial position (metres)
      mountAngle - mount's current angle (radians)
      Returns:
      updated Y position of the component on the canvas (metres)
    • getUpdatedX

      default double getUpdatedX(RollerConfig config)
      Convenience overload that derives all geometry parameters from a RollerConfig.
      Parameters:
      config - the roller configuration carrying mount and initial-position data
      Returns:
      updated X position on the canvas (metres)
    • getUpdatedX

      default double getUpdatedX(ArmConfig config)
      Convenience overload that derives all geometry parameters from an ArmConfig.
      Parameters:
      config - the arm configuration carrying mount and initial-position data
      Returns:
      updated X position on the canvas (metres)
    • getUpdatedX

      default double getUpdatedX(LinearConfig config)
      Convenience overload that derives all geometry parameters from a LinearConfig.
      Parameters:
      config - the linear stage configuration carrying mount and initial-position data
      Returns:
      updated X position on the canvas (metres)
    • getUpdatedY

      default double getUpdatedY(RollerConfig config)
      Convenience overload that derives all geometry parameters from a RollerConfig.
      Parameters:
      config - the roller configuration carrying mount and initial-position data
      Returns:
      updated Y position on the canvas (metres)
    • getUpdatedY

      default double getUpdatedY(ArmConfig config)
      Convenience overload that derives all geometry parameters from an ArmConfig.
      Parameters:
      config - the arm configuration carrying mount and initial-position data
      Returns:
      updated Y position on the canvas (metres)
    • getUpdatedY

      default double getUpdatedY(LinearConfig config)
      Convenience overload that derives all geometry parameters from a LinearConfig.
      Parameters:
      config - the linear stage configuration carrying mount and initial-position data
      Returns:
      updated Y position on the canvas (metres)
    • getAngleOffset

      static double getAngleOffset(double initialX, double initialY, double mountX, double mountY, double startingAngle)
      Returns the radians a mounted object should be away from a mount based on their initial positions
    • getDistance

      static double getDistance(double x1, double y1, double x2, double y2)
      Computes the straight-line distance between two points on the canvas.
      Parameters:
      x1 - X coordinate of the first point (metres)
      y1 - Y coordinate of the first point (metres)
      x2 - X coordinate of the second point (metres)
      y2 - Y coordinate of the second point (metres)
      Returns:
      Euclidean distance in metres
    • getXWithAngle

      static double getXWithAngle(double radius, double angle, double displacementX)
      Computes the X coordinate of a point at radius distance from displacementX in the direction of angle.
      Parameters:
      radius - distance from the reference point (metres)
      angle - direction angle in radians
      displacementX - reference X coordinate (metres)
      Returns:
      resulting X coordinate (metres)
    • getYWithAngle

      static double getYWithAngle(double radius, double angle, double displacementY)
      Computes the Y coordinate of a point at radius distance from displacementY in the direction of angle.
      Parameters:
      radius - distance from the reference point (metres)
      angle - direction angle in radians
      displacementY - reference Y coordinate (metres)
      Returns:
      resulting Y coordinate (metres)