CSG.js notes:
- CAG : any boolean ops converts to CSG and back again !
- sides are very inneficient data structures : there are duplicates of every points! (end of one side, start of next)
- CAG’s could retain api by just providing accessors to underlying data structures
- Vertex vs Vector :
- potentially redundant ? needs more investigating
- “only” has an extra ‘tag’ field nothing more
- methods that can be easily extracted (barely any ‘this’ references, if at all, etc)
- overCutInsideCorners
- used in tests only => good candidate
- getOutlinePaths
- used in tests
- used in examples(user api)
- used in dxf serializer
- used in svg serializer
- toCompactBinary
- used in tests
- used in jscad core
- expandedShell
- used in tests
- main function underlying expand()
- overCutInsideCorners
- dependencies:
- extruder => _toPlanePolygons
- _toPlanePolygons => _toCSGWall
- union => _toCSGWall
- subtract => _toCSGWall
- intersect => _toCSGWall
- Shapes:
- Cylinders:
- RoundedCylinder has no start & end radius specifiable
- RoundedCylinder default resolution is different from other cylinders
- Repeated , complex internal code
- how is cylinderEliptic any different from a standard cylinder ? => can specify 2D radius
- should still be merged
- roundedCylinder has sectorAngle parameter: resolution is NOT adapted to angle size : i.e. small angle seems higher res than high angle
- SCAD-API: cylinderEliptic is not wrapped
- Cylinders:
Higher level operations, closer to 'standard cad':
Revolve feature:
- can 'replace' current rotateExtrude (can only do a full 360 extrude)
- can be emulated with solidFromSlices: (because it can 'close' shapes) ex
function revolve (shape, options = {}) {
const defaults = {
revolveAngle: 90,
resolution: 10
}
const {revolveAngle, resolution} = Object.assign({}, defaults, options)
return shape.solidFromSlices({
numslices: resolution,
loop: false,
callback: function (t, slice) {
return this.rotate([0, 20, 0], [-1, 0, 0], revolveAngle / (resolution - 1) * slice)
}
})
}
Problem: currently it needs 3d polygons (????)
Vector2D and Vector3D... _x,_y,_x attributes to [1,2,3] internal storage