RELEASE NOTES 0.15.5

New features for working with circles and vertices.

Apr 4, 2024
by Matas Ubarevicius

This time there are a lot of new features making it easier to work with circles, arcs and vertex type shapes. All of the algorithms in this release are open-sourced under MIT and are included in our NPM packages.

The image is a screenshot of one of the bitbybit.dev projects done by using the new version v0.15.5.

New features in action.

Circular Edges

While it was always possible to create circular geometry in bitbybit, it was not always easy to work with them. This release brings a lot of new methods to work with circular edges.

bitbybit.occt.shape.edge.arcThroughTwoPointsAndTangent
Creates an arc edge between two points given the tangent direction for first point.
bitbybit.occt.shape.edge.arcFromCircleAndTwoPoints
Creates an arc edge between two points that are on the circle. Users need to provide the circle and two points.
bitbybit.occt.shape.edge.arcFromCircleAndTwoAngles
Creates an arc edge between two alpha angles on the circle. Users need to provide a circle and two alpha angles.
bitbybit.occt.shape.edge.arcFromCirclePointAndAngle
Creates an arc edge between the point and alpha angles on the circle. Users need to provide a circle, alpha angle and a point.
bitbybit.occt.shape.edge.getCircularEdgesAlongWire
Gets all circular edges along the wire.
bitbybit.occt.shape.edge.getLinearEdgesAlongWire
Gets all linear edges along the wire.
bitbybit.occt.shape.edge.getCircularEdgeCenterPoint
Gets the center point on the circular edge, which can also be an arc.
bitbybit.occt.shape.edge.getCircularEdgeRadius
Gets the radius of the circular edge, which can also be an arc.
bitbybit.occt.shape.edge.getCircularEdgePlaneDirection
gets the direction of the circular edge, which can also be an arc.

Edges From Constraints

It is not always easy to construct geometry without some constraints. This release brings new methods to create few kinds of tangential edges from constraints.

bitbybit.occt.shape.edge.constraintTanLinesFromTwoPtsToCircle
Creates tangential lines towards the circle from two given points. You can optimize the solutions to include the inner and outer parts of the circle.
bitbybit.occt.shape.edge.constraintTanLinesFromPtToCircle
Creates tangential lines towards the circle from one given point. You can optimize the solutions to include the inner and outer parts of the circle.
bitbybit.occt.shape.edge.constraintTanLinesOnTwoCircles
Creates tangential lines between the two circles You can optimize the solutions to include the inner and outer parts of the circle and keep the inner or outer solution lines.

Vertex Shape Type

Vertex is a native shape type in OCCT, which was not exposed in bitbybit till now. bitbybit.occt.shapes.vertex - new category for vertex type shapes of occt. Vertex is basically a point, but it does work as a shape of opencascade, it means you can combine it to composed shapes, apply transformations and do other cool things with it.

bitbybit.occt.shape.vertex.vertexFromPoint
Creates vertex shape from the regular bitbybit point represented by 3 numbers in the array.
bitbybit.occt.shapes.vertex.verticesFromPoints
Creates vertex shapes from the regular bitbybit points array.
bitbybit.occt.shape.edge.getVerticesAsPoints
Gets the vertices from any kind of shape as points. Shapes that are made out of edges have vertices.
bitbybit.occt.shape.edge.verticesToPoints
Transforms vertices to regular bitbybit points represented by 3 numbers in the array.
bitbybit.occt.shape.edge.vertexToPoint
Transforms single vertex shape to bitbybit point represented by 3 numbers in the array.
bitbybit.occt.shape.edge.getVertices
Gets the vertices from any kind of shape as OCCT Vertex shapes.
bitbybit.occt.shape.edge.verticesCompoundFromPoints
Creates single compound shape consisting of multiple vertices.

Wire

Wires can be used to create other wires, we currently implemented one fun method called zig zag wire.

bitbybit.occt.shapes.wire.createZigZagBetweenTwoWires
Creates a zig zag polyline wire between two wires. Each edge on the wires gets divided into given number of segments and those points are joined together into a polyline.

Shape to mesh

Due to exposed vertex type we now need to be able to get vertices of shapes when transforming shapes to meshes in order to render geometry correctly. It was also necessary to update some drawing methods to support new exposed Vertex shape of OCCT geometry kernel.

bitbybit.occt.shapeToMesh
Extended to return vertices as points for visualization purposes.
bitbybit.babylon.material.pbrMetallicRoughness.create
Exposed emissive color property.
bitbybit.draw.drawAnyAsync
Extended to support drawing vertices. Users can choose vertex colour and size. It is also possible to enable or disable the drawing of vertices on the shape.