Commit 7a10d9c2 authored by Stenger, Florian's avatar Stenger, Florian
Browse files

Merge branch 'stenger-master-patch-57758' into 'master'

meshconv v3.22

See merge request !1
parents 71f9b9f7 84e4f791
Software License for meshconv
Copyright (c) 2008-2020 Technische Universität Dresden
Copyright (c) 2008-2021 Technische Universität Dresden
All rights reserved.
Author: Florian Stenger
......
// Copyright (c) 2008-2020 Technische Universität Dresden
// Copyright (c) 2008-2021 Technische Universität Dresden
// All rights reserved.
// Author: Florian Stenger
// This file is part of meshconv. See also license.txt in the distribution-folder.
......@@ -13,7 +13,9 @@ int main(int argc, char* argv[]){
srand(time(NULL));
string cmdline = "";
for(int i = 1; i < argc; ++i) cmdline += string(argv[i]) + " ";
run(cmdline);
delete_all();
return 0;
}
No preview for this file type
// Copyright (c) 2008-2020 Technische Universität Dresden
// Copyright (c) 2008-2021 Technische Universität Dresden
// All rights reserved.
// Author: Florian Stenger
// This file is part of meshconv. See also license.txt in the distribution-folder.
......@@ -1024,8 +1024,8 @@ void BackGrid::attach_mesh_3d(){
}
}
//if no edge of 'it' intersects the current segment then test whether one of the diagonals of
//the segment intersects 'it'
//if no edge of 'it' intersects the current segment then test whether one of the diagonals
//of the segment intersects 'it'
if(!edge_intersection){
Vertex p, a, b, c;
......
// Copyright (c) 2008-2020 Technische Universität Dresden
// Copyright (c) 2008-2021 Technische Universität Dresden
// All rights reserved.
// Author: Florian Stenger
// This file is part of meshconv. See also license.txt in the distribution-folder.
......
// Copyright (c) 2008-2020 Technische Universität Dresden
// Copyright (c) 2008-2021 Technische Universität Dresden
// All rights reserved.
// Author: Florian Stenger
// This file is part of meshconv. See also license.txt in the distribution-folder.
......@@ -890,28 +890,31 @@ void call_decimate_edge_length(vector<string> &args, bool test){
if(undefined_variable_warning != "") cout << undefined_variable_warning << flush;
check_argument_count_at_least(args, 2);
Mesh *m = lookup_mesh(args[0]);
double min_edge_length = dval(args[1]);
size_t arg_offset = 0;
Mesh *n = lookup_mesh(args[1], /*may_create_new_mesh=*/false, /*no_error=*/true);
if(n != NULL) arg_offset = 1;
double min_edge_length = dval(args[arg_offset + 1]);
double max_feature_angle = 0.0;
if(args.size() >= 3) max_feature_angle = dval(args[2]);
int vec_stop = args.size() - 1, vec_start = 3;
if(args.size() >= arg_offset + 3) max_feature_angle = dval(args[arg_offset + 2]);
int vec_stop = args.size() - 1, vec_start = arg_offset + 3;
double curvature_factor = 1.0;
double cutoff_factor = 0.1;
int min_feature_net_size = 10;
if(args.size() >= 4){
char curv_factor_first = args[3][0];
if(args.size() >= arg_offset + 4){
char curv_factor_first = args[arg_offset + 3][0];
if(curv_factor_first >= '0' && curv_factor_first <= '9'){
++vec_start;
curvature_factor = dval(args[3]);
curvature_factor = dval(args[arg_offset + 3]);
}
}
if(args.size() >= 5){
char cutoff_factor_first = args[4][0];
if(args.size() >= arg_offset + 5){
char cutoff_factor_first = args[arg_offset + 4][0];
if(cutoff_factor_first >= '0' && cutoff_factor_first <= '9'){
++vec_start;
cutoff_factor = dval(args[4]);
cutoff_factor = dval(args[arg_offset + 4]);
}
}
if(args.size() >= 4){
if(args.size() >= arg_offset + 4){
char last_first = args[args.size() - 1][0];
if(last_first >= '0' && last_first <= '9'){
--vec_stop;
......@@ -928,7 +931,9 @@ void call_decimate_edge_length(vector<string> &args, bool test){
decimate_3d(*m, min_edge_length, INT_MAX, 0.0, max_feature_angle, min_feature_net_size,
curvature_factor, cutoff_factor, vecs, el_vecs);
}else if(m->dim_of_world == 2 || m->dim_of_elements == 1){
decimate_2d(*m, min_edge_length, INT_MAX);
Mesh* feature_mesh = (n != NULL)? n : new Mesh();
decimate_2d(*m, *feature_mesh, min_edge_length, INT_MAX, max_feature_angle, vecs, el_vecs);
if(n == NULL) delete feature_mesh;
}else if(m->dim_of_world == 3 || m->dim_of_elements == 1){
error("Decimate is not implemented for meshes composed of line segments in 3D-worlds.");
}else{
......@@ -996,28 +1001,31 @@ void call_decimate_element_count(vector<string> &args, bool test){
if(undefined_variable_warning != "") cout << undefined_variable_warning << flush;
check_argument_count_at_least(args, 2);
Mesh *m = lookup_mesh(args[0]);
int max_elements = ival(args[1]);
size_t arg_offset = 0;
Mesh *n = lookup_mesh(args[1], /*may_create_new_mesh=*/false, /*no_error=*/true);
if(n != NULL) arg_offset = 1;
int max_elements = ival(args[arg_offset + 1]);
double max_feature_angle = 0.0;
if(args.size() >= 3) max_feature_angle = dval(args[2]);
int vec_stop = args.size() - 1, vec_start = 3;
if(args.size() >= arg_offset + 3) max_feature_angle = dval(args[arg_offset + 2]);
int vec_stop = args.size() - 1, vec_start = arg_offset + 3;
double curvature_factor = 1.0;
double cutoff_factor = 0.1;
int min_feature_net_size = 10;
if(args.size() >= 4){
char curv_factor_first = args[3][0];
if(args.size() >= arg_offset + 4){
char curv_factor_first = args[arg_offset + 3][0];
if(curv_factor_first >= '0' && curv_factor_first <= '9'){
++vec_start;
curvature_factor = dval(args[3]);
curvature_factor = dval(args[arg_offset + 3]);
}
}
if(args.size() >= 5){
char cutoff_factor_first = args[4][0];
if(args.size() >= arg_offset + 5){
char cutoff_factor_first = args[arg_offset + 4][0];
if(cutoff_factor_first >= '0' && cutoff_factor_first <= '9'){
++vec_start;
cutoff_factor = dval(args[4]);
cutoff_factor = dval(args[arg_offset + 4]);
}
}
if(args.size() >= 4){
if(args.size() >= arg_offset + 4){
char last_first = args[args.size() - 1][0];
if(last_first >= '0' && last_first <= '9'){
--vec_stop;
......@@ -1034,7 +1042,9 @@ void call_decimate_element_count(vector<string> &args, bool test){
decimate_3d(*m, -1.0, max_elements, 0.0, max_feature_angle, min_feature_net_size,
curvature_factor, cutoff_factor, vecs, el_vecs);
}else if(m->dim_of_world == 2 || m->dim_of_elements == 1){
decimate_2d(*m, -1.0, max_elements);
Mesh* feature_mesh = (n != NULL)? n : new Mesh();
decimate_2d(*m, *feature_mesh, -1.0, max_elements, max_feature_angle, vecs, el_vecs);
if(n == NULL) delete feature_mesh;
}else if(m->dim_of_world == 3 || m->dim_of_elements == 1){
error("Decimate is not implemented for meshes composed of line segments in 3D-worlds.");
}else{
......@@ -1864,6 +1874,33 @@ void call_fit_to_mesh(vector<string> &args, bool test){
}
}
//--------------------< call_fix_general_holes >
void call_fix_general_holes(vector<string> &args, bool test){
string task_description = "fixing general holes";
int prompt_length = task_description.size() + 5;
if(!test){
if(verbosity >= 1){
cout << task_description + fill_dots(prompt_length, task_description_length) << flush;
}
if(undefined_variable_warning != "") cout << undefined_variable_warning << flush;
check_argument_count(args, 1);
Mesh *m = lookup_mesh(args[0]);
if(m->dim_of_world == 3 && m->dim_of_elements == 2){
map<int, vector<pair<int, int> > > holes;
detect_holes(*m, holes);
fix_general_holes(*m, holes);
}else{
error("Fixing general holes is implemented for 3D-surfaces only.");
}
if(verbosity >= 1) cout << "ok" << endl;
}else{
if(task_description_length < prompt_length) task_description_length = prompt_length;
}
}
//--------------------< call_fix_holes >
void call_fix_holes(vector<string> &args, bool test){
string task_description = "fixing holes";
......@@ -2186,14 +2223,38 @@ void call_interpolate_vector(vector<string> &args, bool test){
cout << task_description + fill_dots(prompt_length, task_description_length) << flush;
}
if(undefined_variable_warning != "") cout << undefined_variable_warning << flush;
check_argument_count(args, 4);
check_argument_count(args, 4, 6);
input_mesh = lookup_mesh(args[0]);
output_mesh = lookup_mesh(args[1]);
input_vec = lookup_vector(args[2]);
output_vec = lookup_vector(args[3], true);
double target_box_count = 200000;
bool accurate_interpolation = (input_mesh->dim_of_world == 3
&& input_mesh->dim_of_elements == 3);
if(args.size() == 5){
char c = args[4][0];
if(c >= '0' && c <= '9'){
target_box_count = ival(args[4]);
}else{
if(args[4] == "CLOSEST_VERTEX") accurate_interpolation = false;
else if(args[4] == "ACCURATE") accurate_interpolation = true;
else error("Unknown interpolation-mode " + args[4]);
}
}else if(args.size() == 6){
if(args[4] == "CLOSEST_VERTEX") accurate_interpolation = false;
else if(args[4] == "ACCURATE") accurate_interpolation = true;
else error("Unknown interpolation-mode " + args[4]);
target_box_count = ival(args[5]);
}
if(target_box_count < 1) error("target_box_count has to be positive.");
if(input_mesh->dim_of_world == output_mesh->dim_of_world){
interpolate_vector(*input_vec, *output_vec, *input_mesh, *output_mesh);
if(accurate_interpolation){
interpolate_vector_accurate(*input_vec, *output_vec, *input_mesh, *output_mesh,
target_box_count);
}else{
interpolate_vector_closest_vertex(*input_vec, *output_vec, *input_mesh, *output_mesh);
}
}else{
error("Meshes need to have identical world-dimensions.");
}
......@@ -2970,7 +3031,7 @@ void call_read(vector<string> &args, bool test, int dim, bool add_mesh, bool enf
error("Invalid argument \"" + args[i] + "\"!");
}
}
read_msh_file(args[0], *m, dim, store_boundary_field, physical_indices);
read_msh4_file(args[0], *m, dim, store_boundary_field, physical_indices);
}else if(suffix == "bt2" || suffix == "bt3" || suffix == "bt" ||
suffix == "lm2" || suffix == "lm3" || suffix == "lm"){
RefinementManager *rfm = add_refinement_manager(*m);
......@@ -4020,6 +4081,8 @@ void call_split_edges_element_count(vector<string> &args, bool test){
if((m->dim_of_world == 3 || m->dim_of_world == 2) && m->dim_of_elements == 2){
split_edges_3d(*m, vecs, el_vecs, -1.0, min_element_count);
}else if(m->dim_of_elements == 1){
split_edges_2d(*m, vecs, el_vecs, -1.0, min_element_count);
}else{
error("Invalid dimensionality of input mesh.");
}
......@@ -4051,6 +4114,8 @@ void call_split_edges_max_length(vector<string> &args, bool test){
if((m->dim_of_world == 3 || m->dim_of_world == 2) && m->dim_of_elements == 2){
split_edges_3d(*m, vecs, el_vecs, max_edge_length, INT_MAX);
}else if(m->dim_of_elements == 1){
split_edges_2d(*m, vecs, el_vecs, max_edge_length, INT_MAX);
}else{
error("Invalid dimensionality of input mesh.");
}
......@@ -5495,6 +5560,7 @@ void execute_next_command(string &cmdline, bool test){
else if(srcmd == "file_prefix") call_file_prefix(cmdargs, test);
else if(srcmd == "file_suffix") call_file_suffix(cmdargs, test);
else if(srcmd == "fit_to_mesh") call_fit_to_mesh(cmdargs, test);
else if(srcmd == "fix_general_holes") call_fix_general_holes(cmdargs, test);
else if(srcmd == "fix_holes") call_fix_holes(cmdargs, test);
else if(srcmd == "fix_junctions") call_fix_junctions(cmdargs, test);
else if(srcmd == "fix_quadrangular_holes") call_fix_quadrangular_holes(cmdargs, test);
......
// Copyright (c) 2008-2020 Technische Universität Dresden
// Copyright (c) 2008-2021 Technische Universität Dresden
// All rights reserved.
// Author: Florian Stenger
// This file is part of meshconv. See also license.txt in the distribution-folder.
......
This diff is collapsed.
// Copyright (c) 2008-2020 Technische Universität Dresden
// Copyright (c) 2008-2021 Technische Universität Dresden
// All rights reserved.
// Author: Florian Stenger
// This file is part of meshconv. See also license.txt in the distribution-folder.
......
// Copyright (c) 2008-2020 Technische Universität Dresden
// Copyright (c) 2008-2021 Technische Universität Dresden
// All rights reserved.
// Author: Florian Stenger
// This file is part of meshconv. See also license.txt in the distribution-folder.
......@@ -52,10 +52,22 @@ double solve_determinant4(double x11, double x12, double x13, double x14,
double x21, double x22, double x23, double x24,
double x31, double x32, double x33, double x34,
double x41, double x42, double x43, double x44){
return x11*(x22*x33*x44 + x23*x34*x42 + x24*x32*x43 - x24*x33*x42 - x23*x32*x44 - x22*x34*x43)
-x12*(x21*x33*x44 + x23*x34*x41 + x24*x31*x43 - x24*x33*x41 - x23*x31*x44 - x21*x34*x43)
+x13*(x21*x32*x44 + x22*x34*x41 + x24*x31*x42 - x24*x32*x41 - x22*x31*x44 - x21*x34*x42)
-x14*(x21*x32*x43 + x22*x33*x41 + x23*x31*x42 - x23*x32*x41 - x22*x31*x43 - x21*x33*x42);
return x11 * (x22*x33*x44 + x23*x34*x42 + x24*x32*x43 - x24*x33*x42 - x23*x32*x44 - x22*x34*x43)
- x12 * (x21*x33*x44 + x23*x34*x41 + x24*x31*x43 - x24*x33*x41 - x23*x31*x44 - x21*x34*x43)
+ x13 * (x21*x32*x44 + x22*x34*x41 + x24*x31*x42 - x24*x32*x41 - x22*x31*x44 - x21*x34*x42)
- x14 * (x21*x32*x43 + x22*x33*x41 + x23*x31*x42 - x23*x32*x41 - x22*x31*x43 - x21*x33*x42);
}
//--------------------< solve_special_determinant >
//same as 'solve_determinant4()' but with x14 = x24 = x34 = x44 = 1.0
double solve_special_determinant(double x11, double x12, double x13,
double x21, double x22, double x23,
double x31, double x32, double x33,
double x41, double x42, double x43){
return x11 * (x22*x33 + x23*x42 + x32*x43 - x33*x42 - x23*x32 - x22*x43)
- x12 * (x21*x33 + x23*x41 + x31*x43 - x33*x41 - x23*x31 - x21*x43)
+ x13 * (x21*x32 + x22*x41 + x31*x42 - x32*x41 - x22*x31 - x21*x42)
- (x21*x32*x43 + x22*x33*x41 + x23*x31*x42 - x23*x32*x41 - x22*x31*x43 - x21*x33*x42);
}
// #################
......@@ -318,6 +330,16 @@ double angle_between_vectors_3d(const Vertex &n1, const Vertex &n2){
else return acos(arg) * factor;
}
//--------------------< angle_between_vectors_rad_3d >
double angle_between_vectors_rad_3d(const Vertex &n1, const Vertex &n2){
double arg = (n1[0] * n2[0] + n1[1] * n2[1] + n1[2] * n2[2])
/ sqrt((n1[0] * n1[0] + n1[1] * n1[1] + n1[2] * n1[2])
* (n2[0] * n2[0] + n2[1] * n2[1] + n2[2] * n2[2]));
if(arg >= 1.0) return 0.0;
else if(arg <= -1.0) return pi;
else return acos(arg);
}
//--------------------< normal_vector_3d >
void normal_vector_3d(const Vertex &tri0, const Vertex &tri1, const Vertex &tri2, Vertex &normal){
Vertex p, q;
......@@ -396,18 +418,16 @@ bool degenerate_triangle_3d(const Vertex &tri0, const Vertex &tri1, const Vertex
//--------------------< point_in_tetrahedron_3d >
bool point_in_tetrahedron_3d(const Vertex &p, const Vertex &a, const Vertex &b, const Vertex &c,
const Vertex &d){
double d0, d1, d2, d3, d4;
d0 = solve_determinant4(a[0], a[1], a[2], 1.0, b[0], b[1], b[2], 1.0,
c[0], c[1], c[2], 1.0, d[0], d[1], d[2], 1.0);
d1 = solve_determinant4(p[0], p[1], p[2], 1.0, b[0], b[1], b[2], 1.0,
c[0], c[1], c[2], 1.0, d[0], d[1], d[2], 1.0);
d2 = solve_determinant4(a[0], a[1], a[2], 1.0, p[0], p[1], p[2], 1.0,
c[0], c[1], c[2], 1.0, d[0], d[1], d[2], 1.0);
d3 = solve_determinant4(a[0], a[1], a[2], 1.0, b[0], b[1], b[2], 1.0,
p[0], p[1], p[2], 1.0, d[0], d[1], d[2], 1.0);
d4 = solve_determinant4(a[0], a[1], a[2], 1.0, b[0], b[1], b[2], 1.0,
c[0], c[1], c[2], 1.0, p[0], p[1], p[2], 1.0);
double d0 = solve_special_determinant(a[0], a[1], a[2], b[0], b[1], b[2],
c[0], c[1], c[2], d[0], d[1], d[2]);
double d1 = solve_special_determinant(p[0], p[1], p[2], b[0], b[1], b[2],
c[0], c[1], c[2], d[0], d[1], d[2]);
double d2 = solve_special_determinant(a[0], a[1], a[2], p[0], p[1], p[2],
c[0], c[1], c[2], d[0], d[1], d[2]);
double d3 = solve_special_determinant(a[0], a[1], a[2], b[0], b[1], b[2],
p[0], p[1], p[2], d[0], d[1], d[2]);
double d4 = solve_special_determinant(a[0], a[1], a[2], b[0], b[1], b[2],
c[0], c[1], c[2], p[0], p[1], p[2]);
//original code (does not work! if a determinant is 0.0 the calculated value is +-0.0 ...)
//if(d0 >= 0.0){
......@@ -424,6 +444,53 @@ bool point_in_tetrahedron_3d(const Vertex &p, const Vertex &a, const Vertex &b,
}
}
//--------------------< tetrahedal_interpolation >
double tetrahedal_interpolation(const Vertex &p, const Vertex &a, const Vertex &b, const Vertex &c,
const Vertex &d, const double va, const double vb, const double vc, const double vd){
double d0 = solve_special_determinant(a[0], a[1], a[2], b[0], b[1], b[2],
c[0], c[1], c[2], d[0], d[1], d[2]);
if(abs(d0) < epsilon){
warning("tetrahedal_interpolation: d0 == 0");
return 0.0;
}
double d1 = solve_special_determinant(p[0], p[1], p[2], b[0], b[1], b[2],
c[0], c[1], c[2], d[0], d[1], d[2]);
double d2 = solve_special_determinant(a[0], a[1], a[2], p[0], p[1], p[2],
c[0], c[1], c[2], d[0], d[1], d[2]);
double d3 = solve_special_determinant(a[0], a[1], a[2], b[0], b[1], b[2],
p[0], p[1], p[2], d[0], d[1], d[2]);
double d4 = solve_special_determinant(a[0], a[1], a[2], b[0], b[1], b[2],
c[0], c[1], c[2], p[0], p[1], p[2]);
return (d1 * va + d2 * vb + d3 * vc + d4 * vd) / d0;
}
//--------------------< tetrahedal_interpolation_test >
bool tetrahedal_interpolation_test(const Vertex &p, const Vertex &a, const Vertex &b,
const Vertex &c, const Vertex &d){
double d0 = solve_special_determinant(a[0], a[1], a[2], b[0], b[1], b[2],
c[0], c[1], c[2], d[0], d[1], d[2]);
if(abs(d0) < epsilon){
warning("tetrahedal_interpolation_test: d0 == 0");
return false;
}
double d1 = solve_special_determinant(p[0], p[1], p[2], b[0], b[1], b[2],
c[0], c[1], c[2], d[0], d[1], d[2]);
double d2 = solve_special_determinant(a[0], a[1], a[2], p[0], p[1], p[2],
c[0], c[1], c[2], d[0], d[1], d[2]);
double d3 = solve_special_determinant(a[0], a[1], a[2], b[0], b[1], b[2],
p[0], p[1], p[2], d[0], d[1], d[2]);
double d4 = solve_special_determinant(a[0], a[1], a[2], b[0], b[1], b[2],
c[0], c[1], c[2], p[0], p[1], p[2]);
Vertex new_p = (a * d1 + b * d2 + c * d3 + d * d4) / d0;
if(edge_length_3d(p, new_p) > 1e-7){
warning("tetrahedal_interpolation_test: dist = " + ft(edge_length_3d(p, new_p)));
return false;
}
return true;
}
//--------------------< intersection_line_line_3d >
bool intersection_line_line_3d(const Vertex &p1, const Vertex &p2,
const Vertex &p3, const Vertex &p4){
......@@ -1023,11 +1090,11 @@ double distance_point_line_3d(const Vertex &point, const Vertex &lin0, const Ver
//the normal-vector from 'point' to l is 'v = lin0 + t*g - point' for some t which is determined
// by 'v*g = 0'
t = (-gx * (lin0[0] - point[0]) - gy * (lin0[1] - point[1]) - gz * (lin0[2] - point[2]))
/ (gx * gx + gy * gy + gz * gz);
/ (gx * gx + gy * gy + gz * gz);
//if the orthogonal projection of 'point' onto l is not on the given line segment then one of the
//vertices 'lin0' or 'lin1' is the nearest point to 'point'
if(t<0){
if(t < 0){
//'lin0' is nearest
fx = lin0[0];
fy = lin0[1];
......
// Copyright (c) 2008-2020 Technische Universität Dresden
// Copyright (c) 2008-2021 Technische Universität Dresden
// All rights reserved.
// Author: Florian Stenger
// This file is part of meshconv. See also license.txt in the distribution-folder.
......@@ -792,6 +792,7 @@ string evaluate_expression(const string str, size_t &pos1){
if(str.size() <= pos1){
return "";
}
//! BUG: undefined variables cause termination here!
size_t pos2 = min(str.find('$', pos1), str.find('}', pos1));
if(pos2 == npos) pos2 = str.size();
......@@ -950,7 +951,7 @@ void replace_variables(string &str){
if(pos_c != npos){
size_t pos1 = pos_c + 1;
string result = evaluate_expression(str, pos1);
if(str[pos1 - 1] != '}') error("Invalid expression!");
if(str[pos1 - 1] != '}') error("Invalid expression \"" + str + "\"!");
str.replace(pos_c, pos1 - pos_c, result);
occurrence = true;
}
......
// Copyright (c) 2008-2020 Technische Universität Dresden
// Copyright (c) 2008-2021 Technische Universität Dresden
// All rights reserved.
// Author: Florian Stenger
// This file is part of meshconv. See also license.txt in the distribution-folder.
......
This diff is collapsed.
// Copyright (c) 2008-2020 Technische Universität Dresden
// Copyright (c) 2008-2021 Technische Universität Dresden
// All rights reserved.
// Author: Florian Stenger
// This file is part of meshconv. See also license.txt in the distribution-folder.
......@@ -44,7 +44,7 @@
namespace meshconv{
using namespace std;
#define MESHCONV_VERSION "v3.21"
#define MESHCONV_VERSION "v3.22"
#define DEBUG_COUNT_AMBIGUOUS_RAYS 0
#define DEBUG_REFINE_BACKGRID 0
......@@ -271,6 +271,7 @@ struct Vertex{
Vertex& operator-=(const double f);
Vertex& operator*=(const double f);
Vertex& operator/=(const double f);
double length(){/*$ACL_exclude*/return sqrt(c[0] * c[0] + c[1] * c[1] + c[2] * c[2]);}
friend ostream& operator<<(ostream &os, const Vertex &v){/*$ACL_exclude*/
os << "(" << v.c[0] << ", " << v.c[1] << ", " << v.c[2] << ")"; return os;}
string print(){/*$ACL_exclude*/ return "(" + ft(c[0]) + ", " + ft(c[1]) + ", " + ft(c[2]) + ")";}
......@@ -569,11 +570,6 @@ void execute_next_command(string &cmdline, bool test);
//--------------------< geometry prototypes >
void coordinate_extrema_triangle(Mesh &m, Element &sm, int dimension, double &small_coord,
double &big_coord);
double solve_determinant4(double x11, double x12, double x13, double x14,
double x21, double x22, double x23, double x24,
double x31, double x32, double x33, double x34,
double x41, double x42, double x43, double x44);
bool points_identical_2d(const Vertex &p1, const Vertex &p2);
double edge_length_2d(const Vertex &lin0, const Vertex &lin1);
double angle_between_vectors_2d(const Vertex &n1, const Vertex &n2);
......@@ -591,6 +587,7 @@ double distance_point_line_with_intersection_2d(const Vertex &point, const Verte
bool points_identical_3d(const Vertex &p1, const Vertex &p2);
double edge_length_3d(const Vertex &lin0, const Vertex &lin1);
double angle_between_vectors_3d(const Vertex &n1, const Vertex &n2);
double angle_between_vectors_rad_3d(const Vertex &n1, const Vertex &n2);
void normal_vector_3d(const Vertex &tri0, const Vertex &tri1, const Vertex &tri2, Vertex &normal);
void unit_normal_vector_3d(const Vertex &tri0, const Vertex &tri1, const Vertex &tri2,
Vertex &normal);
......@@ -599,6 +596,10 @@ double triangle_max_edge_length_3d(const Vertex &tri0, const Vertex &tri1, const
bool degenerate_triangle_3d(const Vertex &tri0, const Vertex &tri1, const Vertex &tri2);
bool point_in_tetrahedron_3d(const Vertex &p, const Vertex &a, const Vertex &b, const Vertex &c,
const Vertex &d);
double tetrahedal_interpolation(const Vertex &p, const Vertex &a, const Vertex &b, const Vertex &c,
const Vertex &d, const double va, const double vb, const double vc, const double vd);
bool tetrahedal_interpolation_test(const Vertex &p, const Vertex &a, const Vertex &b,
const Vertex &c, const Vertex &d);
bool intersection_line_line_3d(const Vertex &p1, const Vertex &p2, const Vertex &p3,
const Vertex &p4);
bool intersection_line_line_with_intersection_3d(const Vertex &p1, const Vertex &p2,
......@@ -687,12 +688,15 @@ void eliminate_box_faces(Mesh &m, double tolerance, int *dimensions);
void eliminate_distant_vertices(Mesh &m, DataVector &vec, double tolerance_factor);
void ensure_edge_length_2d(Mesh &m, double size, double angle_threshold, double feature_size);
void ensure_edge_length_3d(Mesh &m, double size, double angle_threshold, double feature_size);
void split_edges_2d(Mesh &m, vector<DataVector*> &vecs, vector<DataVector*> &el_vecs,
double max_edge_length, int min_elements);
void split_edges_3d(Mesh &m, vector<DataVector*> &vecs, vector<DataVector*> &el_vecs,
double max_edge_length, int min_elements);
void eliminate_flat_triangles(Mesh &m, vector<DataVector*> &vecs, double angle_threshold);
void subdivide(Mesh &m, int subdivisions=1);
void decimate_angle_2d(Mesh &m, double feature_angle); //! should be replaced by decimate_2d...
void decimate_2d(Mesh &m, double min_edge_length, int max_elements);
void decimate_angle_2d(Mesh &m, double feature_angle);
void decimate_2d(Mesh &m, Mesh &n, double min_edge_length, int max_elements,
double max_feature_angle, vector<DataVector*> &vecs, vector<DataVector*> &el_vecs);
void decimate_3d(Mesh &m, double min_edge_length, int max_elements, double min_inner_angle,
double max_feature_angle, int min_feature_net_size, double curvature_factor,
double cutoff_factor, vector<DataVector*> &vecs, vector<DataVector*> &el_vecs);
......@@ -705,6 +709,8 @@ void shuffle_vertices(Mesh &m);
void equalize_face_orientations(Mesh &m);
void invert_face_orientations(Mesh &m);
void create_box_tile_mesh(Mesh &m, int size_x, int size_y, int size_z=0);
//!void sample_surface(Mesh &m, int root_edge_v0, int root_edge_v1, double initial_angle); //! obsolete
void repulsion_test(); //! debug
//--------------------< boundary operation prototypes >
void nullify_boundary(Mesh &m);
......@@ -771,8 +777,10 @@ void transform_vector_linear(DataVector &vvec, DataVector &lvec, double emin, do
double vmin=9e100, double vmax=9e100);
void transform_vector_quadratic(DataVector &vvec, DataVector &lvec, double emin,
double emid, double emax, double vmin=9e100, double vmid=9e100, double vmax=9e100);
void interpolate_vector(DataVector &input_vec, DataVector &output_vec,
void interpolate_vector_closest_vertex(DataVector &input_vec, DataVector &output_vec,
Mesh &input_mesh, Mesh &output_mesh);
void interpolate_vector_accurate(DataVector &input_vec, DataVector &output_vec,
Mesh &input_mesh, Mesh &output_mesh, int target_box_count=200000);
void set_vector_in_interval(DataVector &vec, double minv, double maxv, double newv);
void set_vector_inside_box(Mesh &m, DataVector &vec, double x1, double y1, double z1,
double x2, double y2, double z2, double value, bool no_third_dim);
......@@ -811,7 +819,9 @@ void read_dae_file(string file, Mesh &m);
void read_rwx_file(string file, Mesh &m, int skip_objects);
void read_off_file(string file, Mesh &m, int dim_of_world);
void read_cdt_file(string file, Mesh &m, int dim_of_world);
void read_msh_file(string file, Mesh &m, int dim_of_world, bool store_boundary_field=false,
void read_msh2_file(string file, Mesh &m, int dim_of_world, bool store_boundary_field=false,
vector<int> physical_indices=vector<int>());
void read_msh4_file(string file, Mesh &m, int dim_of_world, bool store_boundary_field=false,
vector<int> physical_indices=vector<int>());
#ifdef ARH1_SUPPORT
void read_arh1_file(string file, Mesh &m, vector<DataVector*> &vecs,
......@@ -1030,6 +1040,7 @@ void fix_quadrangular_holes(Mesh &m, map<int, vector<pair<int, int> > > &holes);
void fix_quadrangular_holes(Mesh &m, map<int, vector<pair<int, int> > > &holes,
vector<DataVector*> &el_vecs, map<pair<int, int>,
vector<list<Element>::iterator> > &neighbourhood);
void fix_general_holes(Mesh &m, map<int, vector<pair<int, int> > > &holes);
void output_holes(string file, Mesh &m, map<int, vector<pair<int, int> > > &holes);
void delete_inner_elements(Mesh &m, bool delete_protruding_elements, int lamp_count);
void retriangulate(Mesh &m);
......
// Copyright (c) 2008-2020 Technische Universität Dresden
// Copyright (c) 2008-2021 Technische Universität Dresden