from compas.geometry import Ellipse from compas.geometry import Point from compas.geometry import Plane from compas.geometry import Vector from compas.geometry import Translation from compas_plotters import GeometryPlotter plotter = GeometryPlotter() plane = Plane(Point(0, 0, 0), Vector(0, 0, 1)) a = Ellipse(plane, 5.0, 3.0) b = Ellipse(plane, 2.0, 1.0) c = Ellipse(plane, 3.0, 1.0) T = Translation.from_vector([0.1, 0.0, 0.0]) plotter.add(a, edgecolor='#ff0000', fill=False) plotter.add(b, edgecolor='#00ff00', fill=False) plotter.add(c, edgecolor='#0000ff', fill=False) plotter.pause(1.0) for i in range(100): a.transform(T) plotter.redraw(pause=0.01) plotter.zoom_extents() plotter.show()
from compas.geometry import Pointcloud, Polygon, Line from compas.geometry import Translation from compas.geometry import intersection_line_segment_xy from compas.utilities import grouper, pairwise from compas_plotters import GeometryPlotter pcl = Pointcloud.from_bounds(10, 5, 0, 50) polygon = Polygon.from_sides_and_radius_xy(5, 1.0) polygon.transform(Translation.from_vector([5, 2.5, 0])) plotter = GeometryPlotter(show_axes=True, figsize=(12, 7.5)) plotter.add(polygon, edgecolor=(0, 0, 1), facecolor=(0.7, 0.7, 1.0)) lines = [] for a, b in grouper(pcl.points, 2): line = Line(a, b) lines.append(line) plotter.add(line, color=(0.5, 0.5, 0.5)) plotter.redraw() plotter.zoom_extents() plotter.show()