-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathContainsPoint.h
More file actions
74 lines (59 loc) · 2.37 KB
/
ContainsPoint.h
File metadata and controls
74 lines (59 loc) · 2.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#pragma once
#include <sofa/collisionAlgorithm/BaseElement.h>
#include <sofa/collisionAlgorithm/BaseOperation.h>
namespace sofa::collisionAlgorithm::Operations::ContainsPointInElement
{
typedef bool Result;
class Operation : public GenericOperation<Operation, // Type of the operation
Result, // Default return type
const type::Vec3&, const BaseElement::SPtr& // Parameters
>
{
public:
Result defaultFunc(const type::Vec3&, const BaseElement::SPtr&) const override { return false; }
void notFound(const std::type_info& id) const override
{
msg_error("ContainsPointInElement")
<< "The operation ContainsPointInElementOperation is not registered with for type = "
<< sofa::helper::NameDecoder::decodeFullName(id);
}
};
typedef Operation::FUNC FUNC;
} // namespace sofa::collisionAlgorithm::Operations::ContainsPointInElement
namespace sofa::collisionAlgorithm::Operations::ContainsPointInProximity
{
typedef bool Result;
class Operation
: public GenericOperation<Operation, // Type of the operation
Result, // Default return type
const type::Vec3&, const BaseProximity::SPtr& // Parameters
>
{
public:
Result defaultFunc(const type::Vec3&, const BaseProximity::SPtr&) const override
{
return false;
}
void notFound(const std::type_info& id) const override
{
msg_error("ContainsPointInProximity")
<< "The operation ContainsPointInProximityOperation is not registered with for type = "
<< sofa::helper::NameDecoder::decodeFullName(id);
}
};
template <typename PROX>
Result containsPoint(const type::Vec3& P, const typename std::shared_ptr<PROX>& prox)
{
if (!prox)
{
msg_warning("ContainsPointInProximity") << "Null proximity pointer in containsPoint"
<< "Operation is disabled; returning false";
return false;
}
auto elem = prox->element();
auto containsPointInElem =
sofa::collisionAlgorithm::Operations::ContainsPointInElement::Operation::get(elem);
return containsPointInElem(P, elem);
}
typedef Operation::FUNC FUNC;
} // namespace sofa::collisionAlgorithm::Operations::ContainsPointInProximity