Code Monkey home page Code Monkey logo

blender-julia-test's People

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

blender-julia-test's Issues

Julia code returns lists with Blender's numpy

Comparing the returned values of the subdivide() in catmull-clark.jl call under Blender and from regular Python I noticed the following. This is based on the code in test/subdiv.py, which is also stored in test.blend under (text) in the Blender Text Editor.

Python 3.8.5 (command-line)

melis@juggle 20:46:~/concepts/blender-julia-test/test$ python subdiv.py
/usr/lib/python3.8/site-packages/numpy/__init__.py
1.19.1
/home/melis/.local/lib/python3.8/site-packages/julia/__init__.py
0.5.4
Initializing Julia (this might take a moment the first time)...
Done!
(Julia) Building half edges done in 1.533ms
(Julia) Input: 8 vertices, 6 polygons, 12 polygon edges
(Julia) Output: 26 vertices, 24 quads
(Julia) Subdivision done in 21.688ms
<class 'numpy.ndarray'>
[-0.5555556  -0.5555556  -0.5555556  -0.50617284 -0.50617284  0.6049383
 -0.50617284  0.6049383  -0.50617284 -0.4458162   0.5665295   0.5665295
  0.6049383  -0.50617284 -0.50617284  0.5665295  -0.4458162   0.5665295
  0.5665295   0.5665295  -0.4458162   0.5208048   0.52080476  0.52080476
 -1.          0.          0.          0.          1.          0.
  1.          0.          0.          0.         -1.          0.
  0.          0.         -1.          0.          0.          1.
 -0.75       -0.75        0.         -0.75        0.          0.75
 -0.75        0.75        0.         -0.75        0.         -0.75
  0.          0.75        0.75        0.75        0.75        0.
  0.          0.75       -0.75        0.75        0.          0.75
  0.75       -0.75        0.          0.75        0.         -0.75
  0.         -0.75        0.75        0.         -0.75       -0.75      ]
<class 'numpy.ndarray'>
[ 1  5  9 13 17 21 25 29 33 37 41 45 49 53 57 61 65 69 73 77 81 85 89 93]
<class 'numpy.ndarray'>
[4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4]
<class 'numpy.ndarray'>
[15  2 16  9 16  4 17  9 17  3 18  9 18  1 15  9 17  4 19 10 19  8 20 10
 20  7 21 10 21  3 17 10 20  8 22 11 22  6 23 11 23  5 24 11 24  7 20 11
 23  6 25 12 25  2 15 12 15  1 26 12 26  5 23 12 21  7 24 13 24  5 26 13
 26  1 18 13 18  3 21 13 19  4 16 14 16  2 25 14 25  6 22 14 22  8 19 14]

Blender 2.90 (Run script from UI)

/home/melis/software/blender-2.90.0-linux64/2.90/python/lib/python3.7/site-packages/numpy/__init__.py
1.17.5
/home/melis/software/blender-2.90.0-linux64/2.90/python/lib/python3.7/site-packages/julia/__init__.py
0.5.4
Initializing Julia (this might take a moment the first time)...
Done!
(Julia) Building half edges done in 0.018ms
(Julia) Input: 8 vertices, 6 polygons, 12 polygon edges
(Julia) Output: 26 vertices, 24 quads
(Julia) Subdivision done in 0.127ms
<class 'list'>
[-0.5555555820465088, -0.5555555820465088, -0.5555555820465088, -0.5061728358268738, -0.5061728358268738, 0.6049383282661438, -0.5061728358268738, 0.6049383282661438, -0.5061728358268738, -0.44581618905067444, 0.5665295124053955, 0.5665295124053955, 0.6049383282661438, -0.5061728358268738, -0.5061728358268738, 0.5665295124053955, -0.44581618905067444, 0.5665295124053955, 0.5665295124053955, 0.5665295124053955, -0.44581618905067444, 0.5208048224449158, 0.520804762840271, 0.520804762840271, -1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 1.0, -0.75, -0.75, 0.0, -0.75, 0.0, 0.75, -0.75, 0.75, 0.0, -0.75, 0.0, -0.75, 0.0, 0.75, 0.75, 0.75, 0.75, 0.0, 0.0, 0.75, -0.75, 0.75, 0.0, 0.75, 0.75, -0.75, 0.0, 0.75, 0.0, -0.75, 0.0, -0.75, 0.75, 0.0, -0.75, -0.75]
<class 'list'>
[1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93]
<class 'list'>
[4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4]
<class 'list'>
[15, 2, 16, 9, 16, 4, 17, 9, 17, 3, 18, 9, 18, 1, 15, 9, 17, 4, 19, 10, 19, 8, 20, 10, 20, 7, 21, 10, 21, 3, 17, 10, 20, 8, 22, 11, 22, 6, 23, 11, 23, 5, 24, 11, 24, 7, 20, 11, 23, 6, 25, 12, 25, 2, 15, 12, 15, 1, 26, 12, 26, 5, 23, 12, 21, 7, 24, 13, 24, 5, 26, 13, 26, 1, 18, 13, 18, 3, 21, 13, 19, 4, 16, 14, 16, 2, 25, 14, 25, 6, 22, 14, 22, 8, 19, 14]

Summary

Python 3.8.5 (command-line):

  • subdivide() returns a tuple of 4 numpy.ndarray values, as expected
  • NumPy version 1.19.1
  • PyJulia version 0.5.4

Blender 2.90 (UI):

  • subdivide() returns a tuple of 4 lists
  • Python 3.7.7 (as included in Blender)
  • NumPy 1.17.5
  • PyJulia 0.5.4

So the differences are probably caused by a different version for Python and/or NumPy.

Rebuilding PyCall from within Blender ((rebuild pycall) text tab) makes no difference.

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.