9#ifndef IGL_COPYLEFT_CGAL_BINARY_WINDING_NUMBER_OPERATIONS_H
10#define IGL_COPYLEFT_CGAL_BINARY_WINDING_NUMBER_OPERATIONS_H
13#include "../../igl_inline.h"
14#include "../../MeshBooleanType.h"
30 template <igl::MeshBooleanType Op>
33 template<
typename DerivedW>
35 const Eigen::PlainObjectBase<DerivedW>& )
const {
36 throw (std::runtime_error(
"not implemented!"));
44 template<
typename DerivedW>
46 const Eigen::PlainObjectBase<DerivedW>& win_nums)
const
48 for(
int i = 0;i<win_nums.size();i++)
50 if(win_nums(i) > 0)
return true;
60 template<
typename DerivedW>
62 const Eigen::PlainObjectBase<DerivedW>& win_nums)
const
64 for(
int i = 0;i<win_nums.size();i++)
66 if(win_nums(i)<=0)
return false;
76 template<
typename DerivedW>
78 const Eigen::PlainObjectBase<DerivedW>& win_nums)
const
80 assert(win_nums.size()>1);
82 bool union_rest =
false;
83 for(
int i = 1;i<win_nums.size();i++)
85 union_rest = union_rest || win_nums(i) > 0;
89 return win_nums(0) > 0 && !union_rest;
97 template<
typename DerivedW>
99 const Eigen::PlainObjectBase<DerivedW>& win_nums)
const
103 for(
int i = 0;i<win_nums.size();i++)
105 if(win_nums(i) > 0)
count++;
107 return count % 2 == 1;
115 template<
typename DerivedW>
117 const Eigen::PlainObjectBase<DerivedW>& )
const {
137 template<KeeperType T>
140 template<
typename DerivedW>
142 const Eigen::PlainObjectBase<DerivedW>& )
const {
143 throw std::runtime_error(
"Not implemented");
153 if (in_w > 0 && out_w <= 0)
return 1;
154 else if (in_w <= 0 && out_w > 0)
return -1;
DerivedW::Scalar operator()(const Eigen::PlainObjectBase< DerivedW > &win_nums) const
Definition BinaryWindingNumberOperations.h:61
DerivedW::Scalar operator()(const Eigen::PlainObjectBase< DerivedW > &win_nums) const
Definition BinaryWindingNumberOperations.h:77
DerivedW::Scalar operator()(const Eigen::PlainObjectBase< DerivedW > &) const
Definition BinaryWindingNumberOperations.h:116
DerivedW::Scalar operator()(const Eigen::PlainObjectBase< DerivedW > &win_nums) const
Definition BinaryWindingNumberOperations.h:45
DerivedW::Scalar operator()(const Eigen::PlainObjectBase< DerivedW > &win_nums) const
Definition BinaryWindingNumberOperations.h:98
Binary winding number operations.
Definition BinaryWindingNumberOperations.h:31
DerivedW::Scalar operator()(const Eigen::PlainObjectBase< DerivedW > &) const
Definition BinaryWindingNumberOperations.h:34
Keep all policy.
Definition BinaryWindingNumberOperations.h:161
short operator()(T, T) const
Definition BinaryWindingNumberOperations.h:164
Keep inside policy.
Definition BinaryWindingNumberOperations.h:149
short operator()(T out_w, T in_w) const
Definition BinaryWindingNumberOperations.h:152
Filter winding numbers according to keep policy.
Definition BinaryWindingNumberOperations.h:138
short operator()(const Eigen::PlainObjectBase< DerivedW > &) const
Definition BinaryWindingNumberOperations.h:141
BinaryWindingNumberOperations< MESH_BOOLEAN_TYPE_INTERSECT > BinaryIntersect
Definition BinaryWindingNumberOperations.h:123
BinaryWindingNumberOperations< MESH_BOOLEAN_TYPE_UNION > BinaryUnion
Definition BinaryWindingNumberOperations.h:122
KeeperType
Types of Keep policies.
Definition BinaryWindingNumberOperations.h:129
@ KEEP_ALL
Keep everything.
Definition BinaryWindingNumberOperations.h:133
@ KEEP_INSIDE
Keep only inside.
Definition BinaryWindingNumberOperations.h:131
BinaryWindingNumberOperations< MESH_BOOLEAN_TYPE_RESOLVE > BinaryResolve
Definition BinaryWindingNumberOperations.h:126
BinaryWindingNumberOperations< MESH_BOOLEAN_TYPE_XOR > BinaryXor
Definition BinaryWindingNumberOperations.h:125
BinaryWindingNumberOperations< MESH_BOOLEAN_TYPE_MINUS > BinaryMinus
Definition BinaryWindingNumberOperations.h:124
@ MESH_BOOLEAN_TYPE_MINUS
A \ B.
Definition MeshBooleanType.h:20
@ MESH_BOOLEAN_TYPE_XOR
A ⊕ B.
Definition MeshBooleanType.h:22
@ MESH_BOOLEAN_TYPE_INTERSECT
A ∩ B.
Definition MeshBooleanType.h:18
@ MESH_BOOLEAN_TYPE_UNION
A ∪ B.
Definition MeshBooleanType.h:16
@ MESH_BOOLEAN_TYPE_RESOLVE
Resolve intersections without removing any non-coplanar faces.
Definition MeshBooleanType.h:24
void count(const Eigen::SparseMatrix< XType > &X, const int dim, Eigen::SparseVector< SType > &S)
Count the number of non-zeros in the columns or rows of a sparse matrix.