Giter VIP home page Giter VIP logo

mathics-threejs-backend's People

Contributors

rocky avatar tiagocavalcante avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

mathics-threejs-backend's Issues

Uncaught TypeError: A[e] is undefined

Can you check this error: "Uncaught TypeError: A[e] is undefined":

image

<?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>

A green point for the light source is displayed

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>

image

BTW: what is the ,null at the end of the coords list needed for?

npm packaging warnings

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.

Add tests

@rocky and @mmatera I'd add tests, but it's a graphics library.

I searched a lot and I think the best way to do it is to test each primitive and light alone.
Each test will have a threshold with a blurred image.

What are your thoughts?

Testing `Point` gives very thick points?

I'm just testing Point and it gives very thick points:

image

<?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>

Change the visual regression tests framework

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.

Add some way to show version information

I would be nice if from the outside I could run something and have the package report

  • the version of the package, e.g. 0.3.0
  • the version of three.js that is used.

Ideal might be a command-line program to:

  • dump out version information (backend + threejs) e.g. option --version
  • dump out information as JSON

Add support for smartphones

Currently, if you open a mathics-threejs-backend plot in a smartphone, it is drawn but isn't interactive.

How does lighting with colors work?

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.