mirror of https://github.com/CGAL/cgal
adding Octree_partition.h as convenience header
correcting typo in test_marching_cubes.cpp
This commit is contained in:
parent
017da0e57a
commit
5a52c24c59
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright (c) 2022-2024 INRIA Sophia-Antipolis (France), GeometryFactory (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org).
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
|
||||
//
|
||||
// Author(s) : Sven Oesau
|
||||
|
||||
#ifndef CGAL_ISOSURFACING_3_OCTREE_PARTITION_H
|
||||
#define CGAL_ISOSURFACING_3_OCTREE_PARTITION_H
|
||||
|
||||
#include <CGAL/license/Isosurfacing_3.h>
|
||||
|
||||
#include <CGAL/Octree.h>
|
||||
#include <CGAL/Isosurfacing_3/internal/Octree_domain_3.h>
|
||||
#include <CGAL/Isosurfacing_3/internal/partition_traits_Octree.h>
|
||||
|
||||
#endif // CGAL_ISOSURFACING_3_OCTREE_PARTITION_H
|
||||
|
|
@ -10,8 +10,8 @@
|
|||
// Author(s) : Julian Stahl
|
||||
// Mael Rouxel-Labbé
|
||||
|
||||
#ifndef CGAL_ISOSURFACING_3_INTERNAL_ORTHTREE_DOMAIN_3_H
|
||||
#define CGAL_ISOSURFACING_3_INTERNAL_ORTHTREE_DOMAIN_3_H
|
||||
#ifndef CGAL_ISOSURFACING_3_INTERNAL_OCTREE_DOMAIN_3_H
|
||||
#define CGAL_ISOSURFACING_3_INTERNAL_OCTREE_DOMAIN_3_H
|
||||
|
||||
#include <CGAL/license/Isosurfacing_3.h>
|
||||
|
||||
|
|
@ -179,4 +179,4 @@ public:
|
|||
} // namespace Isosurfacing
|
||||
} // namespace CGAL
|
||||
|
||||
#endif // CGAL_ISOSURFACING_3_INTERNAL_ORTHTREE_DOMAIN_3_H
|
||||
#endif // CGAL_ISOSURFACING_3_INTERNAL_OCTREE_DOMAIN_3_H
|
||||
|
|
@ -6,14 +6,11 @@
|
|||
#include <CGAL/Isosurfacing_3/Marching_cubes_domain_3.h>
|
||||
#include <CGAL/Isosurfacing_3/Value_function_3.h>
|
||||
#include <CGAL/Isosurfacing_3/Gradient_function_3.h>
|
||||
#include <CGAL/Isosurfacing_3/internal/Orthtree_domain_3.h>
|
||||
#include <CGAL/Octree.h>
|
||||
#include <CGAL/Isosurfacing_3/Octree_partition.h>
|
||||
|
||||
#include <CGAL/IO/polygon_soup_io.h>
|
||||
#include <CGAL/Real_timer.h>
|
||||
|
||||
#include <CGAL/Isosurfacing_3/internal/partition_traits_Octree.h>
|
||||
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
|
@ -26,17 +23,15 @@ using Point = typename Kernel::Point_3;
|
|||
using Point_range = std::vector<Point>;
|
||||
using Polygon_range = std::vector<std::vector<std::size_t> >;
|
||||
|
||||
using Orthtree = CGAL::Octree<Kernel, std::vector<typename Kernel::Point_3> >;
|
||||
using Values = CGAL::Isosurfacing::Value_function_3<Orthtree>;
|
||||
using Gradients = CGAL::Isosurfacing::Gradient_function_3<Orthtree>;
|
||||
using MC_Domain = CGAL::Isosurfacing::Marching_cubes_domain_3<Orthtree, Values>;
|
||||
using Domain = CGAL::Isosurfacing::Dual_contouring_domain_3<Orthtree, Values, Gradients>;
|
||||
using Octree = CGAL::Octree<Kernel, std::vector<typename Kernel::Point_3> >;
|
||||
using Values = CGAL::Isosurfacing::Value_function_3<Octree>;
|
||||
using Gradients = CGAL::Isosurfacing::Gradient_function_3<Octree>;
|
||||
using MC_Domain = CGAL::Isosurfacing::Marching_cubes_domain_3<Octree, Values>;
|
||||
using Domain = CGAL::Isosurfacing::Dual_contouring_domain_3<Octree, Values, Gradients>;
|
||||
|
||||
// Refine one of the octant
|
||||
struct Refine_one_eighth
|
||||
{
|
||||
using Octree = Orthtree;
|
||||
|
||||
std::size_t min_depth_;
|
||||
std::size_t max_depth_;
|
||||
|
||||
|
|
@ -101,7 +96,11 @@ int main(int argc, char** argv)
|
|||
const CGAL::Bbox_3 bbox{-1., -1., -1., 1., 1., 1.};
|
||||
std::vector<Kernel::Point_3> bbox_points { {bbox.xmin(), bbox.ymin(), bbox.zmin()},
|
||||
{ bbox.xmax(), bbox.ymax(), bbox.zmax() } };
|
||||
Orthtree octree(bbox_points);
|
||||
|
||||
CGAL::Real_timer timer;
|
||||
timer.start();
|
||||
|
||||
Octree octree(bbox_points);
|
||||
Refine_one_eighth split_predicate(3, 5);
|
||||
octree.refine(split_predicate);
|
||||
|
||||
|
|
@ -111,9 +110,6 @@ int main(int argc, char** argv)
|
|||
|
||||
std::cout << "Running Dual Contouring with isovalue = " << isovalue << std::endl;
|
||||
|
||||
CGAL::Real_timer timer;
|
||||
timer.start();
|
||||
|
||||
// fill up values and gradients
|
||||
Values values { sphere_function, octree };
|
||||
Gradients gradients { sphere_gradient, octree };
|
||||
|
|
@ -125,10 +121,10 @@ int main(int argc, char** argv)
|
|||
Polygon_range triangles;
|
||||
|
||||
// run Dual Contouring
|
||||
CGAL::Isosurfacing::dual_contouring<CGAL::Parallel_tag>(domain, isovalue, points, triangles,
|
||||
CGAL::parameters::do_not_triangulate_faces(true));
|
||||
CGAL::Isosurfacing::dual_contouring<CGAL::Parallel_tag>(domain, isovalue, points, triangles, CGAL::parameters::do_not_triangulate_faces(true));
|
||||
|
||||
// run Marching Cubes
|
||||
// ToDo: Does not yet work with topologically correct marching cubes
|
||||
//CGAL::Isosurfacing::marching_cubes<CGAL::Parallel_if_available_tag>(mcdomain, isovalue, points, triangles);
|
||||
|
||||
timer.stop();
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ using Triangle_range = std::vector<std::array<std::size_t, 3> >;
|
|||
|
||||
using Mesh = CGAL::Surface_mesh<Point>;
|
||||
|
||||
#define CGAL_TESTUISTE_ISOSURFACING_OUTPUT
|
||||
#define CGAL_TESTSUITE_ISOSURFACING_OUTPUT
|
||||
|
||||
namespace IS = CGAL::Isosurfacing;
|
||||
|
||||
|
|
@ -62,7 +62,7 @@ void test_implicit_sphere()
|
|||
std::cout << "Output #vertices: " << points.size() << std::endl;
|
||||
std::cout << "Output #polygons: " << triangles.size() << std::endl;
|
||||
|
||||
#ifdef CGAL_TESTUISTE_ISOSURFACING_OUTPUT
|
||||
#ifdef CGAL_TESTSUITE_ISOSURFACING_OUTPUT
|
||||
CGAL::IO::write_polygon_soup("MC_implicit_sphere.off", points, triangles);
|
||||
#endif
|
||||
|
||||
|
|
@ -123,7 +123,7 @@ void test_grid_sphere(const std::size_t n)
|
|||
std::cout << "Output #vertices: " << points.size() << std::endl;
|
||||
std::cout << "Output #polygons: " << triangles.size() << std::endl;
|
||||
|
||||
#ifdef CGAL_TESTUISTE_ISOSURFACING_OUTPUT
|
||||
#ifdef CGAL_TESTSUITE_ISOSURFACING_OUTPUT
|
||||
const std::string test_name = "test_grid_sphere(" + std::to_string(n) + ")";
|
||||
CGAL::IO::write_polygon_soup(test_name + ".off", points, triangles);
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue