Exemple #1
0
    def to_compas(self):
        """Convert the curve to a COMPAS curve.

        Returns
        -------
        :class:`compas_rhino.geometry.RhinoNurbsCurve`
        """
        from compas.geometry import NurbsCurve
        curve = NurbsCurve()
        curve.rhino_curve = self.geometry
        return curve
Exemple #2
0
from compas.geometry import Point
from compas.geometry import Polyline
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)]

curve = NurbsCurve.from_points(points)

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

Artist.clear()

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

Artist.redraw()
Exemple #3
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()
Exemple #4
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(1, 2, 0), Point(2, -2, 0), Point(3, 0, 0)]
bezier = Bezier(points)

points = [Point(4, 0, 0), Point(5, 2, 0), Point(6, -2, 0), Point(7, 0, 0)]

curve1 = NurbsCurve.from_parameters(points=points,
                                    weights=[1.0, 1.0, 1.0, 1.0],
                                    knots=[0.0, 1.0],
                                    multiplicities=[4, 4],
                                    degree=3)

curve2 = NurbsCurve.from_parameters(points=points,
                                    weights=[1.0, 2.0, 2.0, 1.0],
                                    knots=[0.0, 1.0],
                                    multiplicities=[4, 4],
                                    degree=3)

curve3 = NurbsCurve.from_parameters(points=points,
                                    weights=[1.0, 1.0, 1.0, 1.0],
                                    knots=[0.0, 1 / 3, 2 / 3, 1.0],
                                    multiplicities=[3, 1, 1, 3],
                                    degree=3)

curve4 = NurbsCurve.from_parameters(
    points=points,
Exemple #5
0
from compas.geometry import Point
from compas.geometry import Line
from compas.geometry import NurbsCurve
from compas.artists import Artist
from compas.colors import Color

line = Line(Point(0, 0, 0), Point(3, 3, 0))
curve = NurbsCurve.from_line(line)

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

Artist.clear()

Artist(curve).draw(color=Color.green())

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

Artist.redraw()
Exemple #6
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(1, 3, 0), Point(2, 0, 0)]
bezier = Bezier(points)

points = [Point(3, 0, 0), Point(4, 3, 0), Point(5, 0, 0)]

curve1 = NurbsCurve.from_parameters(points=points,
                                    weights=[1.0, 1.0, 1.0],
                                    knots=[0.0, 1.0],
                                    multiplicities=[3, 3],
                                    degree=2)

curve2 = NurbsCurve.from_parameters(points=points,
                                    weights=[1.0, 2.0, 1.0],
                                    knots=[0.0, 1.0],
                                    multiplicities=[3, 3],
                                    degree=2)

curve3 = NurbsCurve.from_parameters(points=points,
                                    weights=[1.0, 1.0, 1.0],
                                    knots=[0.0, 1.0, 2.0, 3.0, 4.0, 5.0],
                                    multiplicities=[1, 1, 1, 1, 1, 1],
                                    degree=2)

# ==============================================================================
# Visualisation
Exemple #7
0
from compas.geometry import Vector, Point, Plane
from compas.geometry import Polyline
from compas.geometry import Ellipse
from compas.geometry import NurbsCurve
from compas.artists import Artist
from compas.colors import Color

ellipse = Ellipse(Plane(Point(0, 0, 0), Vector(0, 0, 1)), 2.0, 1.0)
curve = NurbsCurve.from_ellipse(ellipse)

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

Artist.clear()

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

Artist.redraw()
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,
Exemple #9
0
from compas.geometry import Vector, Point, Plane
from compas.geometry import Polyline
from compas.geometry import Circle
from compas.geometry import NurbsCurve
from compas.artists import Artist
from compas.colors import Color

circle = Circle(Plane(Point(0, 0, 0), Vector(0, 0, 1)), 1.0)
curve = NurbsCurve.from_circle(circle)

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

Artist.clear()

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

Artist.redraw()
Exemple #10
0
from compas.geometry import Point
from compas.geometry import Polyline
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)]

curve = NurbsCurve.from_parameters(points=points,
                                   weights=[1.0, 1.0, 1.0, 1.0],
                                   knots=[0.0, 1.0],
                                   multiplicities=[4, 4],
                                   degree=3)

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

Artist.clear()

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

Artist.redraw()