41 lines
986 B
Python
41 lines
986 B
Python
#!/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)
|