MeshLib C++ Docs
Loading...
Searching...
No Matches
MRBall.h
Go to the documentation of this file.
1#pragma once
2
3#include "MRMeshFwd.h"
4#include "MRVectorTraits.h"
5
6namespace MR
7{
10
11
13template <typename V>
14struct Ball
15{
17 using T = typename VTraits::BaseType;
18 static constexpr int elements = VTraits::size;
19
21 T radiusSq = 0;
22
24 bool inside( const V & pt ) const { return distanceSq( pt, center ) < radiusSq; }
25
27 bool outside( const V & pt ) const { return distanceSq( pt, center ) > radiusSq; }
28};
29
30}
static constexpr int elements
Definition MRBall.h:18
bool outside(const V &pt) const
returns true if given point is strictly outside the ball (not on its spherical surface)
Definition MRBall.h:27
static constexpr int size
Definition MRMesh/MRVectorTraits.h:22
T radiusSq
ball's squared radius
Definition MRBall.h:21
typename VTraits::BaseType T
Definition MRBall.h:17
bool inside(const V &pt) const
returns true if given point is strictly inside the ball (not on its spherical surface)
Definition MRBall.h:24
V center
ball's center
Definition MRBall.h:20
T BaseType
The base template handles scalars (or just non-vectors).
Definition MRMesh/MRVectorTraits.h:21
std::optional< T > distanceSq(const Plane3< T > &plane1, const Plane3< T > &plane2, T errorLimit=std::numeric_limits< T >::epsilon() *T(20))
Definition MRIntersection.h:90
only for bindings generation
Definition MRCameraOrientationPlugin.h:8
a ball = points surrounded by a sphere in arbitrary space with vector type V
Definition MRBall.h:15
Common traits for (mathematical) vectors.
Definition MRMesh/MRVectorTraits.h:18