From b4ef9e44b7bbaf6c3ba34696236c293e97da2bc5 Mon Sep 17 00:00:00 2001 From: Julian Stahl Date: Thu, 15 Sep 2022 11:36:30 +0200 Subject: [PATCH] Add license headers --- .../include/CGAL/Cartesian_grid_3.h | 23 +++++++--- .../include/CGAL/Cartesian_topology_base.h | 11 +++++ Isosurfacing_3/include/CGAL/Cell_type.h | 17 +++++-- .../include/CGAL/Dual_contouring_3.h | 15 ++++++- .../internal/Dual_contouring_internal.h | 27 +++++++++--- .../CGAL/Isosurfacing_3/internal/Tables.h | 44 ++++++++++++++++++- Isosurfacing_3/include/CGAL/Octree_wrapper.h | 12 +++++ 7 files changed, 131 insertions(+), 18 deletions(-) diff --git a/Isosurfacing_3/include/CGAL/Cartesian_grid_3.h b/Isosurfacing_3/include/CGAL/Cartesian_grid_3.h index b1d0bfa3a56..558442b9667 100644 --- a/Isosurfacing_3/include/CGAL/Cartesian_grid_3.h +++ b/Isosurfacing_3/include/CGAL/Cartesian_grid_3.h @@ -1,12 +1,23 @@ +// 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_CARTESIAN_GRID_3_H #define CGAL_CARTESIAN_GRID_3_H #include #include +#include #include #include -#include namespace CGAL { @@ -20,7 +31,7 @@ public: public: Cartesian_grid_3(const std::size_t xdim, const std::size_t ydim, const std::size_t zdim, const Bbox_3 &bbox) : sizes{xdim, ydim, zdim}, bbox(bbox) { - + values.resize(xdim * ydim * zdim); gradients.resize(xdim * ydim * zdim); @@ -60,11 +71,11 @@ public: return sizes[2]; } - const Bbox_3& get_bbox() const { + const Bbox_3 &get_bbox() const { return bbox; } - const Vector& get_spacing() const { + const Vector &get_spacing() const { return spacing; } @@ -150,8 +161,8 @@ Image_3 Cartesian_grid_3::to_image() const { for (std::size_t x = 0; x < xdim(); x++) { for (std::size_t y = 0; y < ydim(); y++) { for (std::size_t z = 0; z < zdim(); z++) { - - data[(z * ydim() + y) * xdim() + x] = value(x, y, z); + + data[(z * ydim() + y) * xdim() + x] = value(x, y, z); } } } diff --git a/Isosurfacing_3/include/CGAL/Cartesian_topology_base.h b/Isosurfacing_3/include/CGAL/Cartesian_topology_base.h index 42be536ed95..e118d5cb118 100644 --- a/Isosurfacing_3/include/CGAL/Cartesian_topology_base.h +++ b/Isosurfacing_3/include/CGAL/Cartesian_topology_base.h @@ -1,3 +1,14 @@ +// 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_CARTESIAN_TOPOLOGY_BASE_H #define CGAL_CARTESIAN_TOPOLOGY_BASE_H diff --git a/Isosurfacing_3/include/CGAL/Cell_type.h b/Isosurfacing_3/include/CGAL/Cell_type.h index b897569a493..65a8cf12e3d 100644 --- a/Isosurfacing_3/include/CGAL/Cell_type.h +++ b/Isosurfacing_3/include/CGAL/Cell_type.h @@ -1,3 +1,14 @@ +// 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_DOMAIN_CELL_TYPE #define CGAL_DOMAIN_CELL_TYPE @@ -11,10 +22,10 @@ typedef std::size_t Cell_type; static constexpr Cell_type ANY_CELL = std::numeric_limits::max(); static constexpr Cell_type POLYHERDAL_CELL = ((Cell_type)1) << 0; -static constexpr Cell_type TETRAHEDRAL_CELL = ((Cell_type)1) << 1; +static constexpr Cell_type TETRAHEDRAL_CELL = ((Cell_type)1) << 1; static constexpr Cell_type CUBICAL_CELL = ((Cell_type)1) << 2; -} -} +} // namespace Isosurfacing +} // namespace CGAL #endif // CGAL_DOMAIN_CELL_TYPE \ No newline at end of file diff --git a/Isosurfacing_3/include/CGAL/Dual_contouring_3.h b/Isosurfacing_3/include/CGAL/Dual_contouring_3.h index fe1cae80ad8..33dc3516cb1 100644 --- a/Isosurfacing_3/include/CGAL/Dual_contouring_3.h +++ b/Isosurfacing_3/include/CGAL/Dual_contouring_3.h @@ -1,3 +1,15 @@ +// 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 +// Daniel Zint + #ifndef CGAL_DUAL_CONTOURING_3_H #define CGAL_DUAL_CONTOURING_3_H @@ -11,7 +23,8 @@ namespace Isosurfacing { template > void make_quad_mesh_using_dual_contouring(const Domain_& domain, const typename Domain_::FT iso_value, - PointRange& points, PolygonRange& polygons, const Positioning& positioning = Positioning()) { + PointRange& points, PolygonRange& polygons, + const Positioning& positioning = Positioning()) { // static_assert(Domain_::CELL_TYPE & ANY_CELL); diff --git a/Isosurfacing_3/include/CGAL/Isosurfacing_3/internal/Dual_contouring_internal.h b/Isosurfacing_3/include/CGAL/Isosurfacing_3/internal/Dual_contouring_internal.h index 678a247def4..b73aab1cd9e 100644 --- a/Isosurfacing_3/include/CGAL/Isosurfacing_3/internal/Dual_contouring_internal.h +++ b/Isosurfacing_3/include/CGAL/Isosurfacing_3/internal/Dual_contouring_internal.h @@ -1,3 +1,15 @@ +// 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) : Daniel Zint +// Julian Stahl + #ifndef CGAL_DUAL_CONTOURING_3_INTERNAL_DUAL_CONTOURING_3_H #define CGAL_DUAL_CONTOURING_3_INTERNAL_DUAL_CONTOURING_3_H @@ -62,9 +74,9 @@ public: point = CGAL::ORIGIN + (pos[0] + 0.5 * (pos[7] - pos[0])); // set point to voxel center - std::array normals; - std::transform(vertices.begin(), vertices.end(), normals.begin(), - [&](const auto& v) { return domain.gradient(v); }); + // std::array normals; + // std::transform(vertices.begin(), vertices.end(), normals.begin(), + // [&](const auto& v) { return domain.gradient(domain.position(v)); }); // compute edge intersections std::vector edge_intersections; @@ -78,8 +90,8 @@ public: const FT u = (s[v0] - iso_value) / (s[v0] - s[v1]); const Point p_lerp = CGAL::ORIGIN + ((1 - u) * pos[v0] + u * pos[v1]); edge_intersections.push_back(p_lerp); - const Vector n_lerp = (1 - u) * normals[v0] + u * normals[v1]; - edge_intersection_normals.push_back(n_lerp); + // const Vector n_lerp = (1 - u) * normals[v0] + u * normals[v1]; + edge_intersection_normals.push_back(domain.gradient(p_lerp)); } } @@ -229,7 +241,10 @@ public: point = CGAL::ORIGIN + (pos[0] + 0.5 * (pos[7] - pos[0])); // set point to voxel center - std::array normals = domain.gradient(vh); + std::array normals; + std::transform(vertices.begin(), vertices.end(), normals.begin(), + [&](const auto& v) { return domain.gradient(domain.position(v)); }); + // compute edge intersections std::vector edge_intersections; diff --git a/Isosurfacing_3/include/CGAL/Isosurfacing_3/internal/Tables.h b/Isosurfacing_3/include/CGAL/Isosurfacing_3/internal/Tables.h index 9125ef48a8b..969c874e1f3 100644 --- a/Isosurfacing_3/include/CGAL/Isosurfacing_3/internal/Tables.h +++ b/Isosurfacing_3/include/CGAL/Isosurfacing_3/internal/Tables.h @@ -1,3 +1,43 @@ +// Copyright (c) 2020 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 ) AND MIT +// +// Author(s) : Julian Stahl +// +// This file incorporates work covered by the following copyright and permission notice: +// +// MIT License +// +// Copyright (c) 2020 Roberto Grosso +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. +// +// +// The code below uses the version of +// https://github.com/rogrosso/tmc available on 15th of September 2022. +// + #ifndef CGAL_MARCHING_CUBES_3_INTERNAL_TABLES_H #define CGAL_MARCHING_CUBES_3_INTERNAL_TABLES_H @@ -90,8 +130,8 @@ constexpr int local_vertex_position[N_VERTICES][3] = { // there are 12 edges, assign to each vertex three edges, the global edge numbering // consist of 3*global_vertex_id + edge_offset. constexpr int global_edge_id[][4] = {{0, 0, 0, 0}, {1, 0, 0, 1}, {0, 1, 0, 0}, {0, 0, 0, 1}, - {0, 0, 1, 0}, {1, 0, 1, 1}, - {0, 1, 1, 0}, {0, 0, 1, 1}, {0, 0, 0, 2}, {1, 0, 0, 2}, {1, 1, 0, 2}, {0, 1, 0, 2}}; + {0, 0, 1, 0}, {1, 0, 1, 1}, {0, 1, 1, 0}, {0, 0, 1, 1}, + {0, 0, 0, 2}, {1, 0, 0, 2}, {1, 1, 0, 2}, {0, 1, 0, 2}}; // probably a list without errors // indicates which edges has to be intersected diff --git a/Isosurfacing_3/include/CGAL/Octree_wrapper.h b/Isosurfacing_3/include/CGAL/Octree_wrapper.h index e3f5445995c..170b72697db 100644 --- a/Isosurfacing_3/include/CGAL/Octree_wrapper.h +++ b/Isosurfacing_3/include/CGAL/Octree_wrapper.h @@ -1,3 +1,15 @@ +// 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) : Daniel Zint +// Julian Stahl + #pragma once #include