Skip to content

1.6.2

Latest

Choose a tag to compare

@matas-bitbybit-dev matas-bitbybit-dev released this 13 Nov 20:55
1eec1cd

Release Notes v1.6.2

A small release on top of 1.6.1, about maths and colours in base and the rules of design documents:

  • Five new base functions: mesh.closestPointOnTriangle, math.shortestAngle, math.niceStep,
    color.hslToHex and color.hexToRgba.
  • Seven quaternion methods on transforms, for TypeScript.
  • Three-digit hex colours (#f53) are read by every method that reads a hex colour.
  • A closest-point query that holds on slivers and on triangles whose corners meet.
  • Four rules of design documents exported from @bitbybit-dev/occt.

Upgrading from 1.6.1

Nothing needs changing. Five functions were added and none removed (2,210 in all), and no default changed.
Two outputs differ from 1.6.1:

  • math.roundToDecimals gives 0 for a small negative number that it used to round to -0.
  • A three-digit hex colour is read as its six-digit form (#f53 as #ff5533) where it used to stop
    a script.

Maths

  • math.shortestAngle: the angle a target names that lies nearest a start angle, whole turns set
    aside. It works in degrees, radians or any unit you give a full turn for, and refuses an angle that is
    not finite.
  • math.niceStep: rounds a positive number to a step on the 1, 2, 5 scale (0.1, 0.2, 0.5, 1, 2, 5,
    10 ...), up, down or to the nearest - the sizes a grid, a ruler or a slider reads well in. Each
    step is written from its decimal, so it is exact at every size; a step too large to hold is refused.

Meshes

  • mesh.closestPointOnTriangle: the point of a triangle nearest a given point, with the weight of
    each corner. It drops the point onto the triangle's plane, falls back to the nearest edge, and judges
    flatness relative to the triangle's own size, so a small triangle is measured like a large one, two
    corners that meet give no NaN, and a sliver gives no far point. A point or corner that is not finite
    is refused.
  • The mesh proximity helpers measure to the same closest point.

Colours

  • color.hslToHex: a hex colour from a hue in degrees, wrapped, and a saturation and lightness held
    between 0 and 1.
  • color.hexToRgba: a CSS rgba() colour from a hex colour and an opacity held between 0 and 1.
  • Three-digit hex: color.hexToRgb and every method that reads a hex colour take #f53 as #ff5533.

Transforms

  • Quaternions: quaternionFromAxisAngle, quaternionFromEuler, quaternionToEuler,
    quaternionCombine, quaternionRotateVector, quaternionFromFrame and quaternionToMatrix, all as
    [x, y, z, w]. Euler angles turn about X, then Y, then Z, the order rotationCenterX, Y and Z
    take when applied one after another. Like the rest of transforms, they are part of the TypeScript API
    and are not counted among the functions above.
  • rotationYawPitchRoll builds its matrix through the same helper as the quaternion methods.

Design documents

@bitbybit-dev/occt exports four rules the design-document builder already follows, so an application
that places or edits a design document can ask the kernel instead of restating them:

  • parametersIn: which of a document's parameters a feature, component or configuration reads,
    given the declared names as a set or a map. A unit or a colour under its key names no parameter.
  • faceDefaultDirection: the x direction a frame on a face takes by default - X on a face along Y or
    Z, Y on a face along X, and none on a face that is not square to a world axis.
  • DESIGN_SKETCH_PLANES: the normal and x axis of each base plane (XY, XZ, YZ) a sketch can lie on.
  • designHoleDiameter: the hole a fastener asks for - the clearance for its fit, or the thread's
    nominal diameter when tapped - in the unit asked for.

Tooling and docs

  • The API reference counts 2,210 functions, with the five new ones documented and their examples.
  • Every supported language has the new functions' descriptions.
  • @bitbybit-dev/cad-cloud-sdk: the pipeline types include color.hexToRgba, color.hslToHex,
    math.niceStep and math.shortestAngle, with the corrected colour and maths documentation.
  • The packages' API reports are regenerated, and every package is versioned 1.6.2.

Dependencies

  • No engine or kernel changed: BabylonJS 9.32.0, three.js 0.186.1, PlayCanvas 2.23.3, Manifold 3.5.4,
    JSCAD 2.13.0 and the OCCT kernels of 1.6.1.