GithubHelp home page GithubHelp logo

taoaoxiang / draw_sphere Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 0.0 3.39 MB

License: GNU General Public License v3.0

Python 16.75% Jupyter Notebook 44.37% C++ 21.78% Shell 0.67% Cuda 14.81% Makefile 1.61%

draw_sphere's Introduction

draw_sphere

Let's draw sphere in different ways!

  • Loop #1 Devide-n-Conquer
    • Python
    • C++
  • Recursion #1
    • Python
    • C++
  • Loop #2 Geometry
    • Python
    • C++
  • Loop #3 Brute-Force
    • Python
    • C++
    • CUDA
  • Loop #4 Brute-Force All
    • Python
    • C++
    • CUDA
  • [?] Random Forest Classification
    • [?] Failed
  • [?] Random Forest Regression
    • [?] Failed
  • Others

Loop #1 Devide-n-Conquer

Benchmark performance:

  • Python: 0.087s
  • C++: 0.682s

Total points:

  • Python: 125834
  • C++: 127560

Method:

  1. Iterate Z-axis [0, r], val: c
  2. Iterate X-axis [r, c], val: a
  3. Iterate Y-axis [0, a], val: b
  4. Draw a point (a, b, c) in the red area
  5. Draw a point (b, a, c) in the green area
  6. Draw a point (c, b, a) in the blue area
  7. Iterate 8 octants (+,+,+) to (-,-,-)

Representation (VMD):

alt text


Recursion #1

Benchmark performance:

  • Python: 2.988s
  • C++: 14.581s

Total points:

  • Python: 125858
  • C++: 127752

Method:

  1. Go over the first octant, find a qualified point (a, b, c)
  2. Store the point (a, b, c)
  3. Move the point, one direction at one time
    • (a +/- resolution, b, c)
    • (a, b +/- resolution, c)
    • (a, b, c +/- resolution)
  4. Iterate 8 octants (+,+,+) to (-,-,-)

Note:
If the terminal complains about Segmentation fault (core dumped), modify ulimit in termial with the command below: ulimit -s unlimited

Representation (VMD):

alt text


Loop #2 Geometry

Benchmark performance:

  • Python: 0.088s
  • C++:

Total points:

  • Python: 125858
  • C++:

Method:

  1. Iterate Z-axis [0, r], val: c
  2. Iterate X-axis [r, c], val: a
  3. Get the y-axis coordinate is ~= b, val: b
  4. Draw a point (a, b, c) in the green area
  5. Draw a point (c, b, a) in the green area
  6. Iterate 8 octants (+,+,+) to (-,-,-)

Representation (VMD):

alt text


Loop #3 Brute-Force

Benchmark performance:

  • Python:
  • C++: 0.506s
  • CUDA: 0.490s

Total points:

  • Python:
  • C++: 127856
  • CUDA: 127840

Method:

  1. Generate 1-D array, length: ((N+1) * (N+1) * (N+1))
  2. Iterate the array, mark qualified points in the megenta region
  3. Iterate 8 octants (+,+,+) to (-,-,-)

Representation (VMD):

alt text


Loop #3 Brute-Force All

Benchmark performance:

  • Python:
  • C++: 0.518s
  • CUDA: 0.508s

Total points:

  • Python:
  • C++: 125930
  • CUDA: 125914

Method:

  1. Generate 1-D array, length: ((2N+1) * (2N+1) * (2N+1))
  2. Iterate the array, mark qualified points in the yellow region

Representation (VMD):

alt text


Random Forest Regression

Benchmark performance:

  • Python:

Total points:

  • Python:

Method:

  1. Training on the red dots
  2. Test

Representation (VMD):

alt text

draw_sphere's People

Contributors

taoaoxiang avatar

Watchers

James Cloos avatar tree coder avatar  avatar

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.