mathics3 / mathics-threejs-backend Goto Github PK
View Code? Open in Web Editor NEWMathics 3D Graphics backend using three.js
Home Page: https://mathics3.github.io/mathics-threejs-backend
License: GNU General Public License v3.0
Mathics 3D Graphics backend using three.js
Home Page: https://mathics3.github.io/mathics-threejs-backend
License: GNU General Public License v3.0
Can you check this error: "Uncaught TypeError: A[e] is undefined":
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
"http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" style="width: 100%; height: 100%; margin: 0; padding: 0">
<head>
<meta charset="utf-8">
<title>Graphics3D</title>
<script src="https://cdn.jsdelivr.net/npm/@mathicsorg/mathics-threejs-backend@latest/bundle/index.js"></script>
</head>
<body>
<main id="graphics3d"></main>
<script type="module">
drawGraphics3d(
document.getElementById('graphics3d'),
{
axes: {},
elements: [{type: 'sphere',color: [0.6,0.6,0.6],opacity: 1.0,radius: 1,coords: [[[0.0,0.0,0.0],null]]}],
lighting: [
{
type: 'directional',
color: [1, 1, 1]
}
],
viewpoint: [2,-4,4]
}
);
</script>
</body>
At least with Firefox I see a green point for the light source, but only 4 objects should be displayed?
Graphics3D[{Sphere[], Sphere[{3, 0, 0}], Sphere[{0, 3, 0}],Sphere[{3, 3, 0}]}, Lighting -> {{"Point", Green, {2, 2, 2}}}]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
"http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" style="width: 100%; height: 100%; margin: 0; padding: 0">
<head>
<meta charset="utf-8">
<title>Graphics3D</title>
<script src="https://cdn.jsdelivr.net/npm/@mathicsorg/mathics-threejs-backend@latest/bundle/index.js"></script>
</head>
<body>
<main id="graphics3d"></main>
<script type="module">
drawGraphics3d(
document.getElementById('graphics3d'),{
axes: {},
elements: [{type: 'sphere',color: [1.0, 1.0, 1.0],opacity: 1.0,radius: 1,coords: [[[0.0,0.0,0.0],null]]},{type: 'sphere',color: [1.0, 1.0, 1.0],opacity: 1.0,radius: 1,coords: [[[3.0,0.0,0.0],null]]},{type: 'sphere',color: [1.0, 1.0, 1.0],opacity: 1.0,radius: 1,coords: [[[0.0,3.0,0.0],null]]},{type: 'sphere',color: [1.0, 1.0, 1.0],opacity: 1.0,radius: 1,coords: [[[3.0,3.0,0.0],null]]}],
lighting: [{type: 'point',color: [0.0,1.0,0.0],coords: [[2,2,2],null]}],
viewpoint: [2,-4,4]});
</script>
</body>
BTW: what is the ,null
at the end of the coords list needed for?
Seen in CI buld log for Mathics-Django:
##>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
npm install @mathicsorg/mathics-threejs-backend
##<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
npm WARN mathics-django No repository field.
npm WARN mathics-django No license field.
Consider:
and compare with https://reference.wolfram.com/language/ref/Plot3D.html
Especially because of the low resolution, stretching points without adding more of them, makes the graininess more apparent.
And I think that things that are not cube like should not be made to look cube like.
The config
object should be the 2nd parameter of drawGraphics3d
.
Tubes' path in three.js extends the class Curve
, therefore it is hard to create a tube from a set of points as WL does.
Maybe there is a light in https://discourse.threejs.org/t/profiledcontourgeometry/2330/4, but that uses 2d curves (not 3d ones).
Linked question: https://discourse.threejs.org/t/tube-from-3d-points/29585.
Currently, we are considering that a polygon is coplanar if all of its coordinates are parallel to an axis, this is wrong.
An option to do this the right way is do a linear least squares and check if the distance of each point to the result plane is less than a threshold (this was suggested by mathcounterexamples.net).
I'm just testing Point
and it gives very thick points:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
"http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" style="width: 100%; height: 100%; margin: 0; padding: 0">
<head>
<meta charset="utf-8">
<title>Graphics3D</title>
<script src="/media/js/mathics-threejs-backend.js"></script>
</head>
<body>
<main id="graphics3d"></main>
<script type="module">
drawGraphics3d(
document.getElementById('graphics3d'),
{
axes: {},
elements: [{type: 'point',color: [0.5, 0.5, 0.5],coords: [[[0.0,0.0,1.0],null],[[0.628319,0.587785,0.809017],null],[[1.25664,0.951057,0.309017],null],[[1.88496,0.951057,-0.309017],null],[[2.51327,0.587785,-0.809017],null],[[3.14159,0.0,-1.0],null],[[3.76991,-0.587785,-0.809017],null],[[4.39823,-0.951057,-0.309017],null],[[5.02655,-0.951057,0.309017],null],[[5.65487,-0.587785,0.809017],null],[[6.28319,0.0,1.0],null]],pointSize: 1}],
lighting: [
{
type: 'ambient',
color: [1, 1, 1]
}
],
viewpoint: [2, -4, 4]
}
);
</script>
</body>
Is your feature request related to a problem? Please describe.
The current visual regression tests framework (puppeter) runs differently on each machine
Describe the solution you'd like
Use different tests for scenes with text.
Describe alternatives you've considered
Use another testing framework and/or increasing the error threshold.
The visual regression testing framework that is used currently is BackstopJS, but it has been demonstrated to be hard to install and needs way too big thresholds to pass the tests in different machines.
Another option to consider is Cypress Visual Regression
As @rocky said we should add support to ExpressionJSON.
I just need some examples to see how ExpressionJSON
is with Graphics3D
, maybe @mmatera could help here?
I would be nice if from the outside I could run something and have the package report
Ideal might be a command-line program to:
--version
Hi All,
I am back to investigating Mathics as I have always thought that it had awesome potential.
I just came across the
https://mathics3.github.io/mathics-threejs-backend/
and
https://mathics3.github.io/mathics-threejs-backend/examples
but did not see any example to draw a 3D spiral with number points or anything similar.
could you please help?
Thanks
Currently, if you open a mathics-threejs-backend plot in a smartphone, it is drawn but isn't interactive.
Must I inherit the color from lighting settings to all elements like in this example?
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
"http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" style="width: 100%; height: 100%; margin: 0; padding: 0">
<head>
<meta charset="utf-8">
<title>Graphics3D</title>
<script src="https://cdn.jsdelivr.net/npm/@mathicsorg/mathics-threejs-backend@latest/bundle/index.js"></script>
</head>
<body>
<main id="graphics3d"></main>
<script type="module">
drawGraphics3d(
document.getElementById('graphics3d'),{
axes: {},
elements: [{type: 'sphere',color: [1.0,0.5,0.0],opacity: 0.5,radius: 1,coords: [[[0.0,0.0,0.0],null]]},
{type: 'cuboid',color: [1.0,0.5,0.0],opacity: 0.5,coords: [[[1.0,2.0,-1.0],null],[[2.0,3.0,1.0],null]]},
{type: 'cylinder',color: [1.0,0.5,0.0],opacity: 0.5,coords: [[[3.0,-1.0,0.0],null],[[3.0,-1.0,1.0],null]]}],
lighting: [{type: 'ambient',color: [1.0,0.5,0.0]}],
viewpoint: [2,-4,4]});
</script>
</body>
BTW: you can activate "Discussion" in the Github project settings, so that questions are separated from real issues.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.