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{
8
10template <typename V>
11struct Ball
12{
14 using T = typename VTraits::BaseType;
15 static constexpr int elements = VTraits::size;
16
18 T radiusSq = 0;
19
21 bool inside( const V & pt ) const { return distanceSq( pt, center ) < radiusSq; }
22
24 bool outside( const V & pt ) const { return distanceSq( pt, center ) > radiusSq; }
25};
26
27} //namespace MR
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
a ball = points surrounded by a sphere in arbitrary space with vector type V
Definition MRBall.h:12
static constexpr int elements
Definition MRBall.h:15
bool outside(const V &pt) const
returns true if given point is strictly outside the ball (not on its spherical surface)
Definition MRBall.h:24
T radiusSq
ball's squared radius
Definition MRBall.h:18
typename VTraits::BaseType T
Definition MRBall.h:14
bool inside(const V &pt) const
returns true if given point is strictly inside the ball (not on its spherical surface)
Definition MRBall.h:21
V center
ball's center
Definition MRBall.h:17
Definition MRMesh/MRVectorTraits.h:14
static constexpr int size
Definition MRMesh/MRVectorTraits.h:18
T BaseType
Definition MRMesh/MRVectorTraits.h:17