cg_vertex_denoiser.h (2063B)
1 /* Copyright (C) 2022 Université de Pau et des Pays de l'Adour UPPA 2 * Copyright (C) 2022 CNRS 3 * Copyright (C) 2022 Sorbonne Université 4 * Copyright (C) 2022 Université Paul Sabatier 5 * Copyright (C) 2022 |Meso|Star> (contact@meso-star.com) 6 * 7 * This program is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program. If not, see <http://www.gnu.org/licenses/>. */ 19 20 #ifndef VERTEX_DENOISER_H__ 21 #define VERTEX_DENOISER_H__ 22 23 #include <star/scad.h> 24 25 #include <rsys/rsys.h> 26 27 struct mem_allocator; 28 struct node; 29 struct scpr_polygon; 30 31 struct vertex_denoiser { 32 struct mem_allocator* allocator; 33 double eps, eps2; 34 struct node* root; 35 size_t count, denoised_count; 36 }; 37 38 res_T 39 vertex_denoiser_create 40 (struct mem_allocator* allocator, 41 const double eps, 42 struct vertex_denoiser** denoiser); 43 44 void 45 vertex_denoiser_release 46 (struct vertex_denoiser* denoiser); 47 48 size_t 49 vertex_denoiser_get_count 50 (struct vertex_denoiser* denoiser); 51 52 size_t 53 vertex_denoiser_get_denoised_count 54 (struct vertex_denoiser* denoiser); 55 56 res_T 57 vertex_denoiser_denoise 58 (struct vertex_denoiser* denoiser, 59 const double *in, 60 const size_t count, 61 double *out); /* Can be out==in */ 62 63 res_T 64 denoise_polygon 65 (struct vertex_denoiser* denoiser, 66 struct scpr_polygon* polygon); 67 68 res_T 69 denoise_array 70 (struct vertex_denoiser* denoiser, 71 struct darray_double* array); 72 73 res_T 74 stl_export_denoised_geometry 75 (struct vertex_denoiser* denoiser, 76 struct scad_geometry* geom, 77 const enum scad_normals_orientation orientation, 78 const int binary); 79 80 #endif 81