[x3d-public] Report on X3DJSONLD, X3DJSAIL conversion work. PLY STL <-> JSON conversions. Future plans. Program -> DOM
Leonard Daly
Leonard.Daly at realism.com
Wed May 1 18:23:12 PDT 2019
John,
I presume that this is a conversion of X3D content between these various
formats. In which case, how can anything convert to DOM because
1. DOM is a language-neutral interface (see https://www.w3.org/DOM/#what)
2. DOM does not support elements with multiple parents. Each element
can have at most one parent (see second paragraph at
https://dom.spec.whatwg.org/#trees or if you don't want the living
spec then use https://www.w3.org/TR/dom/#trees).
X3D explicitly allows multi-parenting (through the use of DEF/USE). How
does this application resolve the conflict?
Leonard Daly
> X3DJSONLD does the following conversions:
>
> JSON->DOM
>
> DOM->XML (borrowed)
>
> XML->DOM (borrowed)
>
> DOM->JSON
>
> DOM->Java
>
> DOM->Python
>
> DOM->JavaScript
>
> PLY->JSON
>
> STL->JSON
>
> JSON->STL (not done, not always triangles, needs
> someone who wants to do tessellation, or can provide a JavaScript library)
>
> JSON->EXI
>
> EXI->JSON
>
> XD3JSAIL/SourceForge X3D does the following conversions that were
> added by me
>
> JSON->DOM (Java version of X3DJSONLD)
>
> X3DJSAIL->JavaScript
>
> DOM->Python (X3DPSAIL)
>
> DOM->Python (Pure Python—doesn’t do anything)
>
> X3DJSAIL does:
>
> X3DJSAIL->XML
>
> X3DJSAIL->JSON
>
> X3DJSAIL->X3D
>
> X3DJSAIL->ClassicVRML
>
> X3DJSAIL->VRML97
>
> X3DJSAIL->HTML
>
> X3DJSAIL->Java
>
> X3DJSAIL->ModelMetaMarkdown
>
> X3DJSAIL->X3dTidy
>
> X3DJSAIL->X3DOM
>
> X3DJSAIL->X_ITE
>
> X3DJSAIL->Cobweb
>
> X3DJSAIL->EXI
>
> X3DJSAIL->GZIP
>
> X3DJSAIL->ZIP
>
> Don will likely add toFileJavaScript (replacing my work—I think there
> may already be a start on a stylesheet) and toFilePython stylesheet
> conversions to X3DJSAIL. Is that OK, Don?
>
> Probably I will retain maintenance of all JSON->DOM conversions
> (JavaScript, Java, C++, X3DJSAIL, X3DOM, X_ITE). (Don uses a
> stylesheet or strings to generate XML). I am open to developing
> JSON->DOM for other languages and improving the C++ version if people
> are interested. You should be willing to provide example JSON files
> (possibly converted with X3D-Edit). Recommend you use Everit or Ajv
> for JSON Schema validation, if not X3DJSONLD’s validator (based on Ajv).
>
> Ideally I think, Don will take over all serializers, except my
> DOM->JSON serializer. I also use a javascript serializer on my web page.
>
> ================================================================================================================
>
> What X3DJSONLD could provide for X3DJSAIL and X3DPSAIL (JavaScript)
>
> PLY->JSON
>
> STL->JSON
>
> JSON->STL
>
> These conversions are stored under ~/X3DJSONLD/src/main/node:
>
> convertJsonToStl.js
>
> convertPlyToJson.js
>
> convertStlToJson.js
>
> The JSON to STL conversion looks at the following X3D JSON indexes
>
> IndexedFaceSet : function(obj, LDNode) {
>
> Group : function(obj, LDNode) {
>
> Shape : function(obj, LDNode) {
>
> Box : function(obj, LDNode) {
>
> IndexedTriangleSet : function(obj, LDNode) {
>
> IndexedTriangleStripSet : function(obj, LDNode) {
>
> IndexedTriangleFanSet : function(obj, LDNode) {
>
> IndexedLineSet : function(obj, LDNode) {
>
> Normal : function(obj, LDNode) {
>
> Coordinate : function(obj, LDNode) {
>
> Transform : function(obj, LDNode) {
>
> "@scale" : function(obj, LDNode) {
>
> "@rotation" : function(obj, LDNode) {
>
> "@translation" : function(obj, LDNode) {
>
> "@normalPerVertex" : function(obj, LDNode) {
>
> "@size" : function(obj, LDNode) {
>
> "@vector" : function(obj, LDNode) {
>
> "@point" : function(obj, LDNode) {
>
> "@normalIndex" : function(obj, LDNode) {
>
> "@coordIndex" : function(obj, LDNode) {
>
> "@index" : function(obj, LDNode) {
>
> Note: There are no colors or textures.
>
> Note: Sometimes I create more complex polygons than triangles. This
> is not in the STL “specification”
>
> Suggestions for additional shapes to translate are welcome:
>
> Arc2D ArcClose2D Circle2D Disk2D Polyline2D Polypoint2D Rectangle2D
> TriangleSet2D
>
> Cone, Cylinder, ElevationGrid,Extrusion,Sphere,Text,GeoElevationGrid
> (why?),QuadSet,IndexedQuadSet
>
> LineSet PointSet TriangleFanSet TriangleSet TriangleStripSet HAnim
>
> I won’t translate the 2D geometry, I think. I will not translate
> Points or Lines
>
> I don’t yet know how to translate Cone,
> Cylinder,*ElevationGrid,Extrusion,Sphere,Text,HAnim (will the standard
> help?) Help! I can probably handle the other ones. Volunteers are
> welcome! Pull requests are welcome! Suggestions for JavaScript
> libraries accepted.
>
> The ones I can handle, I think are QuadSet, IndexedQuadSet,
> TriangleFanSet, TriangleSet and TriangleStripSet.
>
> Would it be better to take a scenegraph from X3DOM or X_ITE? Is
> there documentation for the scenegraphs?
>
> The STL to JSON creates a single IndexedFaceSet for all polygons found
> in the STL file. No color is handled from the STL file
>
> The PLY to JSON file creates IndexedFaceSets and IndexedLineSets. Any
> more suggestions or PLY files you want translated?
>
> Is there any requirement for JSON -> PLY?
>
> Note: I just discovered https://cadexchanger.com/x3d for X3D to STL
> conversions. Add to X3D resources? I haven’t tried it yet.
> CADExchanger already mentioned here:
> http://www.web3d.org/wiki/index.php/STEP_X3D_Translation#Open_Cascade_and_PythonOCC
>
> Is there any need for STL conversion beyond CADExchanger (And
> others)? I will delete my STL conversions.
>
> For my JSON->DOM converter, should I create a python version.
>
> I believe I will start work (we probably already have) on Java->DOM,
> Python->DOM, C/C#/C++->DOM and JavaScript->DOM transpilers. For people
> who don’t want a full weight of X3DJSAIL or X3DPSAIL. This will be a
> valuable addition to X3DJSAIL, should it choose to accept it. I will
> call it “PRESAIL” for now.
>
>
> _______________________________________________
> x3d-public mailing list
> x3d-public at web3d.org
> http://web3d.org/mailman/listinfo/x3d-public_web3d.org
--
*Leonard Daly*
3D Systems & Cloud Consultant
LA ACM SIGGRAPH Past Chair
President, Daly Realism - /Creating the Future/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20190501/c23007d8/attachment.html>
More information about the x3d-public
mailing list