mirror of https://github.com/CGAL/cgal
Rework of Mesh_edge_criteria's constructor.
Now using same principle as Mesh_facet_criteria.
This commit is contained in:
parent
c0e92057ee
commit
c73da52cf4
|
|
@ -120,10 +120,12 @@ public:
|
|||
|
||||
/// \name Creation
|
||||
/// @{
|
||||
|
||||
/*!
|
||||
* Returns an object to serve as criteria for edges.
|
||||
* \param length_bound is an upper bound
|
||||
* for the length of the edges which are used to discretize the curves.
|
||||
* It can be a functional or a constant.
|
||||
* \param min_length_bound is a desired lower bound
|
||||
* for the length of the edges which are used to discretize the curves.
|
||||
* Only edges that are longer than this bound will be refined. Using
|
||||
|
|
@ -132,115 +134,20 @@ public:
|
|||
* It is not guaranteed to be exactly respected in the output mesh.
|
||||
* \param distance_bound is an upper bound for the distance from the
|
||||
* edge to the 1D feature.
|
||||
* It can be a functional or a constant.
|
||||
*
|
||||
* Note that if one parameter is set to 0, then its corresponding criterion is ignored.
|
||||
*/
|
||||
Mesh_edge_criteria_3(const FT& length_bound,
|
||||
template < typename Sizing_field, typename Sizing_field2 = FT >
|
||||
Mesh_edge_criteria_3(const Sizing_field& length_bound,
|
||||
const FT& min_length_bound = 0,
|
||||
const FT& distance_bound = 0)
|
||||
: p_size_(new Mesh_3::internal::Sizing_field_container<
|
||||
Mesh_constant_domain_field_3<Gt,Index> ,
|
||||
FT,
|
||||
Point_3,
|
||||
Index>(length_bound))
|
||||
, min_length_bound_(min_length_bound)
|
||||
, distance_bound_(new Mesh_3::internal::Sizing_field_container<
|
||||
Mesh_constant_domain_field_3<Gt,Index> ,
|
||||
FT,
|
||||
Point_3,
|
||||
Index>(distance_bound))
|
||||
{}
|
||||
|
||||
// Nb: SFINAE to avoid wrong matches with built-in numerical types
|
||||
// as int.
|
||||
/*!
|
||||
* @tparam SizingField a model of `MeshDomainField_3`
|
||||
*
|
||||
* Returns an object to serve as criteria for edges.
|
||||
* The behavior and semantic of the argument are the same
|
||||
* as above, except that the `length_bound`
|
||||
* parameter is a functional instead of a constant.
|
||||
*/
|
||||
template < typename SizingField >
|
||||
Mesh_edge_criteria_3
|
||||
(
|
||||
const SizingField& length_bound,
|
||||
const FT& min_length_bound = 0,
|
||||
const FT& distance_bound = 0
|
||||
#ifndef DOXYGEN_RUNNING
|
||||
, std::enable_if_t<Mesh_3::Is_mesh_domain_field_3<Tr, SizingField>::value>* = 0
|
||||
#endif
|
||||
)
|
||||
: min_length_bound_(min_length_bound)
|
||||
, distance_bound_(new Mesh_3::internal::Sizing_field_container<
|
||||
Mesh_constant_domain_field_3<Gt,Index> ,
|
||||
FT,
|
||||
Point_3,
|
||||
Index>(distance_bound))
|
||||
{
|
||||
p_size_ = new Mesh_3::internal::Sizing_field_container<SizingField,
|
||||
FT,
|
||||
Point_3,
|
||||
Index>(length_bound);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @tparam DistanceField a model of `MeshDomainField_3`
|
||||
*
|
||||
* Returns an object to serve as criteria for edges.
|
||||
* The behavior and semantic of the argument are the same
|
||||
* as above, except that the `distance_bound`
|
||||
* parameter is a functional instead of a constant.
|
||||
*/
|
||||
template < typename DistanceField >
|
||||
Mesh_edge_criteria_3(const FT& length_bound,
|
||||
const FT& min_length_bound = 0,
|
||||
const DistanceField& distance_bound = 0
|
||||
#ifndef DOXYGEN_RUNNING
|
||||
, std::enable_if_t<Mesh_3::Is_mesh_domain_field_3<Tr, DistanceField>::value>* = 0
|
||||
#endif
|
||||
)
|
||||
: p_size_(new Mesh_3::internal::Sizing_field_container<
|
||||
Mesh_constant_domain_field_3<Gt,Index> ,
|
||||
FT,
|
||||
Point_3,
|
||||
Index>(length_bound))
|
||||
, min_length_bound_(min_length_bound)
|
||||
{
|
||||
distance_bound_ = new Mesh_3::internal::Sizing_field_container<DistanceField,
|
||||
FT,
|
||||
Point_3,
|
||||
Index>(distance_bound);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @tparam SizingField a model of `MeshDomainField_3`
|
||||
* @tparam DistanceField a model of `MeshDomainField_3`
|
||||
*
|
||||
* Returns an object to serve as criteria for edges.
|
||||
* The behavior and semantic of the argument are the same
|
||||
* as above, except that the `distance_bound` and `length_bound`
|
||||
* parameters are functional instead of a constant.
|
||||
*/
|
||||
template < typename SizingField, typename DistanceField>
|
||||
Mesh_edge_criteria_3(const SizingField& length_bound,
|
||||
const FT& min_length_bound = 0,
|
||||
const DistanceField& distance_bound = 0
|
||||
#ifndef DOXYGEN_RUNNING
|
||||
, std::enable_if_t<Mesh_3::Is_mesh_domain_field_3<Tr, SizingField>::value>* = 0
|
||||
, std::enable_if_t<Mesh_3::Is_mesh_domain_field_3<Tr, DistanceField>::value>* = 0
|
||||
#endif
|
||||
)
|
||||
const Sizing_field2& distance_bound = 0)
|
||||
: min_length_bound_(min_length_bound)
|
||||
{
|
||||
p_size_ = new Mesh_3::internal::Sizing_field_container<SizingField,
|
||||
FT,
|
||||
Point_3,
|
||||
Index>(length_bound);
|
||||
distance_bound_ = new Mesh_3::internal::Sizing_field_container<DistanceField,
|
||||
FT,
|
||||
Point_3,
|
||||
Index>(distance_bound);
|
||||
init_p_size(length_bound,
|
||||
Mesh_3::Is_mesh_domain_field_3<Tr, Sizing_field>());
|
||||
init_distance_bound(distance_bound,
|
||||
Mesh_3::Is_mesh_domain_field_3<Tr, Sizing_field2>());
|
||||
}
|
||||
|
||||
/// @}
|
||||
|
|
@ -249,13 +156,14 @@ public:
|
|||
Mesh_edge_criteria_3(const Self& rhs)
|
||||
: p_size_(rhs.p_size_->clone())
|
||||
, min_length_bound_(rhs.min_length_bound_)
|
||||
, distance_bound_(rhs.distance_bound_)
|
||||
, distance_bound_(rhs.distance_bound_->clone())
|
||||
{}
|
||||
|
||||
/// Destructor
|
||||
~Mesh_edge_criteria_3()
|
||||
{
|
||||
delete p_size_;
|
||||
delete distance_bound_;
|
||||
}
|
||||
|
||||
/// Returns size of tuple (p,dim,index)
|
||||
|
|
@ -277,6 +185,44 @@ private:
|
|||
typedef Mesh_3::internal::Sizing_field_interface<FT,Point_3,Index>
|
||||
Sizing_field_interface;
|
||||
|
||||
void init_p_size(const FT& length_bound, Tag_false)
|
||||
{
|
||||
p_size_ = new Mesh_3::internal::Sizing_field_container<
|
||||
Mesh_constant_domain_field_3<Gt,Index> ,
|
||||
FT,
|
||||
Point_3,
|
||||
Index>(length_bound);
|
||||
}
|
||||
|
||||
template <typename Sizing_field>
|
||||
void init_p_size(const Sizing_field& length_bound, Tag_true)
|
||||
{
|
||||
p_size_ = new Mesh_3::internal::Sizing_field_container<
|
||||
Sizing_field,
|
||||
FT,
|
||||
Point_3,
|
||||
Index>(length_bound);
|
||||
}
|
||||
|
||||
void init_distance_bound(const FT& distance_bound, Tag_false)
|
||||
{
|
||||
distance_bound_ = new Mesh_3::internal::Sizing_field_container<
|
||||
Mesh_constant_domain_field_3<Gt,Index> ,
|
||||
FT,
|
||||
Point_3,
|
||||
Index>(distance_bound);
|
||||
}
|
||||
|
||||
template <typename Sizing_field>
|
||||
void init_distance_bound(const Sizing_field& distance_bound, Tag_true)
|
||||
{
|
||||
distance_bound_ = new Mesh_3::internal::Sizing_field_container<
|
||||
Sizing_field,
|
||||
FT,
|
||||
Point_3,
|
||||
Index>(distance_bound);
|
||||
}
|
||||
|
||||
// A pointer to Sizing_field_interface to handle dynamic wrapping of
|
||||
// real Sizing_field type
|
||||
Sizing_field_interface* p_size_;
|
||||
|
|
@ -284,6 +230,7 @@ private:
|
|||
Sizing_field_interface* distance_bound_;
|
||||
};
|
||||
|
||||
|
||||
} // end namespace CGAL
|
||||
|
||||
#endif // CGAL_MESH_EDGE_CRITERIA_3_H
|
||||
|
|
|
|||
Loading…
Reference in New Issue