Package frc.spectrumLib.sim
Interface Mountable
public interface Mountable
Mixin interface for a simulated component that attaches to a
Mount. The default helpers
place the component on the canvas from the parent mount's type, position, and angle.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceThe mount and starting geometry a mounted sim config carries. -
Method Summary
Modifier and TypeMethodDescriptionstatic doublegetAngleOffset(double initialX, double initialY, double mountX, double mountY, double startingAngle) Angle of a component's initial position relative to its mount, measured off the mount's starting angle.static doublegetDistance(double x1, double y1, double x2, double y2) Straight-line distance between two canvas points, in metres.default doublegetUpdatedX(Mount.MountType mountType, double initialX, double initialY, double initMountX, double initMountY, double initMountAngle, double mountX, double mountY, double displacementX, double displacementY, double mountAngle) Full-geometry placement.default doublegetUpdatedX(Mountable.MountedConfig config) Placement using the geometry a mounted sim config carries.default doublegetUpdatedY(Mount.MountType mountType, double initialX, double initialY, double initMountX, double initMountY, double initMountAngle, double mountX, double mountY, double displacementX, double displacementY, double mountAngle) Full-geometry placement.default doublegetUpdatedY(Mountable.MountedConfig config) Placement using the geometry a mounted sim config carries.static doublegetXWithAngle(double radius, double angle, double displacementX) CartesianXof a pointradiusfrom the reference point,angleradians off the Y axis.static doublegetYWithAngle(double radius, double angle, double displacementY) CartesianYof a pointradiusfrom the reference point,angleradians off the X axis.
-
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) Full-geometry placement. TheMountable.MountedConfigoverloads pass a config's values straight through to this. All lengths are in metres and angles in radians.- Returns:
- updated X position of the component on the canvas
-
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) Full-geometry placement. TheMountable.MountedConfigoverloads pass a config's values straight through to this. All lengths are in metres and angles in radians.- Returns:
- updated Y position of the component on the canvas
-
getUpdatedX
Placement using the geometry a mounted sim config carries.- Returns:
- updated X position on the canvas, in metres
-
getUpdatedY
Placement using the geometry a mounted sim config carries.- Returns:
- updated Y position on the canvas, in metres
-
getAngleOffset
static double getAngleOffset(double initialX, double initialY, double mountX, double mountY, double startingAngle) Angle of a component's initial position relative to its mount, measured off the mount's starting angle. A component left of the mount takes the mirrored branch. -
getDistance
static double getDistance(double x1, double y1, double x2, double y2) Straight-line distance between two canvas points, in metres. -
getXWithAngle
static double getXWithAngle(double radius, double angle, double displacementX) CartesianXof a pointradiusfrom the reference point,angleradians off the Y axis. Lengths are in metres. -
getYWithAngle
static double getYWithAngle(double radius, double angle, double displacementY) CartesianYof a pointradiusfrom the reference point,angleradians off the X axis. Lengths are in metres.
-