Closed z3dev closed 9 years ago
Tx, I'll look into this. not sure I get the performance argument. Do you plan to submit additional bugs so I can look at it when we have them together?
I recommend to permit both: setColor(r,g,b(,a)) and setColor([r,g,b(,a)])
Please address this issue first.
The CSG.Shared object retains an array. So, passing the color specification by array will improve performance. Although, permitting both styles would probably be the best for the users of CSG.js.
@z3dev that's an easy one, can you write a pull request against gh-pages? I'd tend to support the version that's already documented but I'm fine with supporting both for both setColor functions. If I understood you well, I don't believe there's a performance difference in creating an array inside a function call vs inside a function body.
Hello. I don't have a patch for this.
Please correct and let me know when the new version is available.
See https://github.com/joostn/OpenJsCad/pull/66 I'm proposing to use the array syntax from now on, with the previous syntax supported for backwards compatibility, I don't think performance is relevant here.
The newest version of CSG.js has introduced inconsistency in CSG.prototype.setColor(r,g,b,a) and CSG.Polygon.prototype.setColor([r,g,b,a])
As for the correct signature, I suggest supporting setColor([r,g,b,a]) as the provides the best performance, i.e. the array can be stored directly.
We (CSG.js users) can easily convert from r,g,b,a to [r,g,b,a] as well.