mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2024-12-29 16:29:40 +00:00
Added shape_compare()
This commit is contained in:
parent
4a37a5dc8e
commit
6798083a11
2 changed files with 37 additions and 1 deletions
36
common.scad
36
common.scad
|
@ -379,5 +379,41 @@ module assert_equal(got, expected, info) {
|
|||
}
|
||||
|
||||
|
||||
// Module: shape_compare()
|
||||
// Usage:
|
||||
// shape_compare([eps]) {test_shape(); expected_shape();}
|
||||
// Description:
|
||||
// Compares two child shapes, returning empty geometry if they are very nearly the same shape and size.
|
||||
// Returns the differential geometry if they are not nearly the same shape and size.
|
||||
// Arguments:
|
||||
// eps = The surface of the two shapes must be within this size of each other. Default: 1/1024
|
||||
module shape_compare(eps=1/1024) {
|
||||
union() {
|
||||
difference() {
|
||||
children(0);
|
||||
if (eps==0) {
|
||||
children(1);
|
||||
} else {
|
||||
minkowski() {
|
||||
children(1);
|
||||
cube(eps, center=true);
|
||||
}
|
||||
}
|
||||
}
|
||||
difference() {
|
||||
children(1);
|
||||
if (eps==0) {
|
||||
children(0);
|
||||
} else {
|
||||
minkowski() {
|
||||
children(0);
|
||||
cube(eps, center=true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// vim: expandtab tabstop=4 shiftwidth=4 softtabstop=4 nowrap
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
BOSL_VERSION = [2,0,397];
|
||||
BOSL_VERSION = [2,0,398];
|
||||
|
||||
|
||||
// Section: BOSL Library Version Functions
|
||||
|
|
Loading…
Reference in a new issue