mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2025-01-01 09:49:45 +00:00
Added regressions and bugfixes for skin.scad
This commit is contained in:
parent
38abe860f9
commit
ba4a35229c
3 changed files with 24 additions and 3 deletions
|
@ -96,10 +96,12 @@ function skin(profiles, closed=false, caps=true, matching="distance") =
|
|||
cp1 = mean(prof1),
|
||||
cp2 = mean(prof2),
|
||||
midpt = (cp1+cp2)/2,
|
||||
n = normalize(cp2-cp1),
|
||||
n1 = plane_normal(plane_from_pointslist(prof1)),
|
||||
n2 = plane_normal(plane_from_pointslist(prof2)),
|
||||
perp = vector_angle(n1,n2)>0.01? vector_axis(n1,n2) : vector_angle(n,UP)>44? vector_axis(n,UP) : vector_axis(n,LEFT),
|
||||
vang = vector_angle(n1,n2),
|
||||
perp = vang>0.01 && vang<179.99? vector_axis(n1,n2) :
|
||||
vector_angle(n1,UP)>44? vector_axis(n1,UP) :
|
||||
vector_axis(n1,LEFT),
|
||||
perp1 = vector_axis(n1,perp),
|
||||
perp2 = vector_axis(n2,perp),
|
||||
poly1 = ccw_polygon(project_plane(prof1, cp1, cp1+perp, cp1+perp1)),
|
||||
|
|
19
tests/test_skin.scad
Normal file
19
tests/test_skin.scad
Normal file
|
@ -0,0 +1,19 @@
|
|||
include <BOSL2/std.scad>
|
||||
include <BOSL2/skin.scad>
|
||||
|
||||
|
||||
module test_skin() {
|
||||
profiles = [
|
||||
[[-100,-100,0], [0,100,0], [100,-100,0]],
|
||||
[[-100,-100,100], [-100,100,100], [100,100,100], [100,-100,100]],
|
||||
];
|
||||
vnf1 = skin(profiles, caps=false, matching="distance");
|
||||
assert(vnf1 == [[[-100,-100,0],[-100,100,100],[-100,-100,100],[0,100,0],[100,100,100],[100,-100,0],[100,-100,100]],[[0,1,2],[0,3,1],[3,4,1],[3,5,4],[5,6,4],[5,2,6],[5,0,2]]]);
|
||||
vnf2 = skin(profiles, caps=true, matching="distance");
|
||||
assert(vnf2 == [[[-100,-100,0],[-100,100,100],[-100,-100,100],[0,100,0],[100,100,100],[100,-100,0],[100,-100,100],[100,-100,0],[0,100,0],[-100,-100,0],[-100,-100,100],[-100,100,100],[100,100,100],[100,-100,100]],[[0,1,2],[0,3,1],[3,4,1],[3,5,4],[5,6,4],[5,2,6],[5,0,2],[7,8,9],[10,11,12],[12,13,10]]]);
|
||||
vnf_polyhedron(vnf2);
|
||||
}
|
||||
test_skin();
|
||||
|
||||
|
||||
// vim: noexpandtab tabstop=4 shiftwidth=4 softtabstop=4 nowrap
|
|
@ -8,7 +8,7 @@
|
|||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
BOSL_VERSION = [2,0,15];
|
||||
BOSL_VERSION = [2,0,16];
|
||||
|
||||
|
||||
// Section: BOSL Library Version Functions
|
||||
|
|
Loading…
Reference in a new issue