struct utils::BasisDefinition — HIRO 0.7.0 documentation

# struct utils::BasisDefinition

## Overview

Definition of an arbitrary basis. More…

    #include <SpaceAndUnits.h>

    struct BasisDefinition {
        // fields

        std::string id { "custom" };
        BaseAxis up { BaseAxis::positive_y };
        BaseAxis forward { BaseAxis::positive_z };
        Handedness handedness { Handedness::right };

        // construction

        BasisDefinition();
        BasisDefinition(BaseAxis t_up, BaseAxis t_forward, Handedness t_handedness);

        // methods

        glm::mat3 CreateBasisMat3() const;
        glm::mat4 CreateBasisMat4() const;
        glm::mat3 MakeTransform3To(const BasisDefinition& target_basis) const;
        glm::mat4 MakeTransform4To(const BasisDefinition& target_basis) const;
        glm::mat4 Convert(const glm::mat4& other_transform, const BasisDefinition& other_basis) const;
        bool operator==(BasisDefinition const& b) const;
        bool operator!=(BasisDefinition const& b) const;
        virtual void Serialize(nlohmann::json& json) const;
        std::string ToString() const;
        virtual void Serialize(std::ostream& outs) const;
        virtual bool Deserialize(std::istream& in);
    };

## Detailed Documentation

Definition of an arbitrary basis.

### Methods

    glm::mat3 CreateBasisMat3() const

Creates a basis matrix that defines this space.

    glm::mat4 CreateBasisMat4() const

Creates a basis matrix that defines this space.

    glm::mat3 MakeTransform3To(const BasisDefinition& target_basis) const

Creates transformation matrix that defines transition from this basis to the target_basis.

    glm::mat4 MakeTransform4To(const BasisDefinition& target_basis) const

Creates transformation matrix that defines transition from this basis to the target_basis.

    glm::mat4 Convert(const glm::mat4& other_transform, const BasisDefinition& other_basis) const

Creates transformation matrix for this basis, from transformation in other basis.

    virtual void Serialize(nlohmann::json& json) const

Converts this to nlohmann::json structure.

    std::string ToString() const

Convert this to JSON string.