mirror of https://github.com/CGAL/cgal
first introduction of an API for future sizing function
This commit is contained in:
parent
ad85942c0b
commit
cbce3b9237
|
|
@ -127,7 +127,7 @@ int main(int argc, char* argv[])
|
|||
generate_input(1000, "data/sphere_in_cube.tr.cgal", constraints);
|
||||
|
||||
const char* filename = (argc > 1) ? argv[1] : "data/sphere_in_cube.tr.cgal";
|
||||
float target_edge_length = (argc > 2) ? atof(argv[2]) : 0.1f;
|
||||
double target_edge_length = (argc > 2) ? atof(argv[2]) : 0.1;
|
||||
|
||||
std::ifstream input(filename, std::ios::in);
|
||||
if (!input)
|
||||
|
|
|
|||
|
|
@ -73,6 +73,7 @@ namespace internal
|
|||
};
|
||||
|
||||
template<typename Triangulation
|
||||
, typename SizingFunction
|
||||
, typename EdgeIsConstrainedMap
|
||||
, typename CellSelector
|
||||
>
|
||||
|
|
@ -89,7 +90,7 @@ namespace internal
|
|||
typedef int Surface_patch_index; //only needed for is_in_complex()
|
||||
|
||||
private:
|
||||
const FT& m_target_edge_length;
|
||||
const SizingFunction& m_sizing;
|
||||
const bool m_protect_boundaries;
|
||||
// const bool m_adaptive;//adaptive sizing field TODO, outside remeshing
|
||||
C3t3 m_c3t3;
|
||||
|
|
@ -99,13 +100,13 @@ namespace internal
|
|||
|
||||
public:
|
||||
Adaptive_remesher(Triangulation& tr
|
||||
, const FT& target_edge_length
|
||||
, const SizingFunction& sizing
|
||||
, const bool protect_boundaries
|
||||
, EdgeIsConstrainedMap ecmap
|
||||
, CellSelector cell_selector
|
||||
// , const bool adaptive
|
||||
)
|
||||
: m_target_edge_length(target_edge_length)
|
||||
: m_sizing(sizing)
|
||||
, m_protect_boundaries(protect_boundaries)
|
||||
// , m_adaptive(adaptive)
|
||||
, m_c3t3()
|
||||
|
|
@ -150,7 +151,8 @@ namespace internal
|
|||
{
|
||||
CGAL_assertion(check_vertex_dimensions());
|
||||
|
||||
const FT emax = FT(4)/FT(3) * m_target_edge_length;
|
||||
const FT target_edge_length = m_sizing(CGAL::ORIGIN);
|
||||
const FT emax = FT(4)/FT(3) * target_edge_length;
|
||||
split_long_edges(m_c3t3, emax, m_protect_boundaries, m_imaginary_index,
|
||||
m_cell_selector);
|
||||
|
||||
|
|
@ -166,8 +168,9 @@ namespace internal
|
|||
{
|
||||
CGAL_assertion(check_vertex_dimensions());
|
||||
|
||||
FT emin = FT(4)/FT(5) * m_target_edge_length;
|
||||
FT emax = FT(4)/FT(3) * m_target_edge_length;
|
||||
const FT target_edge_length = m_sizing(CGAL::ORIGIN);
|
||||
FT emin = FT(4)/FT(5) * target_edge_length;
|
||||
FT emax = FT(4)/FT(3) * target_edge_length;
|
||||
collapse_short_edges(m_c3t3, emin, emax, m_protect_boundaries,
|
||||
m_imaginary_index,
|
||||
m_cell_selector);
|
||||
|
|
@ -211,8 +214,10 @@ namespace internal
|
|||
|
||||
bool resolution_reached()
|
||||
{
|
||||
FT emax = FT(4) / FT(3) * m_target_edge_length;
|
||||
FT emin = FT(4) / FT(5) * m_target_edge_length;
|
||||
const FT target_edge_length = m_sizing(CGAL::ORIGIN);
|
||||
|
||||
FT emax = FT(4) / FT(3) * target_edge_length;
|
||||
FT emin = FT(4) / FT(5) * target_edge_length;
|
||||
|
||||
FT sqmax = emax * emax;
|
||||
FT sqmin = emin * emin;
|
||||
|
|
|
|||
|
|
@ -113,6 +113,20 @@ todo//// * Its endpoints could be moved by smoothing
|
|||
void tetrahedral_adaptive_remeshing(Triangulation& tr,
|
||||
const double& target_edge_length,
|
||||
const NamedParameters& np)
|
||||
{
|
||||
tetrahedral_adaptive_remeshing(
|
||||
tr,
|
||||
[target_edge_length](const typename Triangulation::Point& p)
|
||||
{return target_edge_length;},
|
||||
np);
|
||||
}
|
||||
|
||||
template<typename Triangulation,
|
||||
typename SizingFunction,
|
||||
typename NamedParameters>
|
||||
void tetrahedral_adaptive_remeshing(Triangulation& tr,
|
||||
const SizingFunction& sizing,
|
||||
const NamedParameters& np)
|
||||
{
|
||||
CGAL_assertion(tr.is_valid(true));
|
||||
|
||||
|
|
@ -154,8 +168,8 @@ todo//// * Its endpoints could be moved by smoothing
|
|||
#endif
|
||||
|
||||
typedef Tetrahedral_remeshing::internal::Adaptive_remesher<
|
||||
Tr, ECMap, SelectionFunctor> Remesher;
|
||||
Remesher remesher(tr, target_edge_length, protect, ecmap
|
||||
Tr, SizingFunction, ECMap, SelectionFunctor> Remesher;
|
||||
Remesher remesher(tr, sizing, protect, ecmap
|
||||
, cell_select
|
||||
/*, adaptive*/);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue