5#include "MRPch/MRBindingMacros.h"
41 const Vector3i & d, std::int64_t rSq );
76 static_assert( std::is_floating_point_v<T> );
94 const T vv = v.lengthSq();
95 if ( uu > 4 * rSq || vv > 4 * rSq || ( v - u ).lengthSq() > 4 * rSq )
104 const T uv =
dot( u, v );
105 M = ( vv * ( uu - uv ) ) * u + ( uu * ( vv - uv ) ) * v;
108 E = 4 * rSq * W * W - M.lengthSq();
117 const auto q = d - a;
124 const T A = W * qq -
dot( q, M );
125 const T t =
dot( q, w );
128 if ( A < 0 && t >= 0 )
130 if ( A >= 0 && t <= 0 )
132 const T lhs = A * A * W;
133 const T rhs = E * t * t;
153class InSphereTester<int>
161 MRMESH_API bool reset(
const Vector3i & a,
const Vector3i & b,
const Vector3i & c, std::int64_t rSq );
181 std::int64_t rSq = 0;
196 if ( !tester.reset( a, b, c, rSq ) )
#define MRMESH_API
Definition MRMeshFwd.h:82
Definition MRInSphere.h:75
bool reset(const Vector3i &a, const Vector3i &b, const Vector3i &c, std::int64_t rSq)
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
InSphereResult operator()(const std::array< PreciseVertCoords, 4 > &vs) const
InSphereResult operator()(const Vector3i &d) const
bool reset(const Vector3< T > &va, const Vector3< T > &vb, const Vector3< T > &vc, T sqRadius)
Definition MRInSphere.h:83
InSphereResult operator()(const Vector3< T > &d) const
Definition MRInSphere.h:114
MR_BIND_TEMPLATE(std::pair< Vector3f, TriPointf > closestPointInTriangle(const Vector3f &p, const Vector3f &a, const Vector3f &b, const Vector3f &c))
T lengthSq() const
Definition MRVector3.h:68
boost::multiprecision::int512_t Int512
Definition MRHighPrecision.h:28
boost::multiprecision::int256_t Int256
Definition MRHighPrecision.h:27
Vector3< Int256 > Vector3i256
Definition MRHighPrecision.h:41
InSphereTester< int > InSphereTesteri
Definition MRInSphere.h:186
InSphereTester< double > InSphereTesterd
Definition MRInSphere.h:185
InSphereTester< float > InSphereTesterf
Definition MRInSphere.h:184
InSphereResult inSphere(const Vector3i &a, const Vector3i &b, const Vector3i &c, const Vector3i &d, std::int64_t rSq)
InSphereResult
the result of inSphere predicates
Definition MRInSphere.h:20
@ NoSphere
Definition MRInSphere.h:23
@ Outside
the sphere exists, and the point D is strictly outside
Definition MRInSphere.h:25
@ Inside
the sphere exists, and the point D is strictly inside
Definition MRInSphere.h:31
@ OnSphere
Definition MRInSphere.h:29
only for bindings generation
Definition MRCameraOrientationPlugin.h:8
T cross(const Vector2< T > &a, const Vector2< T > &b)
cross product
Definition MRVector2.h:160
Definition MRVector3.h:33