joostn / OpenJsCad

3D solid CAD using only Javascript
313 stars 127 forks source link

Performance: CSG.Vector3D() #75

Closed z3dev closed 7 years ago

z3dev commented 8 years ago

This is just an observation about CSG.Vector3D(x,y,z)

It seems that this is the work horse of CSG internals, converting from "points", arrays, integers, etc. Although good for usability, this function could be partitioned into smaller functions to improve performance. For example, CSG.Vector3D.fromPoint(point) or CSG.Vector3D.fromObject(object), or CSG.Vector3D.fromCoordiatest(x,y,z), etc.

It looks that CSG.Vector3D.Create(x,y,z) has started this process. I think there's even more improvement possible when the 'type" of the argument is known.

z3dev commented 7 years ago

This issue was moved to jscad/csg.js#24