Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GSoC2022 - Interpolated Corrected Curvatures #6760

Merged
merged 177 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
177 commits
Select commit Hold shift + click to select a range
048d38d
interpolated mu i measures (yet to check )
hoskillua Jul 10, 2022
e63de4f
implemented computing mu_i over all faces
hoskillua Jul 13, 2022
2eeb88a
moved my main program to a new example file in PMP
hoskillua Jul 15, 2022
5af7795
typo fix
hoskillua Jul 15, 2022
8c943fd
typo fix
hoskillua Jul 15, 2022
4b0577a
added doc (yet to build), used generic GT instead of Epic, made VNM a…
hoskillua Jul 17, 2022
34b816b
Merge remote-tracking branch 'cgal-dev/gsoc2022-ICC-hoskillua' into g…
hoskillua Jul 17, 2022
c3d654b
add documentation for enum
hoskillua Jul 18, 2022
e1961c4
minor doc fix
hoskillua Jul 18, 2022
138f1ea
added to reference manual page
hoskillua Jul 18, 2022
b1e1912
doc typos
hoskillua Jul 18, 2022
dda3079
Merge remote-tracking branch 'cgal-dev/gsoc2022-ICC-hoskillua' into g…
hoskillua Jul 18, 2022
a5f9969
used a face property map for computing measures, added license
hoskillua Jul 18, 2022
528228f
Merge remote-tracking branch 'cgal-dev/gsoc2022-ICC-hoskillua' into g…
hoskillua Jul 18, 2022
a54033c
add a couple of missing const and typename
sloriot Jul 18, 2022
5cc75c0
Updated Demo Display property plugin, added to license list,
hoskillua Jul 18, 2022
5af4a28
updated doc for interpolated_corrected_measure_mesh()
hoskillua Jul 18, 2022
8fea1a9
minor fix
hoskillua Jul 18, 2022
2778d87
Merge remote-tracking branch 'upstream/master' into gsoc2022
hoskillua Jul 19, 2022
063e058
minor changes regarding the pull review
hoskillua Jul 22, 2022
66a2624
minor doc fix
hoskillua Jul 25, 2022
41be368
Mean and Gaussian Curvatures + Visualizer (Still wip)
hoskillua Jul 26, 2022
48ff36d
fixed some missing typenames
hoskillua Jul 27, 2022
6b985bf
for boundary faces
hoskillua Jul 27, 2022
8d2a5bc
add license header
sloriot Jul 27, 2022
c99008d
trailing whitespaces
sloriot Jul 27, 2022
1c42a61
use traits functor
sloriot Jul 27, 2022
12a627e
expanding from and evaluating on vertices instead of faces
hoskillua Jul 27, 2022
19076d3
Merge remote-tracking branch 'upstream/master' into gsoc2022
hoskillua Jul 27, 2022
1e49d54
Merge remote-tracking branch 'cgal-dev/gsoc2022-ICC-hoskillua' into g…
hoskillua Jul 27, 2022
1a1cfb4
Merge branch 'gsoc2022' of https://github.com/hoskillua/cgal into gso…
hoskillua Jul 27, 2022
4ffd2d2
add missing typename
sloriot Jul 27, 2022
62c91c1
remove trailing whitespaces
sloriot Jul 27, 2022
184fa0c
fix invalid functor name
sloriot Jul 27, 2022
db753ee
Demo improvements + minor fixes
hoskillua Jul 30, 2022
127c878
Use slider radius (after remapping) in curvature computation
hoskillua Jul 30, 2022
22c0859
trailing spaces
hoskillua Jul 30, 2022
9635ec1
minor changes on demo (wip)
hoskillua Jul 31, 2022
765220a
removing the switch from measures functions (for optimization)
hoskillua Jul 31, 2022
870c276
minor fixes (typename, doc)
hoskillua Aug 1, 2022
34b776d
trailing spaces
hoskillua Aug 1, 2022
09cb2b1
some refactoring + implemented the anisotropic formulas function
hoskillua Aug 2, 2022
8309329
Principal Curvatures wip
hoskillua Aug 3, 2022
24edaa2
principal curvatures (yet to decompose MuXY Matrix)
hoskillua Aug 3, 2022
24551e2
principal curvatures completed (but not properly tested)
hoskillua Aug 4, 2022
c4db160
trim whitespaces
hoskillua Aug 4, 2022
85332fe
according to some of the review comments on the pull
hoskillua Aug 5, 2022
7473a3e
Optimizing the expanding functions to compute intersections only once…
hoskillua Aug 8, 2022
36d0fd4
using internal property (SurfMesh) in example
hoskillua Aug 8, 2022
a74e05a
documentation: fixes & improvements
hoskillua Aug 8, 2022
86ac0fc
Documenting Expansion functions
hoskillua Aug 8, 2022
4049979
minor documentation fixes
hoskillua Aug 8, 2022
5fdebfb
Documenting new functions + minor doc fixes
hoskillua Aug 8, 2022
5840eaf
Update interpolated_corrected_curvature_measures.h
hoskillua Aug 9, 2022
2ed69e9
fixing eigen vector definitions
hoskillua Aug 27, 2022
48262af
fixing eigenvector definitions
hoskillua Aug 27, 2022
13b056c
minor fixes + handled zero expansion radius
hoskillua Sep 17, 2022
4f1a5dd
minor demo updates
hoskillua Sep 20, 2022
3d3b2c3
testing init
hoskillua Sep 20, 2022
c7a6651
GroundTruthtests
hoskillua Sep 20, 2022
75c7f83
whitespaces
hoskillua Sep 20, 2022
e0c596d
principal curvatures and directions visualization
hoskillua Sep 25, 2022
4197450
restored compute_normal.h
hoskillua Sep 26, 2022
7118646
typo fix
hoskillua Sep 26, 2022
a1e9345
added principal curvatures plugin to test with cmake
hoskillua Sep 26, 2022
4f76f26
mostly docs and examples, moved utils to internal
hoskillua Oct 4, 2022
bb6d3e4
doc fix
hoskillua Oct 5, 2022
e80a4c8
change ref
sloriot Oct 5, 2022
2cb8906
principle -> principal typo fixed
hoskillua Oct 7, 2022
48fc5ae
dynamic property maps
hoskillua Nov 6, 2022
38c66a6
typo fixes
hoskillua Nov 6, 2022
e848526
Merge remote-tracking branch 'cgal-dev/gsoc2022-ICC-hoskillua' into g…
hoskillua Nov 6, 2022
ce7c2fa
tab to space
hoskillua Nov 6, 2022
daf4afc
Merge remote-tracking branch 'cgal-dev/gsoc2022-ICC-hoskillua' into g…
hoskillua Nov 6, 2022
4295fd4
enum minor fix
hoskillua Nov 6, 2022
aeaf881
minor fix max func
hoskillua Nov 6, 2022
8efd947
doc fixes
hoskillua Nov 7, 2022
af91351
trailing white spaces
hoskillua Nov 7, 2022
f3aee25
dynamic property maps
hoskillua Nov 8, 2022
866287a
minor naming conventions fixes
hoskillua Nov 8, 2022
aff46b6
incomplete (integrating class for combined curvature computations)
hoskillua Nov 9, 2022
2dcb293
compute multiple curvatures at same time + no radius handled
hoskillua Nov 13, 2022
dbd18ed
trailing whitespaces
hoskillua Nov 13, 2022
2ba6628
minor fix
hoskillua Nov 13, 2022
6ca7331
fixes, doc, examples, general cleanup
hoskillua Nov 14, 2022
59c3605
trailing whitespace
hoskillua Nov 14, 2022
b0a82c4
typo fix
hoskillua Nov 14, 2022
25eb94f
force copy fig
sloriot Nov 14, 2022
b56500d
4-space -> 2-space indents
hoskillua Nov 16, 2022
e79e34d
trim trailing whitespaces
hoskillua Nov 16, 2022
400f9de
first draft version for getting the triangulation of a face
sloriot Nov 17, 2022
80e3522
incomplete (single vertex curvature)
hoskillua Nov 18, 2022
716f081
Merge remote-tracking branch 'cgal-fork/gsoc2022' into gsoc2022-ICC-h…
hoskillua Nov 18, 2022
e302b02
Docs: adding bibtex, ack of DGtal, Authors + Renaming vars + minor fix
hoskillua Nov 19, 2022
f35faf6
minor doc fixes and renaming
hoskillua Nov 19, 2022
fe8988b
demo fixes
hoskillua Nov 19, 2022
dd49b0c
demo fixes
hoskillua Nov 19, 2022
d96dca1
Skipping concave n-gons case for now
hoskillua Nov 19, 2022
0ac812b
minor change, position shouldn't be optional
hoskillua Nov 19, 2022
d5a2cf1
fixed an expansion bug
hoskillua Nov 19, 2022
1fd56cd
testing file for implemented functions
hoskillua Nov 19, 2022
2af6465
trailing spaces
hoskillua Nov 19, 2022
f6855fe
single vertex computation
hoskillua Jan 3, 2023
73bde6d
Eigen is needed
sloriot Jan 20, 2023
8af5c62
reference documentation + minor fix
hoskillua Jan 23, 2023
483e8b8
User manual + add example file for 1 vertex curvature
hoskillua Jan 24, 2023
a7cd6a2
trailling whitespaces
hoskillua Jan 24, 2023
f326444
Merge remote-tracking branch 'cgal-fork/gsoc2022' into gsoc2022-ICC-h…
hoskillua Jan 24, 2023
fc943a4
minor doc fixes
hoskillua Jan 24, 2023
ca4e412
minor fix
hoskillua Jan 24, 2023
da3db9a
typo
sloriot Jan 24, 2023
50ba187
fix typename usage
sloriot Jan 24, 2023
69610f6
move function
sloriot Jan 24, 2023
5c682f5
fix warning
sloriot Jan 24, 2023
69c21bc
Merge 'master'
sloriot Jan 24, 2023
999b475
tests (incomplete) + minor typename fix
hoskillua Jan 24, 2023
864eb9b
Merge remote-tracking branch 'cgal-fork/gsoc2022' into gsoc2022-ICC-h…
hoskillua Jan 24, 2023
7303c74
move function + minor func doc fix
hoskillua Jan 24, 2023
f9c21fa
trailling white spaces
hoskillua Jan 24, 2023
92e2264
Update test_interpolated_corrected_curvatures.cpp
hoskillua Jan 24, 2023
6f2f912
minor fix
hoskillua Jan 24, 2023
1294548
avoid macro substitution
sloriot Jan 24, 2023
00cf097
changed the mesh file used in examples
hoskillua Jan 26, 2023
28188b5
Merge remote-tracking branch 'cgal-dev/gsoc2022-ICC-hoskillua' into g…
hoskillua Jan 26, 2023
8d2043d
renaming
hoskillua Jan 28, 2023
4e669b7
conversion warnings
hoskillua Jan 29, 2023
2ccabc9
renaming files
hoskillua Jan 29, 2023
eef0f5f
removed unused parameter
hoskillua Jan 31, 2023
4f4eeea
removing _example suffix (renaming)
hoskillua Jan 31, 2023
bd5d9df
fix
hoskillua Jan 31, 2023
6a7e7d2
fix link
sloriot Jan 31, 2023
1dc1ed4
remove unused variable
sloriot Jan 31, 2023
e71fcd8
removed unused enum
hoskillua Feb 2, 2023
fcbc89b
added comments for clarity
hoskillua Feb 2, 2023
ec43126
remove unused var + minor change
hoskillua Feb 2, 2023
19fd037
Minor API doc edits
dcoeurjo Feb 20, 2023
a601cbc
first pass on the API
sloriot Mar 22, 2023
664aa7c
Merge remote-tracking branch 'cgal/master' into HEAD
sloriot Mar 22, 2023
5ef5d67
do not use pointers
sloriot Mar 22, 2023
7f45977
the mesh does not need to be triangulated
sloriot Mar 22, 2023
661513b
gaussian -> Gaussian
sloriot Mar 22, 2023
556218b
gaussian -> Gaussian in docs and comments
hoskillua Mar 25, 2023
2bc8b1b
user man doc improvements
hoskillua Mar 25, 2023
49c12d9
ref doc fixes
hoskillua Mar 25, 2023
057b6fc
gaussian -> Gaussian in example files
hoskillua Mar 27, 2023
5aa995d
missing dots in ref documentation
hoskillua Mar 27, 2023
2884d8b
using is_zero() & is_negative() for FT variables
hoskillua Mar 27, 2023
4279a73
minor linting changing
hoskillua Mar 27, 2023
33c7f5c
traillling spaces
hoskillua Mar 27, 2023
796d7cc
handled scale dependency and add tests for it
hoskillua Mar 30, 2023
cef23a9
moving captions out of the figure
hoskillua Apr 8, 2023
8393933
minor grammer fixes
hoskillua Apr 8, 2023
f8a9862
incomplete update to user man doc
hoskillua Apr 17, 2023
261eac8
user manual - incomplete
hoskillua Apr 18, 2023
585e79b
add authors from the history section
sloriot Apr 26, 2023
ae5d32b
citing/referencing "corrected curvature measures"
hoskillua May 1, 2023
83bf49b
Computing curvatures mentioned in the outline section (1.3)
hoskillua May 1, 2023
4187e40
(WIP) documentation update
dcoeurjo Aug 23, 2023
a94a733
Merge remote-tracking branch 'upstream/master' into gsoc2022
hoskillua Aug 25, 2023
3779d21
doc that the functions depend on Eigen
sloriot Aug 25, 2023
1db314e
Fixing image
dcoeurjo Aug 25, 2023
c16b155
Removing old image file.
dcoeurjo Aug 25, 2023
4b450a5
Cleaning up not used images
dcoeurjo Aug 25, 2023
28efeb2
integrated curvature vis to display property
hoskillua Aug 27, 2023
46ac0f9
trim whitespaces
hoskillua Aug 27, 2023
167db62
moved bib to cgal_manual.bib & restored geom.bib
hoskillua Sep 6, 2023
72fd73e
Update geom.bib
hoskillua Sep 6, 2023
5ddcf71
fixed order in bib
hoskillua Sep 6, 2023
df0e0ee
implement comments from review
sloriot Oct 9, 2023
dbd706a
remove remaining see also
sloriot Oct 9, 2023
5b67e30
fix demo
sloriot Oct 10, 2023
ffea309
fix the second demo plugin
sloriot Oct 10, 2023
9f9a6f6
Apply suggestions from code review
sloriot Oct 23, 2023
4c315c1
fixes after review
sloriot Nov 13, 2023
724c1f0
remove TODO added in an issue
sloriot Nov 13, 2023
c7be554
update after rebase
sloriot Nov 13, 2023
8518e7d
update changes
sloriot Nov 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ cmake_minimum_required(VERSION 3.1...3.23)
project(Polygon_mesh_processing_Examples)

# CGAL and its components
find_package(CGAL REQUIRED)
find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt5)
sloriot marked this conversation as resolved.
Show resolved Hide resolved

# Boost and its components
find_package(Boost REQUIRED)



if(NOT Boost_FOUND)

message(
Expand Down Expand Up @@ -100,6 +102,14 @@ create_single_source_cgal_program("orientation_pipeline_example.cpp")
#create_single_source_cgal_program( "snapping_example.cpp")
create_single_source_cgal_program("match_faces.cpp")
create_single_source_cgal_program("cc_compatible_orientations.cpp")
create_single_source_cgal_program("interpolated_corrected_curvatures.cpp")

if(CGAL_Qt5_FOUND)

#link it with the required CGAL libraries
target_link_libraries(interpolated_corrected_curvatures PUBLIC CGAL::CGAL_Basic_viewer)

endif()
sloriot marked this conversation as resolved.
Show resolved Hide resolved

if(OpenMesh_FOUND)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#include <CGAL/Surface_mesh.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <iostream>
sloriot marked this conversation as resolved.
Show resolved Hide resolved
#include <unordered_map>
#include <CGAL/property_map.h>
#include <CGAL/Polygon_mesh_processing/IO/polygon_mesh_io.h>
#include <fstream>

#include <boost/graph/graph_traits.hpp>

#include <CGAL/Polygon_mesh_processing/Curvatures/interpolated_corrected_curvature_measures.h>
#include <CGAL/Polygon_mesh_processing/compute_normal.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/Surface_mesh.h>
#include <chrono>
#include <CGAL/Surface_mesh/IO/OFF.h>
#include <CGAL/draw_surface_mesh.h>

namespace PMP = CGAL::Polygon_mesh_processing;

typedef CGAL::Exact_predicates_inexact_constructions_kernel Epic;
sloriot marked this conversation as resolved.
Show resolved Hide resolved
typedef CGAL::Polyhedron_3<Epic> Polyhedron;
typedef CGAL::Surface_mesh<Epic::Point_3> Mesh;
typedef boost::graph_traits<Mesh>::face_descriptor face_descriptor;
typedef boost::graph_traits<Mesh>::vertex_descriptor vertex_descriptor;


int main(int argc, char* argv[])
{
const std::string filename = (argc>1) ? argv[1] : CGAL::data_file_path("small_bunny.obj");

Mesh g1;
if(!CGAL::IO::read_polygon_mesh(filename, g1))
{
std::cerr << "Invalid input file." << std::endl;
return EXIT_FAILURE;
}
std::unordered_map<vertex_descriptor, Epic::Vector_3> vnm_vec;
boost::associative_property_map< std::unordered_map<vertex_descriptor, Epic::Vector_3>> vnm(vnm_vec);

PMP::compute_vertex_normals(g1, vnm);


std::vector<Epic::FT> mu0_map, mu1_map, mu2_map;

mu0_map = PMP::interpolated_corrected_measure_i(g1, PMP::MU0_AREA_MEASURE, CGAL::parameters::vertex_normal_map(vnm));
mu1_map = PMP::interpolated_corrected_measure_i(g1, PMP::MU1_MEAN_CURVATURE_MEASURE, CGAL::parameters::vertex_normal_map(vnm));
mu2_map = PMP::interpolated_corrected_measure_i(g1, PMP::MU2_GAUSSIAN_CURVATURE_MEASURE, CGAL::parameters::vertex_normal_map(vnm));

int n = g1.faces().size();

for (int i = 0; i < n; i++)
{
std::cout << mu0_map[i] << "\n";
}

std::cout << "\n";

for (int i = 0; i < n; i++)
{
std::cout << mu1_map[i] << "\n";
}

std::cout << "\n";

for (int i = 0; i < n; i++)
{
std::cout << mu2_map[i] << "\n";
}


CGAL::draw(g1);
hoskillua marked this conversation as resolved.
Show resolved Hide resolved

return EXIT_SUCCESS;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
#ifndef CGAL_POLYGON_MESH_PROCESSING_INTERPOLATED_CORRECTED_CURVATURE_MEASURES_H
sloriot marked this conversation as resolved.
Show resolved Hide resolved
#define CGAL_POLYGON_MESH_PROCESSING_INTERPOLATED_CORRECTED_CURVATURE_MEASURES_H
#endif

#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <numeric>

#include <CGAL/assertions.h>
#include <CGAL/Named_function_parameters.h>
#include <CGAL/Polygon_mesh_processing/internal/named_params_helper.h>
sloriot marked this conversation as resolved.
Show resolved Hide resolved
#include <CGAL/Polygon_mesh_processing/compute_normal.h>
#include <CGAL/property_map.h>


namespace CGAL {

namespace Polygon_mesh_processing {

typedef Exact_predicates_inexact_constructions_kernel Epic;

// enum to specify which measure is computed
enum Measure_index {
MU0_AREA_MEASURE,
MU1_MEAN_CURVATURE_MEASURE,
MU2_GAUSSIAN_CURVATURE_MEASURE
};

Epic::FT interpolated_mu_i_triangle(const Epic::Vector_3 x0, const Epic::Vector_3 x1, const Epic::Vector_3 x2,
const Epic::Vector_3 u0, const Epic::Vector_3 u1, const Epic::Vector_3 u2, const Measure_index mu_i)
{
Epic::Vector_3 um;
switch (mu_i)
{
case MU0_AREA_MEASURE:

um = (u0 + u1 + u2) / 3.0;

return 0.5 * um * CGAL::cross_product(x1 - x0, x2 - x0);

case MU1_MEAN_CURVATURE_MEASURE:

um = (u0 + u1 + u2) / 3.0;

return 0.5 * um * (CGAL::cross_product(u2 - u1, x0)
+ CGAL::cross_product(u0 - u2, x1)
+ CGAL::cross_product(u1 - u0, x2));

case MU2_GAUSSIAN_CURVATURE_MEASURE:

return 0.5 * u0 * CGAL::cross_product(u1, u2);

default: return 0;
}
}

Epic::FT interpolated_mu_i_quad(const Epic::Vector_3 x0, const Epic::Vector_3 x1, const Epic::Vector_3 x2, const Epic::Vector_3 x3,
const Epic::Vector_3 u0, const Epic::Vector_3 u1, const Epic::Vector_3 u2, const Epic::Vector_3 u3, const Measure_index mu_i)
{
/// x0 _ x1
/// x2 |_| x3

switch (mu_i)
{
case MU0_AREA_MEASURE:

return (1 / 36.0) * ((4 * u0 + 2 * u1 + 2 * u2 + u3) * CGAL::cross_product(x1 - x0, x2 - x0)
+ (2 * u0 + 4 * u1 + u2 + 2 * u3) * CGAL::cross_product(x1 - x0, x3 - x1)
+ (2 * u0 + u1 + 4 * u2 + 2 * u3) * CGAL::cross_product(x3 - x2, x2 - x0)
+ (u0 + 2 * u1 + 2 * u2 + 4 * u3) * CGAL::cross_product(x3 - x2, x3 - x1));

case MU1_MEAN_CURVATURE_MEASURE:
{
const Epic::Vector_3 u03 = u3 - u0;
const Epic::Vector_3 u12 = u2 - u1;
const Epic::Vector_3 x0_cross = CGAL::cross_product(u12, x0);
const Epic::Vector_3 x1_cross = -CGAL::cross_product(u03, x1);
const Epic::Vector_3 x2_cross = CGAL::cross_product(u03, x2);
const Epic::Vector_3 x3_cross = -CGAL::cross_product(u12, x3);


return (1 / 12.0) * (u0 * (2 * x0_cross - CGAL::cross_product((u2 + u3), x1) + CGAL::cross_product((u1 + u3), x2) + x3_cross)
+ u1 * (CGAL::cross_product((u2 + u3), x0) + 2 * x1_cross + x2_cross - CGAL::cross_product((u0 + u2), x3))
+ u2 * (CGAL::cross_product(-(u1 + u3), x0) + x1_cross + 2 * x2_cross + CGAL::cross_product((u0 + u1), x3))
+ u3 * (x0_cross + CGAL::cross_product((u0 + u2), x1) - CGAL::cross_product((u0 + u1), x2) + 2 * x3_cross));
}
case MU2_GAUSSIAN_CURVATURE_MEASURE:

return (1 / 36.0) * ((4 * u0 + 2 * u1 + 2 * u2 + u3) * CGAL::cross_product(u1 - u0, u2 - u0)
+ (2 * u0 + 4 * u1 + u2 + 2 * u3) * CGAL::cross_product(u1 - u0, u3 - u1)
+ (2 * u0 + u1 + 4 * u2 + 2 * u3) * CGAL::cross_product(u3 - u2, u2 - u0)
+ (u0 + 2 * u1 + 2 * u2 + 4 * u3) * CGAL::cross_product(u3 - u2, u3 - u1));

default: return 0;
}
}

Epic::FT interpolated_mu_i_face(const std::vector<Epic::Vector_3>& x, const std::vector<Epic::Vector_3>& u, const Measure_index mu_i)
{
std::size_t n = x.size();
CGAL_precondition(u.size() == n);
CGAL_precondition(n >= 3);

// Triangle: use triangle formulas
if (n == 3)
return interpolated_mu_i_triangle(x[0], x[1], x[2],
u[0], u[1], u[2], mu_i);

// Quad: use bilinear interpolation formulas
else if (n == 4)
/// x[0] _ x[1] ---> x0 _ x1 (reason for changing order)
/// x[3] |_| x[2] ---> x2 |_| x3
return interpolated_mu_i_quad(x[0], x[1], x[3], x[2],
u[0], u[1], u[3], u[2], mu_i);

// N-gon: split into n triangles by barycenter and use triangle formulas for each
else {
Epic::FT mu0 = 0;

// getting barycenter of points
Epic::Vector_3 xm = std::accumulate(x.begin(), x.end(), Epic::Vector_3(0, 0, 0));
xm /= n;

// getting unit average normal of points
Epic::Vector_3 um = std::accumulate(u.begin(), u.end(), Epic::Vector_3(0, 0, 0));
um /= sqrt(um * um);

// summing each triangle's measure after triangulation by barycenter split.
for (std::size_t i = 0; i < n; i++)
{
mu0 += interpolated_mu_i_triangle(x[i], x[(i + 1) % n], xm,
u[i], u[(i + 1) % n], um, mu_i);
}
return mu0;
}
}


/// TODO:
/// 1- Handle if VNM is not given
/// 2- use GT instead of Epic

template<typename PolygonMesh,
typename VertexNormalMap,
typename NamedParameters = parameters::Default_named_parameters>
std::vector<Epic::FT>
interpolated_corrected_measure_i(
const PolygonMesh& pmesh,
const Measure_index mu_i,
VertexNormalMap vnm,
const NamedParameters& np = parameters::default_values())
{
using parameters::choose_parameter;
using parameters::get_parameter;

typedef boost::graph_traits<PolygonMesh>::face_descriptor face_descriptor;
typedef boost::graph_traits<PolygonMesh>::vertex_descriptor vertex_descriptor;
typedef boost::graph_traits<PolygonMesh>::halfedge_descriptor halfedge_descriptor;

typename GetVertexPointMap<PolygonMesh, NamedParameters>::const_type
vpm = choose_parameter(get_parameter(np, CGAL::vertex_point),
get_const_property_map(CGAL::vertex_point, pmesh));

//std::unordered_map<vertex_descriptor, Epic::Vector_3> vnm_init;

//boost::associative_property_map
// <std::unordered_map<boost::graph_traits<PolygonMesh>::vertex_descriptor, Epic::Vector_3>> vnm(vnm_init);

////if (!vnm)
// {
// compute_vertex_normals(pmesh, vnm, np);
//}

std::vector<Epic::FT> mu_i_map;


for (face_descriptor f : faces(pmesh))
{
halfedge_descriptor h_start = pmesh.halfedge(f);
halfedge_descriptor h_iter = h_start;

std::vector<Epic::Vector_3> x;
std::vector<Epic::Vector_3> u;

// looping over vertices in face
do {
vertex_descriptor v = source(h_iter, pmesh);
Epic::Point_3 p = get(vpm, v);
x.push_back(Epic::Vector_3(p.x(),p.y(),p.z()));
u.push_back(get(vnm, v));
h_iter = next(h_iter, pmesh);
} while (h_iter != h_start);


mu_i_map.push_back(interpolated_mu_i_face(x, u, mu_i));
}
return mu_i_map;
}

}
}

Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,4 @@ int main() {
do { std::cout << vc->point() << std::endl;
}while(++vc != done);
}
return 0;
}
return 0;
hoskillua marked this conversation as resolved.
Show resolved Hide resolved