This module uses Panda3D to allow for simple rendering in 3D. Panda3D may be downloaded and installed for free from http://www.panda3d.org/.
Basic usage consist of creating Render object and then add some objects to it. Finally, one executes run() function to display graphics. Output window can be controlled with mouse in a standard way: scroll or move mouse with both buttons pressed to zoom, hold left button and move mouse to move up and down, hold right button and move to rotate the view around the origin.
warning: | For now, only one invocation of run() per application is possible. We are working to allow for multiple windows. |
---|---|
warning: | Interface of this submodule may slightly evolve during development. |
The simplest code to render a half-transparent cube with side = 10au at the origin looks like this:
from pydmga import draw
from pydmga.draw import render
from pydmga.draw import assets
r = draw.Render(render.Color.WHITE_OPAQUE)
r.add(draw.Asset(assets.cube, (0.0, 0.0, 0.0), 5.0, render.Color.BLUE_QUARTER))
r.run()
This module grants access to simple models located in models folder. Currently only sphere and cube are supported.
This loads a cube object and return it as an object ready to be attached to renderer by add() function. samle code:
cube = assets.cube(renderer, 0, 0, 0, 10.0)
renderer.add(render.primitive(cube))
This loads a sphere object and return it as an object ready to be attached to renderer by add() function. samle code:
sphere = assets.sphere(renderer, 0, 0, 0, 10.0)
renderer.add(render.primitive(sphere))
warning: | deprecated |
---|
This file defines geometry used to read and write data about balls in 3D, their voronoi diagrams and motion (in time).
Bases: pydmga.draw.geometry.Input
base class for moving voronoi, it allows for navigating through the animation. It’s like interface - for me to not forgot what methods are needed ;)
Bases: pydmga.draw.geometry.Input
Its kind of input that uses multiple files to store information: one file with full description (in this way its wery simple to program
OneFrame - class of one Frame of animation of voronoi diagram
For now its very simple
Bases: pydmga.draw.render.Primitive
this represents a class of all object loaded from external files
creates Panda3D representation that can be attached to render this function is mainly used inside Render class and its derivatives and user not need to worry to call it
predefined colors to use with render
Bases: pydmga.draw.render.Primitive
It allows to create a set of polygons with common points, for example it works perfectly for Voronoi Diagram Cells
creates a whole new side with all new vertices
adds new point to a side
adds all vertices with numbers in number to a current side
stores new vertex with given color
adds many points all in the same color
creates Panda3D representation that can be attached to render this function is mainly used inside Render class and its derivatives and user not need to worry to call it
closes last side and starts new one (new polygon), all subsequent calls to add_side_point will be addressing this newly created side
Bases: pydmga.draw.render.OnSpherePrimitive
this class can draw a collection of great arcs on the given sphere (that is a part of the biggest possible circle on a sphere, which has origin at the origin of a sphere)
adds a collection of fragments of great arcs between given points points should be on the surface of the ball the default behaviour is that it creates a closed curve
adds a single point to this object you can connect them wit connect() function
adds a list of vertices you can connect them wit connect() function
creates Panda3D representation that can be attached to render this function is mainly used inside Render class and its derivatives and user not need to worry to call it
connects given list of indices by set of fragments of great arcs the default behaviour is that it creates a closed curve
Bases: pydmga.draw.render.Primitive
creates Panda3D representation that can be attached to render this function is mainly used inside Render class and its derivatives and user not need to worry to call it
Bases: pydmga.draw.render.Primitive
Bases: pydmga.draw.render.Primitive
creates Panda3D representation that can be attached to render this function is mainly used inside Render class and its derivatives and user not need to worry to call it
Bases: pydmga.draw.render.Primitive
This can be used to render a set of points
adds new vertex with given color and size s
adds many points all in the same color
creates Panda3D representation that can be attached to render this function is mainly used inside Render class and its derivatives and user not need to worry to call it
Bases: object
basic class for all primitives that Render class can handle
each geometry object should overwrite this
Bases: direct.showbase.ShowBase.ShowBase
simple class for rendering things using Panda3D
adds a class of type Primitive to this render object
removes all nodes from render
Bases: pydmga.draw.render.OnSpherePrimitive
this allow to draw part of circles that are the result of intersection of two spheres to define this you need to give three points that lie on the plane defined by two intersecting balls
center = of the circle, the cutting plane from_v = first vertex on arc, should lie on the cutting plane and on the sphere to_t - last vertex on arc, should lie on the cutting plane and on the sphere moreover we require that dist(center, from_v) == dist(center, to_v)
giving other center and distance gives us chance to handle degenerate case when center = origin of sphere
creates Panda3D representation that can be attached to render this function is mainly used inside Render class and its derivatives and user not need to worry to call it
Bases: pydmga.draw.render.Render