Package: pyglut
The module description:pyglut is an module complementary to the pyopengl (The OpenGL implementation for python) module,which will help you on the hard way of the 3D programmation with OpenGL.Which implementing severals utilities for severals usages like:Differents datatypes for Vertex, Color, Vectors, Matrix and Localview management.Utilities function for distances and centers computing, rotations, scaling and translation movemenent and some other.Polygons and polyhedrons generators functions.Predefine 3D polyhedrons objects like the Plato polyhedrons and some other.note:Some usages examples scripts and an the complete module description documentation of the module is provided in addition to the sources files.pyglut datatypes:Datatype ColorColor management class implementing the <type ‘Color’> datatype.The color can be encoded either as unsigned bytes or as floats.And the Color class implement conversion and getting methods.This datatype is build to interact with pyopengl color functions.Datatype VertexVertices management class implementing the <type ‘Vertex’> datatype.Holding the coordinate part x, y and z of an vertice.With a getter method to interact with the pyopengl vertex functions.Datatype VectorVector management class implementing the <type ‘Vector’> datatype.With many vectors operations methods: addition, substraction, multiplication, division and negation.The Vector class implement operation sign placeholder for this operations.And others like: vector length getting, vector normalizing, vertex adding, cross product.Datatype LocalviewAnLocalviewis an object representing either anCamera view.Local axes (X, Y, Z) of an 3D object.An locaview is made from:An localview position vertex, object from typeVertex.which is the position from:The camera.The center from the 3D object.referenced as an attribute named: Localview.pos3 axes, objects from typeVectorRepresenting either:The camera orientation.The own axes from the 3D object.referenced as attributes named: Localview.right, Localview.up, Localview.sight.Datatype MatrixImplement anMatrixclass to processmove,scaling,matrix,vectors,localviewsandvertexoperations.The matrix computing is the heart of the 3D programmation.You can configure the matrix to apply changing to your 3D object with the primary operations:ScalingTranslatingRotationaround the X, Y, Z axes.and others for matrix, vectors, localviews and vertex operations.And finally for replacing or multiply the OpenGL MODELVIEW matrix with the matrix containing the desire settings for views implementing per example.And many others usage…pyglut utilsPrimary Operationsfunctiontranslate(…)Translate an vertice from the given offset in every axes directions from the wanted values.functionscale(…)Scale an vertex from the wanted scaling factor.functionrotate_x(…)Rotate an vertice around the X axe and return the result position vertice.functionrotate_y(…)Rotate an vertice around the Y axe and return the result position vertice.functionrotate_z(…)Rotate an vertice around the Z axe and return the result position vertice.note:You can do the same by using an matrix.Center utilsfunctionget_middle_from_segment(…)Return the middle point of an segment as an object from type Vertex.functionget_center_from_polygon(…)Return the center of an polygon as an object from type Vertex.functionget_center_from_polyhedron(…)Return the center of an polyhedron as an object from type Vertex.Length utilsfunctionget_distance_vertices(…)Return the distance between 2 vertices.functionget_perimeter_from_polygon(…)Return the length of the perimeter an the polygon.functionget_perimeter_from_polyhedron(…)Return the length of the perimeter from an polyhedron.Rotation utilsfunctionrotate_on_xy(…)Function to rotate an vertice around an center in the XY plan from the wanted angle value.functionrotate_on_xz(…)Function to rotate an vertice around an center in the XZ plan from the wanted angle value.functionrotate_on_yz(…)Function to rotate an vertice around an center in the YZ plan from the wanted angle value.Miscellaneous utilsfunctiondiv_segment_into_vertices(…)Return an sequence from vertices between 2 vertices.pyglut generatorsPolygons generatorsfunctiongenerate_polygon_on_xy_radius(…)Generate an polygon in the plan XY with the given settings.functiongenerate_polygon_on_xz_radius(…)Generate an polygon in the plan XZ with the given settings.functiongenerate_polygon_on_yz_radius(…)Generate an polygon in the plan YZ with the given settings.functiongenerate_polygon_on_xy_side_length(…)Generate an polygon in the plan XY with the given settings.functiongenerate_polygon_on_xz_side_length(…)Generate an polygon in the plan XZ with the given settings.functiongenerate_polygon_on_yz_side_length(…)Generate an polygon in the plan YZ with the given settings.note:Thislow-levelfunction does not return an polygon object, but only the Vertex list to build it.Polyhedrons generatorsfunctiongenerate_tetrahedron(…)Generate an tetrahedron in relationship to the given side length.functiongenerate_cube(…)Generate an cube in relationship to the given side length.functiongenerate_octahedron(…)Generate an octahedron from the given side length.functiongenerate_dodecahedron(…)Generate an dodecahedron in relationship to the argument side_length taken as basis for the dodecahedron generation.functiongenerate_icosahedron(…)Generate an icosahedron from the given side length.functiongenerate_fulleren(…)Generate an fulleren from the given side length.functiongenerate_toros(…)Generate an toros in relationship to the given settings.functiongenerate_polyhedron_26_faces(…)Generate an 26 faces polyhedron from the given side length.functiongenerate_polyhedron_32_faces(…)Generate an 32 faces polyhedron from the given side length.note:Thislow-levelfunction does not return an polyhedron object, but only the Vertex list to build it.Spheres generatorsfunctiongenerate_quad_sphere(…)Generate an quads sphere (an sphere with trapeze faces).functiongenerate_trigon_sphere(…)Generate an trigon sphere (an sphere with trigon faces).note:Thislow-levelfunction does not return an sphere object, but only the Vertex list to build it.Predefine polyhedrons objectsPlato polyhedronsClasses:Tetrahedron,Cube,Octahedron,DodecahedronandIcosahedrongenerating objects with the given settings.Implementing following methods:update_pos(matrix)Apply the changes contains in the matrix to the object.display()Display the polyhedron.And setter methods for thelines colors, thefaces color(s), thedisplay mode, theline widthand other settings.Other polyhedrons2 Polyhedrons more available:An26 faces polyhedroncomposed from triangles and quads.An32 faces polyhedroncomposed from triangles and pentagons.Fulleren and torosClasses:Fulleren(an soccer balll likewise polyhedron) andToros(An tires likewise polyhedron) generating objects with the given settings.Implementing following methods:update_pos(matrix)Apply the changes contains in the matrix to the object.display()Display the polyhedron.And setter methods for thelines colors, thefaces color(s), thedisplay mode, theline widthand other settings.SpheresClasses:Quad_SphereandTrigon_Spheregenerating objects with the given settings.Implementing following methods:update_pos(matrix)Apply the changes contains in the matrix to the object.display()Display the polyhedron.And setter methods for thelines colors, thefaces color, thedisplay mode, theline widthand other settings.