|
2 | 2 | ## Interactive canvas for editing 3D geometry, using only matplotlib.pyplot
|
3 | 3 |
|
4 | 4 | ### What is it?
|
5 |
| -XYZ_canvas provides the starting point to create Python code that allows defining and editing points in 3D space, using only Matplotlib and just over 200 lines of library in canvas.py. |
| 5 | +**XYZ_canvas provides the starting point to create Python code that allows defining and editing objects in 3D space, using only Matplotlib and just over 200 lines of library in canvas.py.** |
6 | 6 |
|
7 |
| - |
| 7 | +This library provides you with the 3D co-ordinates of points clicked on and moved to / over, so that you can create your own code to process the points created. You can reach down into the definitions made in canvas.py to manipulate what's created during use, e.g. delete all the points as shown in the customisation example. |
| 8 | + |
| 9 | + |
8 | 10 |
|
9 | 11 | ### How can I use it?
|
10 |
| -The demo.py program shows how simple it is to instantiate the canvas: |
11 |
| -``` |
12 |
| -demo_3D_builder = define_points(on_complete_cb = on_complete, |
13 |
| - xlim =[0,10], ylim =[-20,30], zlim=[-3,5], |
14 |
| - xlabel="x", ylabel="y", zlabel="z") |
| 12 | +The "demo_V1.1.0_minimal.py" program shows how simple it is to instantiate the canvas: |
15 | 13 | ```
|
16 |
| -The 'on_complete_cb' function specified is called when the save button is pressed, and the list of 3D points created is passed to it. |
| 14 | +from xyz_canvas.canvas import xyz_canvas |
| 15 | +
|
| 16 | +#instantiating the canvas: |
| 17 | +demo = xyz_canvas( xlim =[0,1], ylim =[0,1], zlim=[0,1], |
| 18 | + xlabel="x", ylabel="y", zlabel="z" |
| 19 | + ) |
| 20 | +
|
| 21 | +# showing the plot |
| 22 | +demo.plt.show() |
17 | 23 |
|
18 |
| -There are two ways to use this library: |
19 |
| -1) Modify it for your own needs, by editing the code in canvas.py |
20 |
| -2) Incorporate it into your own code by processing the points that it returns - by building on the code in demo.py. For example, your code could take the returned points to define a polygon which you could then display in 3D. |
| 24 | +# note that this is so minimal that all it does is display; |
| 25 | +# the resulting points are not used here. |
| 26 | +
|
| 27 | +print("Demo finished ...") |
| 28 | +
|
| 29 | +``` |
| 30 | +If you want to do things with the points created, look in "demo_V1.1.0_with_customisation.py". Here you'll see examples of customising the colour scheme and reacting to mouse clicks and mouse moves. |
21 | 31 |
|
22 | 32 | ## Installation
|
23 | 33 | Install with pip:
|
|
0 commit comments