joostn / OpenJsCad

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

Added JSON Conversions of CSG and CAG #77

Closed z3dev closed 8 years ago

z3dev commented 8 years ago

I've provided the conversions to and from JSON for both CAG and CSG. These functions allow CAG / CAG objects to be instantiated via JSON objects as provided by AJAX or other frameworks.

The TO functions just traverse the CSG / CAG objects and convert the critical pieces to JSON. The FROM functions force prototypes on anonymous objects, which is non-standard but very very fast.

I'll provided some performance numbers later this week, comparing Compact Binary, JSON, and STL conversions.

I also synchronized revisions in OpenJsCad and OpenJSCAD versions. It's critical that all TO functions return BLOBs.

z3dev commented 8 years ago

As mentioned in email, ES6 will not support the direct manipulation of object prototypes. Therefore, these changes will become unusable in the near future.

Closing this pull request.