Volume and area
body.measure({ deflection? }) returns { volume, area, errorBound, areaErrorBound, deflection }, in the body’s own coordinates. A scale in the placement is not applied.
|volume − exact| ≤ errorBound.|area − exact| ≤ areaErrorBound.- A body with only flat faces measures exactly, within
1e-10of its size. - A smaller
deflectiongives a smaller bound and a slower call. The default is0.01. - A bound is
Infinitywhen a triangle is too coarse to bound.JSON.stringifywrites it asnull.
deflection that is not a positive finite number throws InvalidParameter. A mesh of more than 2 000 000 triangles throws LimitExceeded. The call does not change the document.
Validity
body.validity() returns { valid, closed, bodyType }, and error: { code, message } when the body is not valid.
{ valid: true, closed: true, bodyType: 'Solid' }. closed is true when every shell of a sheet or a solid is closed, and when every wire of a wire body is closed.
Point classification
body.classifyPoint([x, y, z]) says where a point is, in the body’s own coordinates: 'Inside', 'Outside', 'Boundary' or 'Unknown'.
- A point within
1e-8of the surface is'Boundary'. - A body is
'Inside'if any of its solids holds the point. - A wire or a sheet throws
InvalidOperand. - Known limit: on a cylinder, cone or frustum that was mirrored, a point outside the body can read
'Inside'. - For a world point, first call
OpenGeometry.flush(), thenbody.worldToLocal(new THREE.Vector3(x, y, z)).
Other queries
To turn a normal into the world, call
OpenGeometry.flush(), then use new THREE.Vector3(...normal).transformDirection(body.matrixWorld).
