MeshLib C++ Docs
Loading...
Searching...
No Matches
MRDipole.h
Go to the documentation of this file.
1#pragma once
2
3#include "MRVector3.h"
4
5namespace MR
6{
9
10
13struct Dipole
14{
15 Vector3f pos;
16 float area = 0;
17 Vector3f dirArea;
18 float rr = 0;
21 [[nodiscard]] bool addIfGoodApprox( const Vector3f& q, float betaSq, float& addTo ) const
22 {
23 const auto dp = pos - q;
24 const auto dd = dp.lengthSq();
25 if ( dd <= betaSq * rr )
26 return false;
27 if ( const auto d = std::sqrt( dd ); d > 0 )
28 addTo += dot( dp, dirArea ) / ( d * dd );
29 return true;
30 }
31};
32
33static_assert( sizeof( Dipole ) == 8 * sizeof( float ) );
34
36MRMESH_API void calcDipoles( Dipoles& dipoles, const AABBTree& tree, const Mesh& mesh );
37[[nodiscard]] MRMESH_API Dipoles calcDipoles( const AABBTree& tree, const Mesh& mesh );
38
43[[nodiscard]] MRMESH_API float calcFastWindingNumber( const Dipoles& dipoles, const AABBTree& tree, const Mesh& mesh,
44 const Vector3f & q, float beta, FaceId skipFace );
45
46}
#define MRMESH_API
Definition MRMeshFwd.h:80
Definition MRAABBTree.h:16
auto dot(const Matrix2< T > &a, const Matrix2< T > &b) -> decltype(dot(a.x, b.x))
double-dot product: x = a : b
Definition MRMatrix2.h:142
float rr
Definition MRDipole.h:18
Vector3f dirArea
Definition MRDipole.h:17
void calcDipoles(Dipoles &dipoles, const AABBTree &tree, const Mesh &mesh)
calculates dipoles for given mesh and AABB-tree
bool addIfGoodApprox(const Vector3f &q, float betaSq, float &addTo) const
Definition MRDipole.h:21
float area
Definition MRDipole.h:16
float calcFastWindingNumber(const Dipoles &dipoles, const AABBTree &tree, const Mesh &mesh, const Vector3f &q, float beta, FaceId skipFace)
struct MRMESH_CLASS Dipole
Definition MRMeshFwd.h:524
Vector3f pos
Definition MRDipole.h:15
only for bindings generation
Definition MRCameraOrientationPlugin.h:8
Definition MRDipole.h:14
Definition MRMesh.h:23