Volume Cartographer 2.27.0
|
3D affine transform More...
#include <vc/core/types/Transforms.hpp>
Public Types | |
using | Parameters = cv::Matx< double, 4, 4 > |
using | Pointer = std::shared_ptr< AffineTransform > |
![]() | |
using | Pointer = std::shared_ptr< Transform3D > |
using | Identifier = std::string |
Public Member Functions | |
auto | type () const -> std::string_view final |
Return a string representation of the transform type. More... | |
auto | clone () const -> Transform3D::Pointer final |
Clone the transform. More... | |
auto | invertible () const -> bool final |
Return whether the underlying transform is invertible. More... | |
auto | invert () const -> Transform3D::Pointer final |
Return the inverted transform. More... | |
auto | composable () const -> bool final |
Return whether the underlying transform is composable. More... | |
void | reset () final |
Reset the transform parameters. More... | |
auto | applyPoint (const cv::Vec3d &point) const -> cv::Vec3d final |
Transform a 3D point. More... | |
auto | applyVector (const cv::Vec3d &vector) const -> cv::Vec3d final |
Transform a 3D direction vector. More... | |
auto | params () const -> Parameters |
Get the current transform parameters. | |
void | params (const Parameters ¶ms) |
Set the transform parameters. | |
void | translate (double x, double y, double z) |
Add translation. More... | |
template<typename Tp , int Cn> | |
void | translate (const cv::Vec< Tp, Cn > &translation) |
Add translation. More... | |
void | rotate (double angle, double ax, double ay, double az) |
Add rotation in degrees. More... | |
template<typename Tp , int Cn> | |
void | rotate (const double angle, cv::Vec< Tp, Cn > axis) |
Add rotation in degrees. More... | |
void | scale (double sx, double sy, double sz) |
Add anisotropic scale. | |
void | scale (double s) |
Add isotropic scale. | |
![]() | |
virtual | ~Transform3D ()=default |
Transform3D (Transform3D &&)=delete | |
auto | operator= (Transform3D &&other) -> Transform3D &=delete |
virtual auto | type () const -> std::string_view=0 |
Return a string representation of the transform type. More... | |
virtual auto | clone () const -> Pointer=0 |
Clone the transform. More... | |
virtual auto | invertible () const -> bool |
Return whether the underlying transform is invertible. More... | |
virtual auto | invert () const -> Pointer |
Return the inverted transform. More... | |
virtual auto | composable () const -> bool |
Return whether the underlying transform is composable. More... | |
virtual void | reset ()=0 |
Reset the transform parameters. More... | |
void | clear () |
Clears all parameters and properties of the transform. | |
void | source (const std::string &src) |
Set the identifier for the source space. More... | |
auto | source () const -> std::string |
Get the source space identifier. More... | |
void | target (const std::string &tgt) |
Set the identifier for the target space. More... | |
auto | target () const -> std::string |
Set the identifier for the target space. More... | |
virtual auto | applyPoint (const cv::Vec3d &point) const -> cv::Vec3d=0 |
Transform a 3D point. More... | |
virtual auto | applyVector (const cv::Vec3d &vector) const -> cv::Vec3d=0 |
Transform a 3D direction vector. More... | |
auto | applyUnitVector (const cv::Vec3d &vector) const -> cv::Vec3d |
Transform a 3D direction unit vector. More... | |
auto | applyPointAndNormal (const cv::Vec6d &ptN, bool normalize=true) const -> cv::Vec6d |
Transform a 3D point and surface normal stored in a cv::Vec6d. More... | |
Static Public Member Functions | |
static auto | New () -> Pointer |
Create a new AffineTransform. | |
![]() | |
static auto | Compose (const Pointer &lhs, const Pointer &rhs) -> std::pair< Pointer, Pointer > |
Compose two transforms into a single new transform. More... | |
static void | Save (const filesystem::path &path, const Pointer &transform) |
Save a transform to a JSON file. | |
static auto | Load (const filesystem::path &path) -> Pointer |
Load a transform from a JSON file. | |
Static Public Attributes | |
static constexpr std::string_view | TYPE {"AffineTransform"} |
Transform type string constant. More... | |
![]() | |
static constexpr std::string_view | TYPE {"Transform3D"} |
Transform type string constant. More... | |
Private Member Functions | |
AffineTransform ()=default | |
auto | compose_ (const Transform3D::Pointer &rhs) const -> Transform3D::Pointer final |
void | to_meta_ (Metadata &meta) final |
void | from_meta_ (const Metadata &meta) final |
Private Attributes | |
Parameters | params_ {Parameters::eye()} |
Additional Inherited Members | |
![]() | |
using | Metadata = nlohmann::ordered_json |
![]() | |
Transform3D ()=default | |
Transform3D (const Transform3D &)=default | |
auto | operator= (const Transform3D &other) -> Transform3D &=default |
virtual auto | compose_ (const Pointer &rhs) const -> Pointer |
virtual void | to_meta_ (Metadata &meta)=0 |
virtual void | from_meta_ (const Metadata &meta)=0 |
![]() | |
static auto | Serialize (const Pointer &transform) -> Metadata |
static auto | Deserialize (const Metadata &meta) -> Pointer |
3D affine transform
Initializes to an identity. Modify the transform by calling the translate(), rotate(), and scale() functions. Each call precomposes the function's transform with the stored affine transform. For example, the following transform will scale, rotate, and translate the 3D point, in that order:
Definition at line 242 of file Transforms.hpp.
using volcart::AffineTransform::Parameters = cv::Matx<double, 4, 4> |
Parameters type: 4x4 matrix
Definition at line 249 of file Transforms.hpp.
using volcart::AffineTransform::Pointer = std::shared_ptr<AffineTransform> |
Pointer type
Definition at line 252 of file Transforms.hpp.
|
privatedefault |
Don't allow construction on the stack
|
finalvirtual |
Transform a 3D point.
Implements volcart::Transform3D.
|
finalvirtual |
Transform a 3D direction vector.
Implements volcart::Transform3D.
|
finalvirtual |
Clone the transform.
Implements volcart::Transform3D.
|
finalvirtual |
Return whether the underlying transform is composable.
Reimplemented from volcart::Transform3D.
|
finalprivatevirtual |
Helper compose function. The base implementation returns a nullptr. Implementing derived classes should set the returned transform's source to this->source() and the target to rhs->target().
Reimplemented from volcart::Transform3D.
|
finalprivatevirtual |
Deserialize the derived class parameters
Implements volcart::Transform3D.
|
finalvirtual |
Return the inverted transform.
Reimplemented from volcart::Transform3D.
|
finalvirtual |
Return whether the underlying transform is invertible.
Reimplemented from volcart::Transform3D.
|
finalvirtual |
Reset the transform parameters.
Resets all parameters controlled by the derived transform. Does not reset base transform properties like source and target.
Implements volcart::Transform3D.
|
inline |
Add rotation in degrees.
Rotate angle
degrees around the vector [ax, ay, az]
.
Convenience function for cv::Vec
types.
Definition at line 316 of file Transforms.hpp.
void volcart::AffineTransform::rotate | ( | double | angle, |
double | ax, | ||
double | ay, | ||
double | az | ||
) |
Add rotation in degrees.
Rotate angle
degrees around the vector [ax, ay, az]
.
|
finalprivatevirtual |
Serialize the derived class parameters
Implements volcart::Transform3D.
|
inline |
Add translation.
Convenience function for cv::Vec
types.
Definition at line 295 of file Transforms.hpp.
void volcart::AffineTransform::translate | ( | double | x, |
double | y, | ||
double | z | ||
) |
Add translation.
Per-axis translation function.
|
finalvirtual |
Return a string representation of the transform type.
Implements volcart::Transform3D.
|
private |
Current parameters
Definition at line 332 of file Transforms.hpp.
|
staticconstexpr |
Transform type string constant.
Definition at line 246 of file Transforms.hpp.