# struct utils::SpaceDefinition

## Overview

Definition of an arbitrary space. More…

    #include <SpaceAndUnits.h>

    struct SpaceDefinition: public utils::BasisDefinition {
        // fields

        SpaceCategory category { SpaceCategory::custom };
        Units units { Units::mm };

        // construction

        SpaceDefinition();
        SpaceDefinition(Units t_units, BaseAxis t_up, BaseAxis t_forward, Handedness t_handedness);

        // methods

        glm::mat3 MakeTransform3To(const SpaceDefinition& target_space) const;
        glm::mat4 MakeTransform4To(const SpaceDefinition& target_space) const;
        glm::mat4 Convert(const glm::mat4& other_transform, const SpaceDefinition& other_space) const;
        bool operator==(SpaceDefinition const& b) const;
        bool operator!=(SpaceDefinition const& b) const;
        virtual void Serialize(nlohmann::json& json) const;
        virtual void Serialize(std::ostream& outs) const;
        virtual bool Deserialize(std::istream& ins);
        glm::mat4 Convert();
    };

### Inherited Members

    public:
        // fields

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

        // 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 space.

### Methods

    glm::mat3 MakeTransform3To(const SpaceDefinition& target_space) const

Creates transformation matrix that defines transition from this space to the target_space.

    glm::mat4 MakeTransform4To(const SpaceDefinition& target_space) const

Creates transformation matrix that defines transition from this space to the target_space.

    glm::mat4 Convert(const glm::mat4& other_transform, const SpaceDefinition& other_space) const

Creates transformation matrix for this space, from transformation created for other space.

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

Converts this to nlohmann::json structure.

    glm::mat4 Convert()

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