Translation1d Class Documentation
Overview
The Translation1d class represents a one-dimensional translation, allowing for the manipulation of a scalar magnitude along a single dimension. This class provides methods for arithmetic operations, unit conversions, and utility functions to work with the magnitude in various units.
Importing the Class
To use the Translation1d class, you need to import the required module from the VEXLib library:
Key Functionalities
Initialization
While you can initialize a Translation1d object directly with a magnitude in meters, it is best practice to be explicit and use the provided class methods such as from_meters, from_centimeters, from_inches, and from_feet to reduce errors in units:
Arithmetic Operations
The class supports addition, subtraction, multiplication, and division:
Unit Conversions
You can convert the magnitude to various units:
Utility Methods
Inverse
Calculate the unary inverse of a Translation1d object:
Usage Examples
Creating a Translation1d Object
Best practice for creating a Translation1d object:
Adding Two Translation1d Objects
Converting Units
This documentation covers the essential parts of the Translation1d class and highlights best practices to avoid errors when dealing with unit conversions.