Esempio n. 1
0
from compas.geometry import Point
from compas.geometry import Polyline, Bezier
from compas.geometry import NurbsCurve
from compas.artists import Artist
from compas.colors import Color

points = [Point(0, 0, 0), Point(3, 6, 0), Point(6, -3, 3), Point(10, 0, 0)]
bezier = Bezier(points)
points = bezier.locus(10)

curve = NurbsCurve.from_interpolation(points)

# ==============================================================================
# Visualisation
# ==============================================================================

Artist.clear()

Artist(curve).draw(color=Color.green())
Artist(Polyline(curve.points)).draw(show_points=True)

for point in points:
    Artist(point).draw()

Artist.redraw()
Esempio n. 2
0
from compas.geometry import NurbsSurface

from compas.geometry import Point
from compas.geometry import Polyline

from compas_view2.app import App

points1 = [
    Point(0, -10, 0),
    Point(1, -8, 0),
    Point(-1, -6, 0),
    Point(0, -4, 0)
]
points2 = [Point(5, -10, 0), Point(4, -8, 0), Point(6, -6, 0), Point(5, -4, 0)]

nurbscurve1 = NurbsCurve.from_interpolation(points1)
nurbscurve2 = NurbsCurve.from_interpolation(points2)

nurbssurface_2curves = NurbsSurface.from_fill(nurbscurve1, nurbscurve2)

points3 = [Point(0, 0, 0), Point(1, 2, 0), Point(-1, 4, 0), Point(0, 6, 0)]
points4 = [Point(0, 6, 0), Point(3, 6, -1), Point(5, 6, 0)]
points5 = [Point(5, 6, 0), Point(4, 2, 0), Point(5, 0, 0)]
points6 = [Point(5, 0, 0), Point(2, -1, 1), Point(0, 0, 0)]

nurbscurve3 = NurbsCurve.from_interpolation(points3)
nurbscurve4 = NurbsCurve.from_interpolation(points4)
nurbscurve5 = NurbsCurve.from_interpolation(points5)
nurbscurve6 = NurbsCurve.from_interpolation(points6)

nurbssurface_4curves = NurbsSurface.from_fill(nurbscurve3,