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()
# ============================================================================== # basic plotter instance plotter = GeometryPlotter() # add boundary box and polygon plotter.add(box, edgecolor=(0, 0, 0), fill=False) plotter.add(polygon, edgecolor=(0, 0, 1), facecolor=(0.7, 0.7, 1.0)) # add the points of the pointcloud for point in cloud: plotter.add(point, facecolor=(1, 1, 1)) # start visualisation plotter.zoom_extents() plotter.pause(1) # move points in the direction of the randomly assigned translation vectors # bounce the points of the walls of the box # color points red when they paas through the polygon for _ in range(100): for i in range(N): T = transformations[i] a = cloud[i] b = a.transformed(T) artist = plotter.find(a) for side in box.lines: x = intersection_segment_segment_xy((a, b), side) if x: x1 = Point(*x)