Skip to content

V2 : odd result of measureArea() #570

Closed
@minatani

Description

@minatani

Expected Behavior

An object with area, bounds and volume is located at the position pointed by translate().

Actual Behavior

In some case, an object's area is disappeared by translate() with certain values.

Steps to Reproduce the Problem

The problem can be reproduced by this script.

// V2

const { cuboid, cylinder } = require('@jscad/modeling').primitives
const { translateX, translateY } = require('@jscad/modeling').transforms
const { subtract } = require('@jscad/modeling').booleans
const { measureArea, measureBounds, measureVolume } = require('@jscad/modeling').measurements

const main = () => {
const plateZ=1;
const len=100;
const holeRad=3;
const holeDis=9.5;
let ret;
let binder=translateX([len/2],
cuboid({size: [len, holeDis, plateZ]}));
for (i=holeDis/2; i <=len-holeDis/2; i+=holeDis ) { // punching loose-leaf notebook's holes
binder=subtract(binder, translateX([i],
cylinder({ startRadius: holeRad, endRadius: holeRad, height: plateZ })));
}
for (y=0; y<=3; y+=0.1) {
ret=translateY([y], binder);
console.log(y pos: ${y}, Area: ${measureArea(ret)}, Bounds: ${measureBounds(ret)}, Volume: ${measureVolume(ret)}\n)
}
return [ ret ]
}

module.exports = { main }

Specifications

  • Version: V2 1b159c0
  • Platform: Debian Stretch, nodejs v9.15.2
  • Environment: cli

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions