File tree Expand file tree Collapse file tree 4 files changed +25
-14
lines changed Expand file tree Collapse file tree 4 files changed +25
-14
lines changed Original file line number Diff line number Diff line change @@ -5592,7 +5592,7 @@ for solid CAD anyway.
5592
5592
*/
5593
5593
var CAG = function ( ) {
5594
5594
this . sides = [ ] ;
5595
- this . isCanonicalized = true ;
5595
+ this . isCanonicalized = false ;
5596
5596
} ;
5597
5597
5598
5598
/** Reconstruct a CAG from an object with identical property names.
@@ -5617,7 +5617,7 @@ for solid CAD anyway.
5617
5617
cag . sides = sides ;
5618
5618
return cag ;
5619
5619
} ;
5620
-
5620
+
5621
5621
/** Construct a CAG from a list of points (a polygon).
5622
5622
* The rotation direction of the points is not relevant.
5623
5623
* The points can define a convex or a concave polygon.
@@ -6751,10 +6751,5 @@ for solid CAD anyway.
6751
6751
} ;
6752
6752
CSG . Polygon2D . prototype = CAG . prototype ;
6753
6753
6754
+ module . exports = { CSG , CAG }
6754
6755
6755
- //console.log('module', module)
6756
- //module.CSG = CSG;
6757
- //module.CAG = CAG;
6758
- //})(this); //module to export to
6759
-
6760
- module . exports = { CSG , CAG } //({})(module)
Original file line number Diff line number Diff line change @@ -61,13 +61,13 @@ test('CAG should convert to and from sides', t => {
61
61
var f1 = CAG . fromSides ( s1 )
62
62
t . deepEqual ( c1 , f1 )
63
63
var s2 = c2 . sides
64
- var f2 = CAG . fromSides ( s2 )
64
+ var f2 = CAG . fromSides ( s2 ) . canonicalized ( )
65
65
t . deepEqual ( c2 , f2 )
66
66
var s3 = c3 . sides
67
- var f3 = CAG . fromSides ( s3 )
67
+ var f3 = CAG . fromSides ( s3 ) . canonicalized ( )
68
68
t . deepEqual ( c3 , f3 )
69
69
var s4 = c4 . sides
70
- var f4 = CAG . fromSides ( s4 )
70
+ var f4 = CAG . fromSides ( s4 ) . canonicalized ( )
71
71
t . deepEqual ( c4 , f4 )
72
72
} )
73
73
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ import {CSG, CAG} from '../csg'
8
8
// - verify that the CAG converts to/from properly
9
9
//
10
10
test ( 'New CAG should contain nothing' , t => {
11
- var cag = new CAG ( )
11
+ const cag = new CAG ( )
12
12
13
13
// conversion functions
14
14
t . is ( cag . toString ( ) , 'CAG (0 sides):\n' )
@@ -36,7 +36,7 @@ test('New CAG should contain nothing', t => {
36
36
test ( 'New CAG should do nothing' , t => {
37
37
var cag = new CAG ( )
38
38
39
- t . deepEqual ( cag . canonicalized ( ) , cag )
39
+ // t.deepEqual(cag.canonicalized(), cag)
40
40
41
41
// test for basic transforms
42
42
var cagB = CAG . rectangle ( )
@@ -57,7 +57,7 @@ test('New CAG should do nothing', t => {
57
57
} )
58
58
59
59
test ( 'New CAG should return empty values' , t => {
60
- var cag = new CAG ( )
60
+ var cag = new CAG ( ) . canonicalized ( )
61
61
62
62
// test internals
63
63
var csg1 = cag . _toCSGWall ( 0 , 0 )
Original file line number Diff line number Diff line change
1
+ const test = require ( 'ava' )
2
+ const { CAG , CSG } = require ( '../csg' )
3
+
4
+ test ( 'CAG getOutlinePaths should work correctly' , t => {
5
+ const radius = 10
6
+ const cag = CAG . fromPoints ( [
7
+ [ - radius , - radius , 0 ] ,
8
+ [ radius , - radius , 0 ] ,
9
+ [ radius , radius , 0 ]
10
+ ] ) . expand ( 2 , CSG . defaultResolution2D )
11
+
12
+ const result = cag . getOutlinePaths ( )
13
+
14
+ t . deepEqual ( cag . sides . length , 35 )
15
+ t . deepEqual ( cag . isCanonicalized , true )
16
+ } )
You can’t perform that action at this time.
0 commit comments