Files
allwpilib/wpimath/src/main/python/semiwrap/geometry/Translation3d.yml
PJ Reiniger 44b9cc1398 [robotpy] Mirror most other subprojects (#8208)
GitOrigin-RevId: ac60fd3cf4a24023184376687da28373d14b781a

This mirrors the robotpy files for the following projects:
- apriltag
- datalog
- hal
- ntcore
- romiVendordep
- wpilibc
- wpimath
- xrpVendordep

This excludes cscore and the halsim wrappers for at this time.

NOTE: This does not hook these projects up to the build system, just simply mirrors the files. The building will take place in a follow up PR to make it easier to review the changes necessary to build.
2025-10-23 22:28:04 -07:00

84 lines
2.4 KiB
YAML

extra_includes:
- rpy/geometryToString.h
- wpystruct.h
- pybind11/eigen.h
functions:
to_json:
ignore: true
from_json:
ignore: true
classes:
frc::Translation3d:
methods:
Translation3d:
overloads:
'':
units::meter_t, units::meter_t, units::meter_t:
units::meter_t, const Rotation3d&:
const Eigen::Vector3d&:
const Translation2d&:
Distance:
X:
Y:
Z:
ToVector:
Norm:
RotateBy:
ToTranslation2d:
operator+:
operator-:
overloads:
const Translation3d& [const]:
'[const]':
operator*:
operator/:
operator==:
Nearest:
overloads:
std::span<const Translation3d> [const]:
std::initializer_list<Translation3d> [const]:
ignore: true
RotateAround:
inline_code: |
cls_Translation3d
.def_static("fromFeet", [](units::foot_t x, units::foot_t y, units::foot_t z){
return std::make_unique<Translation3d>(x, y, z);
}, py::arg("x"), py::arg("y"), py::arg("z"))
.def_property_readonly("x", &Translation3d::X)
.def_property_readonly("y", &Translation3d::Y)
.def_property_readonly("z", &Translation3d::Z)
.def_property_readonly("x_feet", [](const Translation3d * self) -> units::foot_t {
return self->X();
})
.def_property_readonly("y_feet", [](const Translation3d * self) -> units::foot_t {
return self->Y();
})
.def_property_readonly("z_feet", [](const Translation3d * self) -> units::foot_t {
return self->Z();
})
.def("distanceFeet", [](Translation3d * self, const Translation3d &other) -> units::foot_t {
return self->Distance(other);
})
.def("normFeet", [](const Translation3d * self) -> units::foot_t {
return self->Norm();
})
.def("__abs__", &Translation3d::Norm)
.def("__len__", [](const Translation3d& self) { return 3; })
.def("__getitem__", [](const Translation3d& self, int index) {
switch (index) {
case 0:
return self.X();
case 1:
return self.Y();
case 2:
return self.Z();
default:
throw std::out_of_range("Translation3d index out of range");
}
})
.def("__repr__", py::overload_cast<const Translation3d&>(&rpy::toString));
SetupWPyStruct<frc::Translation3d>(cls_Translation3d);