MeshLib C++ Docs
Loading...
Searching...
No Matches
MR::Features Namespace Reference

Namespaces

namespace  Primitives
namespace  Traits
 Traits that determine how the primitives are related.

Classes

struct  MeasureResult
 Stores the results of measuring two objects relative to one another. More...
struct  SubfeatureInfo
 Describes a single feature produced by forEachSubfeature(). More...

Concepts

concept  MeasureSupported
 Whether you can measure two primitives relative to one another.

Typedefs

using SubfeatureFunc = std::function<void( const SubfeatureInfo& info )>
 A user callback for forEachSubfeature().

Functions

Primitives::Sphere toPrimitive (const Vector3f &point)
 Those map various MR types to our primitives. Some of those are identity functions.
Primitives::Sphere toPrimitive (const Sphere3f &sphere)
Primitives::ConeSegment toPrimitive (const Line3f &line)
Primitives::ConeSegment toPrimitive (const LineSegm3f &segm)
Primitives::ConeSegment toPrimitive (const Cylinder3f &cyl)
Primitives::ConeSegment toPrimitive (const Cone3f &cone)
Primitives::ConeSegment primitiveCircle (const Vector3f &point, const Vector3f &normal, float rad)
 normal doesn't need to be normalized.
Primitives::ConeSegment primitiveCylinder (const Vector3f &a, const Vector3f &b, float rad)
 a and b are centers of the sides.
Primitives::ConeSegment primitiveCone (const Vector3f &a, const Vector3f &b, float rad)
 a is the center of the base, b is the pointy end.
std::optional< Primitives::VariantprimitiveFromObject (const Object &object)
 Returns null if the object type is unknown. This overload ignores the parent xf.
std::optional< Primitives::VariantprimitiveFromObjectWithWorldXf (const Object &object)
 Returns null if the object type is unknown. This overload respects the parent's worldXf().
std::shared_ptr< FeatureObjectprimitiveToObject (const Primitives::Variant &primitive, float infiniteExtent)
Primitives::Sphere transformPrimitive (const AffineXf3f &xf, const Primitives::Sphere &primitive)
Primitives::Plane transformPrimitive (const AffineXf3f &xf, const Primitives::Plane &primitive)
Primitives::ConeSegment transformPrimitive (const AffineXf3f &xf, const Primitives::ConeSegment &primitive)
Primitives::Variant transformPrimitive (const AffineXf3f &xf, const Primitives::Variant &primitive)
std::string_view toString (MeasureResult::Status status)
 MeasureResult::Status enum to string.
template<typename T>
std::string name (const T &primitive)
 Get name of a Primitives::... class (can depend on its parameters).
std::string name (const Primitives::Variant &var)
 Same but for a variant.
template<typename A, typename B>
requires MeasureSupported<A, B>
MeasureResult measure (const A &a, const B &b)
 Measures stuff between two primitives. (Two types from Primitives::....)
template<typename B>
MeasureResult measure (const Primitives::Variant &a, const B &b)
 Same, but with a variant as the first argument.
template<typename A>
MeasureResult measure (const A &a, const Primitives::Variant &b)
 Same, but with a variant as the second argument.
MeasureResult measure (const Primitives::Variant &a, const Primitives::Variant &b)
 Same, but with variants as both argument.
void forEachSubfeature (const Features::Primitives::Variant &feature, const SubfeatureFunc &func)
void forEachVisualSubfeature (const Features::Primitives::Variant &params, const Features::SubfeatureFunc &func)
 This is similar to Features::forEachSubfeature, but slightly adjusted to be suitable for visualization.

Typedef Documentation

◆ SubfeatureFunc

using MR::Features::SubfeatureFunc = std::function<void( const SubfeatureInfo& info )>

A user callback for forEachSubfeature().

Function Documentation

◆ forEachSubfeature()

void MR::Features::forEachSubfeature ( const Features::Primitives::Variant & feature,
const SubfeatureFunc & func )

Decomposes a feature to its subfeatures, by calling func() on each subfeature. This only returns the direct subfeatures. You can call this recursively to obtain all features, but beware of duplicates (there's no easy way to filter them).

◆ forEachVisualSubfeature()

void MR::Features::forEachVisualSubfeature ( const Features::Primitives::Variant & params,
const Features::SubfeatureFunc & func )

This is similar to Features::forEachSubfeature, but slightly adjusted to be suitable for visualization.