add issequence function to data and plot functions and examples for geometry
This commit is contained in:
30
examples/geometry_hexahedra.py
Normal file
30
examples/geometry_hexahedra.py
Normal file
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
"""Example geometry of hexahedra.
|
||||
|
||||
:Date: 2019-12-24
|
||||
|
||||
.. module:: geometry_hexahedra
|
||||
:platform: *nix, Windows
|
||||
:synopsis: Example geometry of hexahedra.
|
||||
|
||||
.. moduleauthor:: Daniel Weschke <daniel.weschke@directbox.de>
|
||||
"""
|
||||
from pylib.geometry import World, Hexahedron
|
||||
from pylib.geometry_plot_pylab import cad_wireframe
|
||||
|
||||
def geometry():
|
||||
w = World()
|
||||
for i in range(3):
|
||||
for j in range(3):
|
||||
for k in range(3):
|
||||
w.add(Hexahedron().scale(0.8).translate(-2+2*i, -2+2*j, -2+2*k))
|
||||
return w
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
w = geometry()
|
||||
#print(w.bounding_box())
|
||||
#print(*w)
|
||||
#print(w.wireframes_xyz())
|
||||
cad_wireframe(w)
|
||||
41
examples/geometry_lines_circles.py
Normal file
41
examples/geometry_lines_circles.py
Normal file
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
"""Example geometry of lines and circles.
|
||||
|
||||
:Date: 2019-12-23
|
||||
|
||||
.. module:: geometry_pyramidal_frustum
|
||||
:platform: *nix, Windows
|
||||
:synopsis: Example geometry of lines and circles.
|
||||
|
||||
.. moduleauthor:: Daniel Weschke <daniel.weschke@directbox.de>
|
||||
"""
|
||||
import math
|
||||
from pylib.geometry import World, Point, Line, Circle
|
||||
from pylib.geometry_plot_pylab import cad_wireframe, wireframe3d
|
||||
|
||||
def geometry():
|
||||
w = World()
|
||||
|
||||
p0 = Point(0, 0, 0)
|
||||
p = Point(1, 1, 1)
|
||||
|
||||
# add Lines to the Word
|
||||
theta = math.pi/4
|
||||
w.add(*[Line(p0, p.rotate_x(theta/5)) for i in range(30)])
|
||||
w.add(*[Line(p0, p.rotate_x(theta/5)).translate(.1*i, 0, 0) for i in range(30)])
|
||||
|
||||
# add Circles to the Word
|
||||
c1 = Circle()
|
||||
c2 = Circle(2)
|
||||
c3 = Circle(n=18).scale(3).rotate_x(math.pi/4)
|
||||
w.add(c1, c2, c3)
|
||||
|
||||
return w
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
w = geometry()
|
||||
print(*w)
|
||||
wireframe3d(w)
|
||||
cad_wireframe(w, False)
|
||||
40
examples/geometry_pyramidal_frustum.py
Normal file
40
examples/geometry_pyramidal_frustum.py
Normal file
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
"""Example geometry of a pyramidal frustum.
|
||||
|
||||
:Date: 2019-12-23
|
||||
|
||||
.. module:: geometry_pyramidal_frustum
|
||||
:platform: *nix, Windows
|
||||
:synopsis: Example geometry of a pyramidal frustum.
|
||||
|
||||
.. moduleauthor:: Daniel Weschke <daniel.weschke@directbox.de>
|
||||
"""
|
||||
from pylib.geometry import World, Point, Polygon, Hexahedron
|
||||
from pylib.geometry_plot_pylab import cad_wireframe
|
||||
|
||||
def geometry():
|
||||
w = World()
|
||||
p0 = Point()
|
||||
p1 = Point(1.00, 0, 0)
|
||||
p2 = Point(1.00, 1, 0)
|
||||
p3 = Point(0.00, 1, 0)
|
||||
p4 = Point(0.25, 0.25, 1)
|
||||
p5 = Point(0.75, 0.25, 1)
|
||||
p6 = Point(0.75, 0.75, 1)
|
||||
p7 = Point(0.25, 0.75, 1)
|
||||
pg0 = Polygon(p0, p1, p2, p3)
|
||||
pg1 = Polygon(p4, p5, p6, p7)
|
||||
pg2 = Polygon(p0, p1, p5, p4)
|
||||
pg3 = Polygon(p2, p3, p7, p6)
|
||||
w.add(pg0, pg1, pg2, pg3)
|
||||
h = Hexahedron()
|
||||
w.add(h)
|
||||
return w
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
w = geometry()
|
||||
print(*w)
|
||||
print(w.wireframes_xyz())
|
||||
cad_wireframe(w)
|
||||
Reference in New Issue
Block a user