| 178 | let factory = require("../lib/shapeFactory.js"); |
| 179 | |
| 180 | function buildBrick() { |
| 181 | |
| 182 | let nx = 3; |
| 183 | let ny = 6; |
| 184 | let brick24 = factory.makeLegoBrick(fast_occ, nx, ny, "thick"); |
| 185 | |
| 186 | brick24.numFaces.should.be.greaterThan(40); |
| 187 | |
| 188 | // now check with bounding box |
| 189 | let bbox = brick24.getBoundingBox(); |
| 190 | |
| 191 | let eps = 0.01; |
| 192 | bbox.nearPt.x.should.be.within(0-eps,0+eps); |
| 193 | bbox.nearPt.y.should.be.within(0-eps,0+eps); |
| 194 | bbox.nearPt.z.should.be.within(0-eps,0+eps); |
| 195 | |
| 196 | bbox.farPt.x.should.be.within(nx * 8 - eps, nx * 8 + eps); |
| 197 | bbox.farPt.y.should.be.within(ny * 8 - eps, ny * 8 + eps); |
| 198 | bbox.farPt.z.should.be.within(11.2-eps,11.2+eps); |
| 199 | } |
| 200 | |
| 201 | let c1 = startChronometer(); |
| 202 | buildBrick(); |