JerryI/Mathematica-ThreeJS-graphics-engine

this is a task list for test examples on manual

Closed this issue · 3 comments

Graphics3D[{Blue, Cylinder[], Red, Sphere[{0, 0, 2}], Black, Thick, 
  Dashed, Line[{{-2, 0, 2}, {2, 0, 2}, {0, 0, 4}, {-2, 0, 2}}], 
  Yellow, Polygon[{{-3, -3, -2}, {-3, 3, -2}, {3, 
     3, -2}, {3, -3, -2}}], Green, Opacity[.3], 
  Cuboid[{-2, -2, -2}, {2, 2, -1}]}]

image

Plot3D[Sin[x y], {x, 0, 3}, {y, 0, 3}, ColorFunction -> "Rainbow", 
 Mesh -> None]

works

ParametricPlot3D[{(3 + Cos[v]) Cos[u], (3 + Cos[v]) Sin[u], 
  Sin[v]}, {u, 0, 2 Pi}, {v, 0, 2 Pi}, Mesh -> None]

works

Table[Graphics3D[{Yellow, Opacity[.8], 
   PolyhedronData[p, "GraphicsComplex"]}], {p, {"Dodecahedron", 
   "Icosahedron", "TruncatedIcosahedron"}}]

table doesn't support :)

  • problem
Graphics3D[Polygon[{{0, 0, 0}, {1, 1, 1}, {0, 1, 1}, {1, 0, 0}}]]

image

image


Graphics3D[GraphicsComplex[v,
   Polygon[{{4, 5, 6}, {4, 6, 2}, {4, 2, 1}, {4, 1, 5}, {5, 1, 
     3}, {5, 3, 6}, 
       {3, 1, 2}, {6, 3, 2}}]]]

works


Graphics3D[{Yellow, Sphere[], {Blue, Sphere[{1, 0, 0}]}, 
  Sphere[{2, 0, 0}]}]

works


ContourPlot3D[ 
 Cos[x] Sin[y] + Cos[y] Sin[z] + Cos[z] Sin[x] == 0, {x, -2 \[Pi], 
  2 \[Pi]}, {y, -2 \[Pi], 2 \[Pi]}, {z, -2 \[Pi], 2 \[Pi]}, 
 ContourStyle -> 
  Directive[FaceForm[Orange, Red], Specularity[White, 30]], 
 Mesh -> None]
  • website crashed (maybe adding an option to upload txt file is a better idea.

PlotPoints -> 3

image


SphericalPlot3D[
 1 + Sin[5 \[Phi]]/5, {\[Theta], 0, Pi}, {\[Phi], 0, 2 Pi}, 
 PlotStyle -> Directive[Yellow, Opacity[0.7], Specularity[White, 20]],
  Mesh -> None, PlotPoints -> 30]

works


ChemicalData["Caffeine", "MoleculePlot"] // Export["~/tmp.txt", #//N, "ExpressionJSON"]&
  • not work.

KnotData[{"TorusKnot", {3, 5}}]
  • seems like the code has some problems.
VM98:52930 Uncaught SyntaxError: Expected ',' or ']' after array element in JSON at position 966656
    at JSON.parse (<anonymous>)
    at render (dev.html:124:25)
    at HTMLButtonElement.onclick (dev.html:117:58)
render @ dev.html:124
onclick @ dev.html:117

ExampleData[{"Geometry3D", "Cow"}]

this works, amazing!


Import["ExampleData/747.3ds.gz", "Graphics3D", ImageSize -> Medium]
Import::nffil: File ExampleData/747.3ds.gz not found during Import.

so I can't test it with Wolfram Engine :)


Import["http://www.rcsb.org/pdb/download/downloadFile.do?fileFormat=\
pdb&compression=NO&structureId=1tf6", "PDB", 
 Background -> GrayLevel[0.1], ImageSize -> Medium]
  • not work

Graphics3D[
 Table[With[{p = {i, j, k}/5}, {RGBColor[p], Opacity[.75], 
    Cuboid[p, p + .15]}], {i, 5}, {j, 5}, {k, 5}]]
  • color doesn't work, other works well.

good job! :P

Ive implemented some of them. Now it is very easy to add a new one for the testing.
run

wolframscript -f buildtests.wls

and a lot of .html will pop up. To add a new one

  1. Create a new file .wsp in tests/src/
  2. The template is quite easy
<?wsp
    function = Graphics3D[whatever you want];
    json = ExportFunction[function];
    ""
?>

<?wsp LoadPage["templates/header.wsp",       {title = "GraphicsComplex function"  }] ?>
<?wsp LoadPage["templates/signlepage.wsp",   {data = json}] ?>
<?wsp LoadPage["templates/footer.wsp"] ?>

in a case if the function produces big JSON, replace signlepage with signlepage_nodom.
3. wolframscript -f buildtests.wls
4. it should pop up at the gallery, as well as an on the individual page.

now has test, close this :)