# namespace cogs

## Overview

Namespace of “Computer Graphic Structures” library, which implement many core classes and structures. More…

    namespace cogs {

    // namespaces

    namespace cogs::color;
    namespace cogs::conversions;
    namespace cogs::io;

    // typedefs

    typedef std::vector<cogs::VertexSkinData> SkinningData;

    // enums

    enum ColorMap;
    enum DataType;
    enum MaterialColors;
    enum MaterialTextures;

    // structs

    struct Color3b;
    struct Color3f;
    struct Color3hex;
    struct Color4b;
    struct Color4f;
    struct Color4hex;
    struct Frustum;
    struct Material;
    struct Mesh;
    struct MeshOperations;
    struct PointCloudProperty;
    struct ScalePreservingTransform;
    struct ScanCameraParams;
    struct SkeletonAction;
    struct SkeletonPose;
    struct VertexSkinData;

    // classes

    class AabbHierarchy;
    class Armature;
    class Bone;
    class BoneTransform;
    class C_PointCloud;
    class C_Scan;
    class CameraParamsSerializable;
    class CameraSpaceSerializable;
    class DynamicScan;
    class Exporter;

    template <typename Type>
    class Grid;

    class Image;
    class Importer;

    template <typename Type>
    class Interpolator;

    class KdTree;
    class MaterialModel;
    class MetaData;
    class MetaDataSerializable;
    class MetaDataSerializer;
    class Octree;
    class PointCloud;
    class PointCloudSelector;
    class ResolutionSerializable;
    class ScalePreservingTransformSerializable;
    class ScalePreservingTransformSerializer;
    class Scan;
    class Skeleton;
    class Table;
    class Transform;
    class TransformationSerializable;
    class Triangulation;

    // global functions

    std::vector<geom::LineSegment3> BonesToLines(const std::vector<cogs::Bone*>& bones);
    COGS_API bool operator==(const Color3b& a, const Color3b& b);
    COGS_API bool operator==(const Color4b& a, const Color4b& b);
    COGS_API bool operator==(const Color3f& a, const Color3f& b);
    COGS_API bool operator==(const Color4f& a, const Color4f& b);
    COGS_API bool operator==(const Color3hex& a, const Color3hex& b);
    COGS_API bool operator==(const Color4hex& a, const Color4hex& b);
    COGS_API bool operator!=(const Color3b& a, const Color3b& b);
    COGS_API bool operator!=(const Color4b& a, const Color4b& b);
    COGS_API bool operator!=(const Color3f& a, const Color3f& b);
    COGS_API bool operator!=(const Color4f& a, const Color4f& b);
    COGS_API bool operator!=(const Color3hex& a, const Color3hex& b);
    COGS_API bool operator!=(const Color4hex& a, const Color4hex& b);
    COGS_API Color3f operator*(const float factor, const Color3f& col);
    COGS_API Color3f operator*(const Color3f& col, const float factor);
    COGS_API Color4f operator*(const float factor, const Color4f& col);
    COGS_API Color4f operator*(const Color4f& col, const float factor);
    COGS_API Color3f Interpolate(const Color3f& col1, const Color3f& col2, float weight);
    COGS_API std::string ColorMapToString(ColorMap map);
    COGS_API cogs::Color3f MapValueToColor(float value, ColorMap mapping_func);
    COGS_API std::vector<cogs::Color3f> MapValuesToColors(const std::vector<float>& values, ColorMap mapping_func);
    COGS_API std::vector<cogs::Color3f> MapValuesToColors(const std::vector<float>& values, std::function<float(float)> process_func, ColorMap mapping_func);
    COGS_API std::size_t GetDataTypeSize(const DataType& dtype);
    bool COGS_API ExportBVH(const std::string& filename, const cogs::Skeleton& skeleton);

    template <typename Type>
    Type Interpolate(const Type val1, const Type val2, const float weight);

    glm::quat Interpolate(const glm::quat val1, const glm::quat val2, const float weight);

    template <typename Type>
    glm::quat InterpolateCubic(const Type val1, const Type val2, const Type val3, const Type val4, const float weight);

    std::vector<glm::vec4> COGS_API CalculateTangentArray(const cogs::Mesh& mesh);
    cogs::Mesh COGS_API JoinMeshes(const std::vector<cogs::Mesh>& meshes_to_join);
    COGS_API geom::Aabb3 GetPointCloudAabb(const PointCloud& cloud);
    COGS_API void ErasePointsOutsideAabb(const geom::Aabb3& aabb, PointCloud& cloud);
    COGS_API std::vector<geom::LineSegment3> ToLineSegments(const cogs::Skeleton& skeleton);
    COGS_API std::vector<cogs::Skeleton> SplitIntoSingleBoneSkeletons(const cogs::Skeleton& skeleton);
    COGS_API geom::Aabb3 GetAabb3(const Skeleton& skeleton);

    } // namespace cogs

## Detailed Documentation

Namespace of “Computer Graphic Structures” library, which implement many core classes and structures.

### Global Functions

    COGS_API std::string ColorMapToString(ColorMap map)

Returns string representation of ColorMap enum value.

    COGS_API cogs::Color3f MapValueToColor(float value, ColorMap mapping_func)

Converts float value in range <0.0, 1.0> to color, depending on selected mapping function.

    COGS_API std::vector<cogs::Color3f> MapValuesToColors(const std::vector<float>& values, ColorMap mapping_func)

Converts float values in range <0.0, 1.0> to colors, depending on selected mapping function.

    COGS_API std::vector<cogs::Color3f> MapValuesToColors(const std::vector<float>& values, std::function<float(float)> process_func, ColorMap mapping_func)

For each float from vector applies processing function and converts value to color afterwards, depending on selected mapping function.

    COGS_API std::size_t GetDataTypeSize(const DataType& dtype)

Returns size of type denoted by DataType identifier.

    bool COGS_API ExportBVH(const std::string& filename, const cogs::Skeleton& skeleton)

Exports skeleton bone hierarchy to BVH file.

    std::vector<glm::vec4> COGS_API CalculateTangentArray(const cogs::Mesh& mesh)

Calculates tangent vectors for each point of an input mesh.

Returns:

Array of size equal to the point count of an input mesh. Each element of the array contains tangent vector in its xyz components. Component w holds information about bi-tangent orientation. If w is negative, bi-tangent is equal to the cross(T,N), otherwise cross(N,T).

    COGS_API std::vector<geom::LineSegment3> ToLineSegments(const cogs::Skeleton& skeleton)

Converts bones of skeleton to the array of line segments ordered by bone ids.

    COGS_API std::vector<cogs::Skeleton> SplitIntoSingleBoneSkeletons(const cogs::Skeleton& skeleton)

Splits skeleton into one bone skeletons.

    COGS_API geom::Aabb3 GetAabb3(const Skeleton& skeleton)

Returns bounding box wrapping all skeleton bones.