Skip to content

Commit 02f3d9f

Browse files
Merge pull request #85 from marshallrdavey/davey/abs-edge-len
direct ideal edge length setting
2 parents a89b18d + 8897010 commit 02f3d9f

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,8 @@ Options:
148148
-o,--output TEXT Output tetmesh OUTPUT in .msh format. (string, optional, default: input_file+postfix+'.msh')
149149
--tag TEXT:FILE Tag input faces for Boolean operation.
150150
--op INT Boolean operation: 0: union, 1: intersection, 2: difference.
151-
-l,--lr FLOAT ideal_edge_length = diag_of_bbox * L. (double, optional, default: 0.05)
151+
-a,--la FLOAT Ideal edge length not scaled by diag_of_bbox. Excludes: --lr. (double, optional)
152+
-l,--lr FLOAT ideal_edge_length = diag_of_bbox * L. Excludes: --la. (double, optional, default: 0.05)
152153
-e,--epsr FLOAT epsilon = diag_of_bbox * EPS. (double, optional, default: 1e-3)
153154
--stop-energy FLOAT Stop optimization when max energy is lower than this.
154155
--log TEXT Log info to given file.

src/Parameters.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ namespace floatTetWild {
6262
Scalar ideal_edge_length_rel = 1 / 20.0;
6363
Scalar min_edge_len_rel = -1;
6464

65+
// initial absolute target edge length not scaled to the box diagonal
66+
Scalar ideal_edge_length_abs = 0.0;
67+
6568
int max_its = 80;
6669
Scalar stop_energy = 10;
6770

@@ -104,7 +107,13 @@ namespace floatTetWild {
104107

105108
bbox_diag_length = bbox_diag_l;
106109

107-
ideal_edge_length = bbox_diag_length * ideal_edge_length_rel;
110+
if (ideal_edge_length_abs > 0.0) {
111+
ideal_edge_length = ideal_edge_length_abs;
112+
ideal_edge_length_rel = ideal_edge_length / bbox_diag_length;
113+
}
114+
else {
115+
ideal_edge_length = bbox_diag_length * ideal_edge_length_rel;
116+
}
108117
ideal_edge_length_2 = ideal_edge_length * ideal_edge_length;
109118

110119
eps_input = bbox_diag_length * eps_rel;

src/main.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,16 @@ int main(int argc, char** argv)
193193
command_line.add_option(
194194
"--op", boolean_op, "Boolean operation: 0: union, 1: intersection, 2: difference.");
195195

196-
command_line.add_option(
196+
auto absolute_op = command_line.add_option(
197+
"-a,--la",
198+
params.ideal_edge_length_abs,
199+
"Ideal edge length not scaled by diag_of_bbox. (double, optional)");
200+
auto relative_op = command_line.add_option(
197201
"-l,--lr",
198202
params.ideal_edge_length_rel,
199203
"ideal_edge_length = diag_of_bbox * L. (double, optional, default: 0.05)");
204+
relative_op->excludes(absolute_op);
205+
200206
command_line.add_option("-e,--epsr",
201207
params.eps_rel,
202208
"epsilon = diag_of_bbox * EPS. (double, optional, default: 1e-3)");

0 commit comments

Comments
 (0)