Closed z3dev closed 4 years ago
Examples of offset on paths.
Segments of 0 (chamfer)
Segments of 1 (edges meet at intersection)
Segments of 32 (fillet with with rounded segments)
This is gorgeous @z3dev ! Reviewing asap !
(This is actually from a wood working website.)
For CAG V1, here's what expand() does to a shape with a hole (10x10 square with 5x5 hole). Notice that the hole is getting smaller, not larger.
let obj1 = CAG.rectangle({radius: [10,10]});
obj1 = obj1.subtract(CAG.rectangle({radius: [5,5]}));
let obj2 = obj1.expand(1.0, 8);
For V2, I think the same functionality should be offset. (See expand below)
let obj1 = primitives.square({size: 10})
obj1 = booleans.subtract(obj1, primitives.rectangle({size: [5, 5], center: [0,0]}))
obj1.color = [1,1,0,1] // YELLOW
let obj2 = expansions.offset({delta: 1}, obj1)
obj2.color = [0,1,0,1] // GREEN
For V2, the expand makes the whole shape expand (enlarge), including the holes. Note, this is very simular to scale however scale cannot chamfer corners.
let obj1 = primitives.square({size: 10})
obj1 = booleans.subtract(obj1, primitives.rectangle({size: [5, 5], center: [0,0]}))
obj1.color = [1,1,0,1] // YELLOW
let obj2 = expansions.expand({delta: 1}, obj1)
obj2.color = [0,1,0,1] // GREEN
@kaosat-dev please review the changes to the API again.
Summary:
In addition, poly2 geometry has been created. And, all expansion functions now use poly2 for measureArea and arePointsInside.
@kaosat-dev please merge. :)
WORK IN PROGRESS. DO NOT MERGE.
This pull request adds the expansion functions as a seperate module. The goals are:
Expansions:
expand
Fixes #66
offset
Fixes #75 Fixes #131 Fixes OpenJSCAD #351
Some small changes to math and geometry modulese are included.