Repository navigation
v3.0.0
3.0 is a new API. Code written for 2.0 does not run without changes. Version 2.5 was not
published. Follow MIGRATION.md: it gives every change with code before and after.
Changed
- Breaking: bodies are made with three classes and a kind constant:
new Wire(kind, params),
new Solid(kind, params)andnew Sheet(OG_OPERATION_SWEEP, params). The 2.0 classes
(Cuboid,Cylinder,Polygon,Opening,Sweep,AnalyticSolidand the others) are gone.
See "Replace this with that" in MIGRATION.md. - Breaking: points and vectors are
[x, y, z]arrays.Vector3is gone. - Breaking: bodies move with
body.transform(kind, params)andOG_TRANSFORM_*. Setting
position,rotationorscaleis reverted with aPlacementOverwrittenwarning. - Breaking: start the kernel with
await OpenGeometry.create(input, options)before the first
body.workerURLgoes in the second argument. - Breaking: the 2D region and offset functions are statics of
OpenGeometry, such as
OpenGeometry.booleanRegions2DandOpenGeometry.offsetRingVariable. The offset calls return
CurvedRegion2Dline and arc edges, not{ x, y, z }points. - Breaking:
solid.prepareIfcExchange()isOpenGeometry.exportIfcBody(solid). - Breaking: failures throw
OGErrorwith acode, acall, amessageanddetails. - Breaking:
classifyPointtakes a point in the body's own coordinates and returns
'Inside','Outside','Boundary'or'Unknown'. - Breaking: the shell hollows a solid in place:
solid.operate(OG_OPERATION_SHELL, { thickness }). To keep the first solid, shell
solid.duplicate(). - Breaking: a body is displayed when it is drawn or walked by
updateMatrixWorld. Its new
mesh is installed after the render that draws it, so the next frame shows it. - Breaking: a body's
surfaceandoutlinemeshes havematrixAutoUpdateset tofalse.
Code that writes theirposition,rotation,quaternionorscalemust call
updateMatrix()on that mesh. - The outline leaves out smooth edges, and planar faces average their normals across them, so a
polygon that approximates a curve shades as a curve. The smooth angle is 20° by default; set
appearance.smoothAngleto0for the 2.0 look.
Added
- Solid primitives: cuboid, cylinder, cylinder sector, sphere, cone or frustum, ring torus and
planar polyhedron. Wire primitives: rectangle, circle, polyline, line-and-arc profile and arc.
Each goes on any plane through theplaneoption. - Extrude with holes, from any closed wire, including a line-and-arc profile.
- Sweep along lines and arcs, with one exact bend per arc, into a capped
Solid, an open-ended
Sheet(caps: false), or a closed ring. - Revolve a closed line-and-arc profile a full turn about an axis in its plane.
- Union, subtract and intersect with one to a hundred tool solids in one
operatecall, and a
report of the result withsolid.getReport(). body.rebuild(kind, params)gives a body new parameters in place.body.mirror(plane)rebuilds
it as its reflection.SystemAssemblywith parent and child placement;duplicate()for an independent copy and
instance()for a shared shape.- Marks with
rollbackandrelease, andOpenGeometry.transaction(fn, { dryRun }). - Queries:
getBounds,getBrep,getWorldBrep,faceNormalAt,classifyPoint,measure
(volume and area within a stated error bound) andvalidity. - Display for Three.js: every body is a
THREE.Group, with level of detail that follows the
camera, tessellation in a web worker or inline, picking to a face or an edge with
OpenGeometry.resolveHit,OpenGeometry.settledandOpenGeometry.flush. - Drawing through your own layers:
OpenGeometry.setHostDrawn,OpenGeometry.markDisplayedand
OpenGeometry.hostGroup.OpenGeometry.releaseIdleGeometry()frees cached display meshes. OpenGeometry.exportStepwrites STEP in millimetres or metres with Y or Z up, with an export
report.OpenGeometry.insetCurvedRegion2DandOpenGeometry.offsetCurvedRingVariableinset a
line-and-arc region exactly, with one distance, or one distance per edge.- Solid primitives
OG_PRIMITIVE_SLOT_PRISM,OG_PRIMITIVE_ROUNDED_BOXand
OG_PRIMITIVE_PIPE_SEGMENT, with theirOG_PRIMITIVE_PARAMS_*helpers and the
SlotPrismParams,RoundedBoxParamsandPipeSegmentParamstypes. OG_PRIMITIVE_POLYSOLID: a solid wall of constant width and height along a path of straight
legs and tangent arcs, withjustify'centre','left'or'right', mitred corners and an
open or closed path. A joint where an arc meets a segment at an angle throwsInvalidParameter
that names the joint.OG_PRIMITIVE_PARAMS_POLYSOLIDand the typePolysolidParamsgive it a
type.- Wire primitives
OG_PRIMITIVE_REGULAR_POLYGON,OG_PRIMITIVE_SLOTand
OG_PRIMITIVE_ROUNDED_RECTANGLE, with theirOG_PRIMITIVE_PARAMS_*helpers and the
RegularPolygonParams,SlotParamsandRoundedRectangleParamstypes.
Removed
- Breaking: IFC file text, STL and PDF export, projection, loft, triangulation as a public
call, and curves other than lines, circles, arcs and polylines, such as the elliptical arc.
They have no replacement in 3.0. 3.0 has no spline, no ellipse and no elliptical arc. The
wedge and the 2.0Curveclass are gone too. Build a wedge as a five-face
OG_PRIMITIVE_POLYHEDRON, and a 2.0Curveas anOG_PRIMITIVE_POLYLINEwire through its
points.
Fixed
- A circular hole away from the profile centre extrudes. 2.0 refused some of these.
- Offset corners are exact arcs. 2.0 drew an inside corner as short segments outside the circle.
- A point inside one of two touching solids of a body is
Inside. 2.0 could read it as outside.
Install
npm install opengeometry@3.0.0 three