// Copyright (c) 2022 INRIA Sophia-Antipolis (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) : Julian Stahl #ifndef CGAL_IMPLICIT_CARTESIAN_GRID_DOMAIN_H #define CGAL_IMPLICIT_CARTESIAN_GRID_DOMAIN_H #include #include #include #include #include #include namespace CGAL { namespace Isosurfacing { template using Implicit_cartesian_grid_domain = Base_domain, Implicit_function_with_geometry, PointFunction>, Gradient_>; template > Implicit_cartesian_grid_domain create_implicit_cartesian_grid_domain( const Bbox_3& bbox, const typename GeomTraits::Vector_3& spacing, const PointFunction& point_function, const Gradient_& gradient = Gradient_()) { typedef Implicit_cartesian_grid_domain Domain; typedef typename Domain::Topology Topology; typedef typename Domain::Geometry Geometry; typedef typename Domain::Function Function; typedef typename Domain::Gradient Gradient; typedef typename Function::element_type::Point_function Point_function; const std::size_t size_i = std::ceil(bbox.x_span() / spacing.x()) + 1; const std::size_t size_j = std::ceil(bbox.y_span() / spacing.y()) + 1; const std::size_t size_k = std::ceil(bbox.z_span() / spacing.z()) + 1; const typename GeomTraits::Vector_3 offset(bbox.xmin(), bbox.ymin(), bbox.zmin()); const Topology topo = std::make_shared(size_i, size_j, size_k); const Geometry geom = std::make_shared(offset, spacing); const Point_function point_func = std::make_shared(point_function); const Function func = std::make_shared(geom, point_func); const Gradient grad = std::make_shared(gradient); return Domain(topo, geom, func, grad); } } // namespace Isosurfacing } // namespace CGAL #endif // CGAL_IMPLICIT_CARTESIAN_GRID_DOMAIN_H