Skip to content

Instantly share code, notes, and snippets.

@miho
Created December 18, 2018 13:12
Show Gist options
  • Save miho/f02b6a5eb3b376a00bfe152033a87faa to your computer and use it in GitHub Desktop.
Save miho/f02b6a5eb3b376a00bfe152033a87faa to your computer and use it in GitHub Desktop.
package eu.mihosoft.vrl.user;
import eu.mihosoft.jcsg.ext.mesh.MeshTools;
import eu.mihosoft.jcsg.CSG;
@ComponentInfo(name="MeshOptimizer", category="Custom")
public class MeshOptimizer implements java.io.Serializable {
private static final long serialVersionUID=1L;
public CSG optimize(
@ParamInfo(name="mesh to optimize", style="default", options="") CSG mesh,
@ParamInfo(name="min edge length" , style="default", options="value=0.25") double minEdgeLength,
@ParamInfo(name="max edge length" , style="default", options="value=1.5") double maxEdgeLength
) {
// perform the optimization
return MeshTools.optimize(
mesh, // csg object to optimize
1e-6, // tolerance
1e-1, // max tolerance
minEdgeLength, // min edge length
maxEdgeLength // max edge length
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment