Shapes¶
Shape¶
- class pydy_viz.shapes.Shape(name='unnamed', color='grey')[source]¶
A Shape. It is a superclass for more general shapes like Mesh, Cylinder, Sphere etc.
Default Shape can be used for Particle visualizations, as in sympy.physics.mechanics.particle
The Shape classes are used for creating visualization objects, used for studying multibody dynamics and in animations.
Values need to be supplied on initialization, but can be changed later.
Parameters: name : str
Name assigned to shape
color: str :
A color string from list of colors in pydy_viz.colors module This color is used in drawing visualizations for this shape
Examples
>>> from pydy_viz.shapes import Shape >>> >>> s = Shape() >>> s.name 'unnamed' >>> s.color 'grey' >>> s.color_in_rgb() (0.5019607843137255, 0.5019607843137255, 0.5019607843137255) >>>#These can be changed later too .. >>> s.name = 'my-shape1' >>> s.name 'my-shape1' >>> s.color = 'blue' >>> s.color 'blue' >>> a = Shape('my-shape2', 'red') >>> a.name 'my-shape2' >>> a.color 'red' >>> a.color_in_rgb() (1.0, 0.0, 0.0)
Cube¶
- class pydy_viz.shapes.Cube(name='unnamed', color='grey', length=10)[source]¶
A Cube. This class generates a Cube, with given length of side, and color.Default color is grey.
Parameters: name : str
Name assigned to shape
color: str :
A color string from list of colors in pydy_viz.colors module This color is used in drawing visualizations for Cube
length: int or float. :
Length of side of Cube
Examples
>>> from pydy_viz.shapes import Cube >>> >>> s = Cube(10) >>> s.name 'unnamed' >>> s.color 'grey' >>> s.color_in_rgb() (0.5019607843137255, 0.5019607843137255, 0.5019607843137255) >>>s.length 10 >>>#These can be changed later too .. >>> s.name = 'my-shape1' >>> s.name 'my-shape1' >>> s.color = 'blue' >>> s.color 'blue' >>> s.length = 12 >>> s.length 12 >>> a = Cube('my-shape2', 'red', length=10) >>> a.name 'my-shape2' >>> a.color 'red' >>> a.length 10 >>> a.color_in_rgb() (1.0, 0.0, 0.0)
Cylinder¶
- class pydy_viz.shapes.Cylinder(name='unnamed', color='grey', length=10, radius=5)[source]¶
A Cylinder. This class generates a Cylinder with given length, radius, and color. Default color is grey.
Parameters: name : str
Name assigned to Cylinder
color: str :
A color string from list of colors in pydy_viz.colors module This color is used in drawing visualizations for Cylinder
length: int or float, length of the Cylinder :
radius: int or float, radius of the Cylinder :
Examples
>>> from pydy_viz.shapes import Cylinder >>> >>> s = Cylinder(length=10, radius=5) >>> s.name 'unnamed' >>> s.color 'grey' >>> s.color_in_rgb() (0.5019607843137255, 0.5019607843137255, 0.5019607843137255) >>> s.length 10 >>> s.radius 5 >>>#These can be changed later too .. >>> s.name = 'my-shape1' >>> s.name 'my-shape1' >>> s.color = 'blue' >>> s.color 'blue' >>> s.length = 12 >>> s.length 12 >>> s.radius = 6 >>> s.radius 6 >>> a = Cylinder('my-shape2', 'red', length=10, radius=5) >>> a.name 'my-shape2' >>> a.color 'red' >>> a.length 10 >>> a.radius 5 >>> a.color_in_rgb() (1.0, 0.0, 0.0)
Cone¶
- class pydy_viz.shapes.Cone(name='unnamed', color='grey', length=10, radius=5)[source]¶
A Cone. This class generates a Cone with given length, base radius, and color. Default color is grey.
Parameters: name : str
Name assigned to Cone
color: str :
A color string from list of colors in pydy_viz.colors module This color is used in drawing visualizations for Cone
length: int or float, length of the Cone :
radius: int or float, base radius of the Cone :
Examples
>>> from pydy_viz.shapes import Cone >>> >>> s = Cone(length=10, radius=5) >>> s.name 'unnamed' >>> s.color 'grey' >>> s.color_in_rgb() (0.5019607843137255, 0.5019607843137255, 0.5019607843137255) >>> s.length 10 >>> s.radius 5 >>>#These can be changed later too .. >>> s.name = 'my-shape1' >>> s.name 'my-shape1' >>> s.color = 'blue' >>> s.color 'blue' >>> s.length = 12 >>> s.length 12 >>> s.radius = 6 >>> s.radius 6 >>> a = Cone('my-shape2', 'red', length=10, radius=5) >>> a.name 'my-shape2' >>> a.color 'red' >>> a.length 10 >>> a.radius 5 >>> a.color_in_rgb() (1.0, 0.0, 0.0)
Sphere¶
- class pydy_viz.shapes.Sphere(name='unnamed', color='grey', radius=10)[source]¶
A Sphere. This class generates a Sphere, with given length of side, and color. Default color is grey.
Parameters: name : str
Name assigned to shape
color: str :
A color string from list of colors in pydy_viz.colors module This color is used in drawing visualizations for Sphere
radius: int or float. :
Radius of Sphere
Examples
>>> from pydy_viz.shapes import Sphere >>> >>> s = Sphere(10) >>> s.name 'unnamed' >>> s.color 'grey' >>> s.color_in_rgb() (0.5019607843137255, 0.5019607843137255, 0.5019607843137255) >>>s.radius 10 >>>#These can be changed later too .. >>> s.name = 'my-shape1' >>> s.name 'my-shape1' >>> s.color = 'blue' >>> s.color 'blue' >>> s.radius = 12 >>> s.radius 12 >>> a = Sphere('my-shape2', 'red', radius=10) >>> a.name 'my-shape2' >>> a.color 'red' >>> a.radius 10 >>> a.color_in_rgb() (1.0, 0.0, 0.0)
Circle¶
- class pydy_viz.shapes.Circle(name='unnamed', color='grey', radius=10)[source]¶
A Circle. This class generates a Circle, with given radius, and color. Default color is grey.
Parameters: name : str
Name assigned to shape
color: str :
A color string from list of colors in pydy_viz.colors module This color is used in drawing visualizations for Circle
radius: int or float. :
Radius of Circle
Examples
>>> from pydy_viz.shapes import Circle >>> >>> s = Circle(10) >>> s.name 'unnamed' >>> s.color 'grey' >>> s.color_in_rgb() (0.5019607843137255, 0.5019607843137255, 0.5019607843137255) >>>s.radius 10 >>>#These can be changed later too .. >>> s.name = 'my-shape1' >>> s.name 'my-shape1' >>> s.color = 'blue' >>> s.color 'blue' >>> s.radius = 12 >>> s.radius 12 >>> a = Circle('my-shape2', 'red', radius=10) >>> a.name 'my-shape2' >>> a.color 'red' >>> a.radius 10 >>> a.color_in_rgb() (1.0, 0.0, 0.0)
Plane¶
- class pydy_viz.shapes.Plane(name='unnamed', color='grey', length=10, width=5)[source]¶
A Plane. This class generates a Plane with given length, width, and color. Default color is grey.
Parameters: name : str
Name assigned to Plane
color: str :
A color string from list of colors in pydy_viz.colors module This color is used in drawing visualizations for Plane
length: int or float, length of the Plane :
width: int or float, radius of the Plane :
Examples
>>> from pydy_viz.shapes import Plane >>> >>> s = Plane(length=10, width=5) >>> s.name 'unnamed' >>> s.color 'grey' >>> s.color_in_rgb() (0.5019607843137255, 0.5019607843137255, 0.5019607843137255) >>> s.length 10 >>> s.width 5 >>>#These can be changed later too .. >>> s.name = 'my-shape1' >>> s.name 'my-shape1' >>> s.color = 'blue' >>> s.color 'blue' >>> s.length = 12 >>> s.length 12 >>> s.width = 6 >>> s.width 6 >>> a = Plane('my-shape2', 'red', length=10, width=5) >>> a.name 'my-shape2' >>> a.color 'red' >>> a.length 10 >>> a.width 5 >>> a.color_in_rgb() (1.0, 0.0, 0.0)
Tetrahedron¶
- class pydy_viz.shapes.Tetrahedron(name='unnamed', color='grey', radius=10)[source]¶
A Tetrahedron. This class generates a Tetrahedron. The argument given is the radius of the circumscribing sphere of the tetrahedron, and color. Default color is grey.
Parameters: name : str
Name assigned to shape
color: str :
A color string from list of colors in pydy_viz.colors module This color is used in drawing visualizations for Tetrahedron
radius: int or float. :
Radius of circum-scribing sphere of Tetrahedron
Examples
>>> from pydy_viz.shapes import Tetrahedron >>> >>> s = Tetrahedron(10) >>> s.name 'unnamed' >>> s.color 'grey' >>> s.color_in_rgb() (0.5019607843137255, 0.5019607843137255, 0.5019607843137255) >>>s.radius 10 >>>#These can be changed later too .. >>> s.name = 'my-shape1' >>> s.name 'my-shape1' >>> s.color = 'blue' >>> s.color 'blue' >>> s.radius = 12 >>> s.radius 12 >>> a = Tetrahedron('my-shape2', 'red', radius=10) >>> a.name 'my-shape2' >>> a.color 'red' >>> a.radius 10 >>> a.color_in_rgb() (1.0, 0.0, 0.0)
Octahedron¶
- class pydy_viz.shapes.Tetrahedron(name='unnamed', color='grey', radius=10)[source]
A Tetrahedron. This class generates a Tetrahedron. The argument given is the radius of the circumscribing sphere of the tetrahedron, and color. Default color is grey.
Parameters: name : str
Name assigned to shape
color: str :
A color string from list of colors in pydy_viz.colors module This color is used in drawing visualizations for Tetrahedron
radius: int or float. :
Radius of circum-scribing sphere of Tetrahedron
Examples
>>> from pydy_viz.shapes import Tetrahedron >>> >>> s = Tetrahedron(10) >>> s.name 'unnamed' >>> s.color 'grey' >>> s.color_in_rgb() (0.5019607843137255, 0.5019607843137255, 0.5019607843137255) >>>s.radius 10 >>>#These can be changed later too .. >>> s.name = 'my-shape1' >>> s.name 'my-shape1' >>> s.color = 'blue' >>> s.color 'blue' >>> s.radius = 12 >>> s.radius 12 >>> a = Tetrahedron('my-shape2', 'red', radius=10) >>> a.name 'my-shape2' >>> a.color 'red' >>> a.radius 10 >>> a.color_in_rgb() (1.0, 0.0, 0.0)
- generate_dict()[source]
Generates data dict along with the Shape info for Cube, to be used by VisualizationFrame class.
Icosahedron¶
- class pydy_viz.shapes.Icosahedron(name='unnamed', color='grey', radius=10)[source]¶
A Icosahedron. This class generates a Icosahedron. The argument given is the radius of the circumscribing sphere of the icosahedron, and color. Default color is grey.
Parameters: name : str
Name assigned to shape
color: str :
A color string from list of colors in pydy_viz.colors module This color is used in drawing visualizations for Icosahedron
radius: int or float. :
Radius of the circum-scribing sphere for Icosahedron
Examples
>>> from pydy_viz.shapes import Icosahedron >>> >>> s = Icosahedron(10) >>> s.name 'unnamed' >>> s.color 'grey' >>> s.color_in_rgb() (0.5019607843137255, 0.5019607843137255, 0.5019607843137255) >>>s.radius 10 >>>#These can be changed later too .. >>> s.name = 'my-shape1' >>> s.name 'my-shape1' >>> s.color = 'blue' >>> s.color 'blue' >>> s.radius = 12 >>> s.radius 12 >>> a = Icosahedron('my-shape2', 'red', radius=10) >>> a.name 'my-shape2' >>> a.color 'red' >>> a.radius 10 >>> a.color_in_rgb() (1.0, 0.0, 0.0)
Torus¶
- class pydy_viz.shapes.Torus(name='unnamed', color='grey', radius=10, tube_radius=5)[source]¶
A Torus. This class generates a Torus with given radius, tube-radius, and color. Default color is grey.
Parameters: name : str
Name assigned to Torus
color: str :
A color string from list of colors in pydy_viz.colors module This color is used in drawing visualizations for Torus
radius: int or float, radius of the Torus Shape :
tube_radius: int or float, radius of the torus tube :
Examples
>>> from pydy_viz.shapes import Torus >>> >>> s = Torus(radius=10, tube_radius=5) >>> s.name 'unnamed' >>> s.color 'grey' >>> s.color_in_rgb() (0.5019607843137255, 0.5019607843137255, 0.5019607843137255) >>> s.radius 10 >>> s.tube_radius 5 >>>#These can be changed later too .. >>> s.name = 'my-shape1' >>> s.name 'my-shape1' >>> s.color = 'blue' >>> s.color 'blue' >>> s.radius = 12 >>> s.radius 12 >>> s.tube_radius = 6 >>> s.tube_radius 6 >>> a = Torus('my-shape2', 'red', radius=10, tube_radius=5) >>> a.name 'my-shape2' >>> a.color 'red' >>> a.radius 10 >>> a.tube_radius 5 >>> a.color_in_rgb() (1.0, 0.0, 0.0)
TorusKnot¶
- class pydy_viz.shapes.TorusKnot(name='unnamed', color='grey', radius=10, tube_radius=5)[source]¶
A TorusKnot. This class generates a TorusKnot with given radius, tube-radius, and color. Default color is grey.
Parameters: name : str
Name assigned to TorusKnot
color: str :
A color string from list of colors in pydy_viz.colors module This color is used in drawing visualizations for TorusKnot
radius: int or float, radius of the TorusKnot Shape :
tube_radius: int or float, radius of the torus-knot tube :
Examples
>>> from pydy_viz.shapes import TorusKnot >>> >>> s = TorusKnot(radius=10, tube_radius=5) >>> s.name 'unnamed' >>> s.color 'grey' >>> s.color_in_rgb() (0.5019607843137255, 0.5019607843137255, 0.5019607843137255) >>> s.radius 10 >>> s.tube_radius 5 >>>#These can be changed later too .. >>> s.name = 'my-shape1' >>> s.name 'my-shape1' >>> s.color = 'blue' >>> s.color 'blue' >>> s.radius = 12 >>> s.radius 12 >>> s.tube_radius = 6 >>> s.tube_radius 6 >>> a = TorusKnot('my-shape2', 'red', radius=10, tube_radius=5) >>> a.name 'my-shape2' >>> a.color 'red' >>> a.radius 10 >>> a.tube_radius 5 >>> a.color_in_rgb() (1.0, 0.0, 0.0)
Tube¶
- class pydy_viz.shapes.Tube(name='unnamed', color='grey', radius=10, points=None)[source]¶
A Tube. This class generates a Tube from given points, by drawing a curve passing through given points, with given radius and color. Default color is grey.
Parameters: name : str
Name assigned to Tube
color: str :
A color string from list of colors in pydy_viz.colors module This color is used in drawing visualizations for Tube
radius: radius of Tube :
points: list of points which are used for making Tube :
Examples
>>> from pydy_viz.shapes import Tube >>> point_list = [[1, 2, 1], [2, 1, 1], [2, 3, 4]] >>> s = Tube(points=point_list) >>> s.name 'unnamed' >>> s.color 'grey' >>> s.color_in_rgb() (0.5019607843137255, 0.5019607843137255, 0.5019607843137255) >>> s.points [[1, 2, 1], [2, 1, 1], [2, 3, 4]] >>>#These can be changed later too .. >>> s.name = 'my-shape1' >>> s.name 'my-shape1' >>> s.color = 'blue' >>> s.color 'blue' >>> s.radius = 14 >>> s.radius 14 >>> s.points = [[2, 1, 4], [1, 2, 4], [2, 3, 1], [1, 1, 3]] >>> s.points [[2, 1, 4], [1, 2, 4], [2, 3, 1], [1, 1, 3]] >>> a = Tube('my-shape2', 'red', radius=12, points=point_list) >>> a.name 'my-shape2' >>> a.color 'red' >>> a.radius 12 >>> a.points [[1, 2, 1], [2, 1, 1], [2, 3, 4]] >>> a.color_in_rgb() (1.0, 0.0, 0.0)
Mesh¶
- class pydy_viz.shapes.Mesh(name='unnamed', color='grey', points=None)[source]¶
A Mesh. This class generates a general Mesh from given points, by drawing a curve passing through given points, and color. Default color is grey.
Parameters: name : str
Name assigned to Mesh
color: str :
A color string from list of colors in pydy_viz.colors module This color is used in drawing visualizations for Mesh
points: list of points which are used for making mesh :
Examples
>>> from pydy_viz.shapes import Mesh >>> point_list = [[1, 2, 1], [2, 1, 1], [2, 3, 4]] >>> s = Mesh(points=point_list) >>> s.name 'unnamed' >>> s.color 'grey' >>> s.color_in_rgb() (0.5019607843137255, 0.5019607843137255, 0.5019607843137255) >>> s.points [[1, 2, 1], [2, 1, 1], [2, 3, 4]] >>>#These can be changed later too .. >>> s.name = 'my-shape1' >>> s.name 'my-shape1' >>> s.color = 'blue' >>> s.color 'blue' >>> s.points = [[2, 1, 4], [1, 2, 4], [2, 3, 1], [1, 1, 3]] >>> s.points [[2, 1, 4], [1, 2, 4], [2, 3, 1], [1, 1, 3]] >>> a = Mesh('my-shape2', 'red', points=point_list) >>> a.name 'my-shape2' >>> a.color 'red' >>> a.points [[1, 2, 1], [2, 1, 1], [2, 3, 4]] >>> a.color_in_rgb() (1.0, 0.0, 0.0)