Files
pylib/examples/geometry_lines_circles.py

42 lines
976 B
Python

#!/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)