Added size argument to vnf_validate()

This commit is contained in:
Revar Desmera 2020-03-15 11:20:59 -07:00
parent a4ecbebfe6
commit 93cdbf091d
2 changed files with 6 additions and 5 deletions

View file

@ -8,7 +8,7 @@
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
BOSL_VERSION = [2,0,191]; BOSL_VERSION = [2,0,192];
// Section: BOSL Library Version Functions // Section: BOSL Library Version Functions

View file

@ -349,6 +349,7 @@ module vnf_polyhedron(vnf, convexity=2) {
// - Overlapping coplanar faces. // - Overlapping coplanar faces.
// Arguments: // Arguments:
// vnf = The VNF to validate. // vnf = The VNF to validate.
// size = The width of the lines and diameter of points used to highlight edges and vertices. Module only. Default: 1
// Example: // Example:
// vnf = skin([ // vnf = skin([
// path3d(regular_ngon(n=4, d=100),0), // path3d(regular_ngon(n=4, d=100),0),
@ -422,7 +423,7 @@ function vnf_validate(vnf) =
] ]
) concat(hole_edges, overpop_edges, t_fails, nonplanars, bigfaces); ) concat(hole_edges, overpop_edges, t_fails, nonplanars, bigfaces);
module vnf_validate(vnf) { module vnf_validate(vnf, size=1) {
faults = vnf_validate(vnf); faults = vnf_validate(vnf);
for (fault = faults) { for (fault = faults) {
typ = fault[0]; typ = fault[0];
@ -433,12 +434,12 @@ module vnf_validate(vnf) {
echo(str(typ, " ", err, ": ", msg, " at ", pts)); echo(str(typ, " ", err, ": ", msg, " at ", pts));
color(clr) { color(clr) {
if (len(pts)==2) { if (len(pts)==2) {
stroke(pts, width=2); stroke(pts, width=size);
} else if (len(pts)>2) { } else if (len(pts)>2) {
stroke(pts, width=2, closed=true); stroke(pts, width=size, closed=true);
polyhedron(pts,[[for (i=idx(pts)) i]]); polyhedron(pts,[[for (i=idx(pts)) i]]);
} else { } else {
place_copies(pts) sphere(d=2); place_copies(pts) sphere(d=size);
} }
} }
} }