Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add affine transformation constructors and getters to geometry API #7429

Open
16 tasks
calcmogul opened this issue Nov 23, 2024 · 0 comments
Open
16 tasks

Add affine transformation constructors and getters to geometry API #7429

calcmogul opened this issue Nov 23, 2024 · 0 comments
Assignees
Labels
component: wpimath Math library type: feature Brand new functionality, features, pages, workflows, endpoints, etc.

Comments

@calcmogul
Copy link
Member

Translation2d

  • constexpr Translation2d(const Eigen::Vector2d& vec)
    • Constructs a Translation2d from a 2D translation vector.
  • constexpr Eigen::Vector2d ToVector() const
    • Returns a 2D translation vector.

Rotation2d

  • constexpr Rotation2d(const Eigen::Matrix2d& mat)
    • Constructs a Rotation2d from a 2D rotation matrix.
  • constexpr Eigen::Matrix2d ToMatrix() const
    • Returns a 2D rotation matrix.

Pose2d

  • constexpr Pose2d(const Eigen::Matrix3d& mat)
    • Constructs a Pose2d from a 2D affine transformation matrix.
    • Delegate to Translation2d and Rotation2d constructors with top-right 2x1 block and top-left 2x2 block respectively.
    • Throw if bottom-left 1x2 isn't zeroes or bottom-right 1x1 isn't a one.
  • constexpr Eigen::Matrix3d ToMatrix() const
    • Returns a 2D affine transformation matrix.
    • Rotation matrix in top-left 2x2, translation vector 2x1 in top-right, 0₁ₓ₂ in bottom-left, 1 in bottom-right.

Transform2d

  • constexpr Transform2d(const Eigen::Matrix3d& mat)
    • Constructs a Transform2d from a 2D affine transformation matrix.
    • Delegate to Translation2d and Rotation2d constructors with top-right 2x1 block and top-left 2x2 block respectively.
    • Throw if bottom-left 1x2 isn't zeroes or bottom-right 1x1 isn't a one.
  • constexpr Eigen::Matrix3d ToMatrix() const
    • Returns a 2D affine transformation matrix.
    • Rotation matrix in top-left 2x2, translation vector 2x1 in top-right, 0₁ₓ₂ in bottom-left, 1 in bottom-right.

Translation3d

  • constexpr Translation3d(const Eigen::Vector3d& vec)
    • Constructs a Translation3d from a 3D translation vector.
  • constexpr Eigen::Vector3d ToVector() const
    • Returns a 3D translation vector.

Rotation3d

  • constexpr Rotation3d(const Eigen::Matrix3d& mat)
    • Constructs a Rotation3d from a 3D rotation matrix.
  • constexpr Eigen::Matrix3d ToMatrix() const
    • Returns a 3D rotation matrix.

Pose3d

  • constexpr Pose3d(const Eigen::Matrix4d& mat)
    • Constructs a Pose3d from a 3D affine transformation matrix.
    • Delegate to Translation3d and Rotation3d constructors with top-right 3x1 block and top-left 3x3 block respectively.
    • Throw if bottom-left 1x3 isn't zeroes or bottom-right 1x1 isn't a one.
  • constexpr Eigen::Matrix3d ToMatrix() const
    • Returns a 3D affine transformation matrix.
    • Rotation matrix in top-left 3x3, translation vector in top-right, 0₁ₓ₃ in bottom-left, 1 in bottom-right.

Transform3d

  • constexpr Transform3d(const Eigen::Matrix4d& mat)
    • Constructs a Transform3d from a 3D affine transformation matrix.
    • Delegate to Translation3d and Rotation3d constructors with top-right 3x1 block and top-left 3x3 block respectively.
    • Throw if bottom-left 1x3 isn't zeroes or bottom-right 1x1 isn't a one.
  • constexpr Eigen::Matrix3d ToMatrix() const
    • Returns a 3D affine transformation matrix.
    • Rotation matrix in top-left 3x3, translation vector in top-right, 0₁ₓ₃ in bottom-left, 1 in bottom-right.

Other notes

These will replace the PoseToVector() functions in StateSpaceUtil. Some of them may exist in the geometry classes already, but the docs should be updated to use terminology from affine transformations.

@calcmogul calcmogul added component: wpimath Math library type: feature Brand new functionality, features, pages, workflows, endpoints, etc. labels Nov 23, 2024
@calcmogul calcmogul self-assigned this Nov 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: wpimath Math library type: feature Brand new functionality, features, pages, workflows, endpoints, etc.
Projects
None yet
Development

No branches or pull requests

1 participant