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 DynamicScan; template <typename Type> class Grid; class Image; class Importer; template <typename Type> class Interpolator; class KdTree; class MaterialModel; class Octree; class PointCloud; class PointCloudSelector; class ScalePreservingTransformSerializable; class ScalePreservingTransformSerializer; class Scan; class Skeleton; class Table; class Transform; 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 std::ostream& operator<<(std::ostream& out, Color3b const& val); COGS_API std::ostream& operator<<(std::ostream& out, Color4b const& val); COGS_API std::ostream& operator<<(std::ostream& out, Color3f const& val); COGS_API std::ostream& operator<<(std::ostream& out, Color4f const& val); 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 float ColorToGray(const cogs::Color3f& col); COGS_API cogs::Color3f RandomColor(float seed); COGS_API std::size_t GetDataTypeSize(const DataType& dtype); bool COGS_API ExportBVH(const std::string& filename, const cogs::Skeleton& skeleton); COGS_API std::vector<fs::FileType> GetExportSupportedTypesWithMesh(); COGS_API std::vector<fs::FileType> GetExportSupportedTypesWithMeshMaterial(); COGS_API std::vector<fs::FileType> GetExportSupportedTypesWithScan(); COGS_API std::vector<fs::FileType> GetExportSupportedTypesWithPointCloud(); COGS_API bool ExportPointCloud(const cogs::PointCloud&, const std::string& filename); COGS_API bool ExportScan(const cogs::Scan&, const std::string& filename); COGS_API bool ExportMesh(const cogs::Mesh&, const std::string& filename); COGS_API std::vector<fs::FileType> GetImportSupportedTypes(); COGS_API std::vector<fs::FileType> GetImportSupportedTypesWithMesh(); COGS_API std::vector<fs::FileType> GetImportSupportedTypesWithMeshMaterial(); COGS_API std::vector<fs::FileType> GetImportSupportedTypesWithScan(); COGS_API std::vector<fs::FileType> GetImportSupportedTypesWithPointCloud(); 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<MaterialTextures> AllMaterialTextures(); COGS_API std::ostream& operator<<(std::ostream& out, MaterialTextures const& val); std::vector<MaterialColors> AllMaterialColors(); COGS_API std::ostream& operator<<(std::ostream& out, MaterialColors const& val); 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 glm::vec3 GetCenterOfGravity(const cogs::PointCloud& cloud, uint32_t n); COGS_API geom::Sphere ApproximateSphere(const cogs::PointCloud& cloud, uint32_t n); COGS_API std::optional<cogs::PointCloud> FilterBlackPoints(const cogs::PointCloud& point_cloud, float maximal_distance); COGS_API void ConvertIntensitiesToColors(cogs::PointCloud& point_cloud); COGS_API std::optional<cogs::Scan> FilterBlackPoints(const cogs::Scan& scan, float maximal_distance); 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 float ColorToGray(const cogs::Color3f& col)
Linear colorimetric conversion of rgb value to grayscale value. Output in range <0,1>. This conversion mix color channels in weighted manner: 0.2126*R + 0.7152*G + 0.0722*B
COGS_API cogs::Color3f RandomColor(float seed)
Generate a pseudo-random color. Exactly same seeds generate the same colors.
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.
COGS_API std::vector<fs::FileType> GetImportSupportedTypes()
Returns a list of file types that the cogs::Importer supports. Some of the formats can be not fully supported, use an object-content-specific file type getters, such as cogs::GetImportSupportedTypesWithMesh for more info.
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 glm::vec3 GetCenterOfGravity(const cogs::PointCloud& cloud, uint32_t n)
Calculate approximated center of gravity for the point cloud.
Parameters:
cloud |
Input point cloud. |
n |
The function uses every n-th point for the computation. The lower the value, the slower but more precise the approximation will be. Maximal allowed value for this parameter is 1/10 of the point-cloud size, anything above will be lowered to this value. |
COGS_API geom::Sphere ApproximateSphere(const cogs::PointCloud& cloud, uint32_t n)
Calculate approximated sphere hull of the point cloud.
Parameters:
cloud |
Input point cloud. |
n |
The function uses every n-th point for the computation. The lower the value, the slower but more precise the approximation will be. Maximal allowed value for this parameter is 1/10 of the point-cloud size, anything above will be lowered to this value. |
COGS_API std::optional<cogs::PointCloud> FilterBlackPoints(const cogs::PointCloud& point_cloud, float maximal_distance)
For all black points in point cloud either fix their color or remove them.
Color used to substitute the black is gathered from the nearest non-black point. If there is no such point in the proximity, the point is not fixed but removed.
Parameters:
point_cloud |
Input point cloud on which to perform filtering. |
maximal_distance |
Distance up to which the nearest point can exist. |
Returns:
New filtered point cloud, or nullopt if an error occurred during filtering.
COGS_API void ConvertIntensitiesToColors(cogs::PointCloud& point_cloud)
Replaces color property data of point_cloud by grayscale intensities and removes intensity property.
Parameters:
std::logic_error |
if input point_cloud has no intensity property. |
COGS_API std::optional<cogs::Scan> FilterBlackPoints(const cogs::Scan& scan, float maximal_distance)
For all black points in scan either fix their color or remove them.
Color used to substitute the black is gathered from the nearest non-black point. If there is no such point in the proximity, the point is not fixed but removed.
Parameters:
scan |
Input scan on which to perform filtering. |
maximal_distance |
Distance up to which the nearest point can exist. |
Returns:
New filtered scan, or nullopt if an error occurred during filtering.
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.