21 MeshOrPoints(
const PointCloudPart & pcp ) : var_( pcp ) { }
24 MeshOrPoints(
const Mesh & mesh ) : var_( MeshPart( mesh ) ) { }
25 MeshOrPoints(
const PointCloud & pc ) : var_( PointCloudPart( pc ) ) { }
28 [[nodiscard]]
const MeshPart* asMeshPart()
const;
31 [[nodiscard]]
const PointCloudPart* asPointCloudPart()
const;
35 [[nodiscard]]
MRMESH_API Box3f getObjBoundingBox()
const;
42 [[nodiscard]]
MRMESH_API Box3f computeBoundingBox(
const AffineXf3f * toWorld =
nullptr )
const;
45 MRMESH_API void accumulate( PointAccumulator& accum,
const AffineXf3f* xf =
nullptr )
const;
52 [[nodiscard]]
MRMESH_API std::optional<VertBitSet> pointsGridSampling(
float voxelSize,
size_t maxVoxels = 500000,
53 const ProgressCallback & cb = {} )
const;
56 [[nodiscard]]
MRMESH_API const VertCoords & points()
const;
59 [[nodiscard]]
MRMESH_API const VertBitSet& validPoints()
const;
62 [[nodiscard]]
MRMESH_API std::function<Vector3f(VertId)> normals()
const;
66 [[nodiscard]]
MRMESH_API std::function<float(VertId)> weights()
const;
87 [[nodiscard]]
explicit operator bool()
const {
return valid(); }
92 [[nodiscard]]
MRMESH_API std::function<ProjectionResult(
const Vector3f & )> projector()
const;
94 using LimitedProjectorFunc = std::function<bool(
const Vector3f& p, ProjectionResult& res )>;
98 [[nodiscard]]
MRMESH_API LimitedProjectorFunc limitedProjector()
const;
101 std::variant<MeshPart, PointCloudPart> var_;
111 [[nodiscard]]
MRMESH_API std::function<MeshOrPoints::ProjectionResult(
const Vector3f& )> projector()
const;
115 [[nodiscard]]
MRMESH_API MeshOrPoints::LimitedProjectorFunc limitedProjector()
const;
130 const ProjectOnAllCallback & callback,
131 ObjId skipObjId = {} );
139 return mop->projector()( p );
148 const Object* root =
nullptr,
149 std::function<
bool(
const Object& )> projectPred =
nullptr,
150 std::function<
bool(
const Object& )> recursePred =
nullptr
153inline const MeshPart* MeshOrPoints::asMeshPart()
const
156 [](
const MeshPart & mp ) {
return ∓ },
157 [](
const PointCloudPart & ) {
return (
const MeshPart*)
nullptr; }
161inline const PointCloudPart* MeshOrPoints::asPointCloudPart()
const
164 [](
const MeshPart & ) {
return (
const PointCloudPart *)
nullptr; },
165 [](
const PointCloudPart & pcp ) {
return &pcp; }
#define MRMESH_API
Definition MRMeshFwd.h:80
Definition MRAABBTreeObjects.h:19
unsafe MeshOrPoints(MR.Const_MeshOrPoints _other)
Definition MRCameraOrientationPlugin.h:8
MRMESH_API void projectOnAll(const Vector3f &pt, const AABBTreeObjects &tree, float upDistLimitSq, const ProjectOnAllCallback &callback, ObjId skipObjId={})
finds closest point on every object within given distance
MeshOrPoints::ProjectionResult projectWorldPointOntoObject(const Vector3f &p, const Object &obj)
Projects a point onto an object, in world space. Returns .valid() == false if this object type isn't ...
Definition MRMeshOrPoints.h:134
MRMESH_API std::optional< MeshOrPoints > getMeshOrPoints(const Object *obj)
constructs MeshOrPoints from ObjectMesh or ObjectPoints, otherwise returns nullopt
MRMESH_API MeshOrPoints::ProjectionResult projectWorldPointOntoObjectsRecursive(const Vector3f &p, const Object *root=nullptr, std::function< bool(const Object &)> projectPred=nullptr, std::function< bool(const Object &)> recursePred=nullptr)
overloaded(Ts...) -> overloaded< Ts... >
MRMESH_API std::optional< MeshOrPointsXf > getMeshOrPointsXf(const Object *obj)
Definition MRMeshOrPoints.h:69
std::optional< Vector3f > normal
Definition MRMeshOrPoints.h:75
bool valid() const
Definition MRMeshOrPoints.h:88
Vector3f point
found closest point
Definition MRMeshOrPoints.h:71
float distSq
squared distance from query point to the closest point
Definition MRMeshOrPoints.h:81
bool isBd
can be true only for meshes, if the closest point is located on the boundary of the mesh (or the curr...
Definition MRMeshOrPoints.h:78
VertId closestVert
Definition MRMeshOrPoints.h:85
Definition MRMeshFwd.h:774