This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

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 Color

Color 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 Vertex

Vertices 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 Vector

Vector 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 Localview

An Localview is an object representing either an

  • Camera view.
  • Local axes (X, Y, Z) of an 3D object.

An locaview is made from:

  • An localview position vertex, object from type Vertex.

    which is the position from:

    • The camera.
    • The center from the 3D object.

referenced as an attribute named: Localview.pos

  • 3 axes, objects from type Vector Representing either:

    • The camera orientation.
    • The own axes from the 3D object.

referenced as attributes named: Localview.right, Localview.up, Localview.sight.

Datatype Matrix

Implement an Matrix class to process move, scaling, matrix, vectors, localviews and vertex operations.

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:

  • Scaling
  • Translating
  • Rotation around 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 utils

Primary Operations

  • function translate(…)

    Translate an vertice from the given offset in every axes directions from the wanted values.

  • function scale(…)

    Scale an vertex from the wanted scaling factor.

  • function rotate_x(…)

    Rotate an vertice around the X axe and return the result position vertice.

  • function rotate_y(…)

    Rotate an vertice around the Y axe and return the result position vertice.

  • function rotate_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 utils

  • function get_middle_from_segment(…)

    Return the middle point of an segment as an object from type Vertex.

  • function get_center_from_polygon(…)

    Return the center of an polygon as an object from type Vertex.

  • function get_center_from_polyhedron(…)

    Return the center of an polyhedron as an object from type Vertex.

Length utils

  • function get_distance_vertices(…)

    Return the distance between 2 vertices.

  • function get_perimeter_from_polygon(…)

    Return the length of the perimeter an the polygon.

  • function get_perimeter_from_polyhedron(…)

    Return the length of the perimeter from an polyhedron.

Rotation utils

  • function rotate_on_xy(…)

    Function to rotate an vertice around an center in the XY plan from the wanted angle value.

  • function rotate_on_xz(…)

    Function to rotate an vertice around an center in the XZ plan from the wanted angle value.

  • function rotate_on_yz(…)

    Function to rotate an vertice around an center in the YZ plan from the wanted angle value.

Miscellaneous utils

  • function div_segment_into_vertices(…)

    Return an sequence from vertices between 2 vertices.

pyglut generators

Polygons generators

  • function generate_polygon_on_xy_radius(…)

    Generate an polygon in the plan XY with the given settings.

  • function generate_polygon_on_xz_radius(…)

    Generate an polygon in the plan XZ with the given settings.

  • function generate_polygon_on_yz_radius(…)

    Generate an polygon in the plan YZ with the given settings.

  • function generate_polygon_on_xy_side_length(…)

    Generate an polygon in the plan XY with the given settings.

  • function generate_polygon_on_xz_side_length(…)

    Generate an polygon in the plan XZ with the given settings.

  • function generate_polygon_on_yz_side_length(…)

    Generate an polygon in the plan YZ with the given settings.

note:This low-level function does not return an polygon object, but only the Vertex list to build it.

Polyhedrons generators

  • function generate_tetrahedron(…)

    Generate an tetrahedron in relationship to the given side length.

  • function generate_cube(…)

    Generate an cube in relationship to the given side length.

  • function generate_octahedron(…)

    Generate an octahedron from the given side length.

  • function generate_dodecahedron(…)

    Generate an dodecahedron in relationship to the argument side_length taken as basis for the dodecahedron generation.

  • function generate_icosahedron(…)

    Generate an icosahedron from the given side length.

  • function generate_fulleren(…)

    Generate an fulleren from the given side length.

  • function generate_toros(…)

    Generate an toros in relationship to the given settings.

  • function generate_polyhedron_26_faces(…)

    Generate an 26 faces polyhedron from the given side length.

  • function generate_polyhedron_32_faces(…)

    Generate an 32 faces polyhedron from the given side length.

note:This low-level function does not return an polyhedron object, but only the Vertex list to build it.

Spheres generators

  • function generate_quad_sphere(…)

    Generate an quads sphere (an sphere with trapeze faces).

  • function generate_trigon_sphere(…)

    Generate an trigon sphere (an sphere with trigon faces).

note:This low-level function does not return an sphere object, but only the Vertex list to build it.

Predefine polyhedrons objects

Plato polyhedrons

Classes: Tetrahedron, Cube, Octahedron, Dodecahedron and Icosahedron 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 the lines colors, the faces color(s), the display mode, the line width and other settings.

Other polyhedrons

2 Polyhedrons more available:

  • An 26 faces polyhedron composed from triangles and quads.
  • An 32 faces polyhedron composed from triangles and pentagons.

Fulleren and toros

Classes: Fulleren (an soccer balll likewise polyhedron) and Toros (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 the lines colors, the faces color(s), the display mode, the line width and other settings.

Spheres

Classes: Quad_Sphere and Trigon_Sphere 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 the lines colors, the faces color, the display mode, the line width and other settings.

Release History

Release History

1.0.0

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
pyglut-1.0.0.zip (603.9 kB) Copy SHA256 Checksum SHA256 Source Sep 21, 2014

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting