# Path: geomdl/BSpline.py
# class Curve(abstract.Curve):
# class Surface(abstract.Surface):
# class Volume(abstract.Volume):
#     def __init__(self, **kwargs):
#     def save(self, file_name):
#     def load(self, file_name):
#     def evaluate(self, **kwargs):
#     def evaluate_single(self, param):
#     def evaluate_list(self, param_list):
#     def derivatives(self, u, order=0, **kwargs):
#     def insert_knot(self, param, **kwargs):
#     def remove_knot(self, param, **kwargs):
#     def tangent(self, parpos, **kwargs):
#     def normal(self, parpos, **kwargs):
#     def binormal(self, parpos, **kwargs):
#     def __init__(self, **kwargs):
#     def ctrlpts2d(self):
#     def ctrlpts2d(self, value):
#     def set_ctrlpts(self, ctrlpts, *args, **kwargs):
#     def reset(self, **kwargs):
#     def save(self, file_name):
#     def load(self, file_name):
#     def transpose(self):
#     def evaluate(self, **kwargs):
#     def evaluate_single(self, param):
#     def evaluate_list(self, param_list):
#     def derivatives(self, u, v, order=0, **kwargs):
#     def insert_knot(self, u=None, v=None, **kwargs):
#     def remove_knot(self, u=None, v=None, **kwargs):
#     def tangent(self, parpos, **kwargs):
#     def normal(self, parpos, **kwargs):
#     def __init__(self, **kwargs):
#     def save(self, file_name):
#     def load(self, file_name):
#     def evaluate(self, **kwargs):
#     def evaluate_single(self, param):
#     def evaluate_list(self, param_list):
#     def insert_knot(self, u=None, v=None, w=None, **kwargs):
#     def remove_knot(self, u=None, v=None, w=None, **kwargs):
# 
# Path: geomdl/convert.py
# def bspline_to_nurbs(obj, **kwargs):
# def nurbs_to_bspline(obj, **kwargs):


from geomdl import BSpline
from geomdl import convert
S_CTRLPTS = [[0, 0, 0], [0, 1, 0], [0, 2, -3],
             [1, 0, 6], [1, 1, 0], [1, 2, 0],
             [2, 0, 0], [2, 1, 0], [2, 2, 3]]
S_KV_U = [0, 0, 0, 1, 1, 1]
S_KV_V = [0, 0, 0, 1, 1, 1]


def test_convert_curve():
    curve_bs = BSpline.Curve()
    curve_bs.degree = C_DEGREE
    curve_bs.ctrlpts = C_CTRLPTS
    curve_bs.knotvector = C_KV
    curve_bs.sample_size = SAMPLE_SIZE

    curve_nurbs = convert.bspline_to_nurbs(curve_bs)
    curve_nurbs.sample_size = SAMPLE_SIZE

    # Expected weights vector
    res_weights = [1.0 for _ in range(len(C_CTRLPTS))]

    # Expected evaluation result
    res = [[1.0, 1.0, 0.0], [1.4375, 1.0625, -0.375], [1.75, 1.25, -0.5], [1.9375, 1.5625, -0.375], [2.0, 2.0, 0.0]]

    assert not curve_bs.rational
    assert curve_nurbs.rational
    assert curve_nurbs.evalpts == res
    assert curve_nurbs.weights == res_weights


def test_convert_surface():

# Path: geomdl/BSpline.py
# class Curve(abstract.Curve):
# class Surface(abstract.Surface):
# class Volume(abstract.Volume):
#     def __init__(self, **kwargs):
#     def save(self, file_name):
#     def load(self, file_name):
#     def evaluate(self, **kwargs):
#     def evaluate_single(self, param):
#     def evaluate_list(self, param_list):
#     def derivatives(self, u, order=0, **kwargs):
#     def insert_knot(self, param, **kwargs):
#     def remove_knot(self, param, **kwargs):
#     def tangent(self, parpos, **kwargs):
#     def normal(self, parpos, **kwargs):
#     def binormal(self, parpos, **kwargs):
#     def __init__(self, **kwargs):
#     def ctrlpts2d(self):
#     def ctrlpts2d(self, value):
#     def set_ctrlpts(self, ctrlpts, *args, **kwargs):
#     def reset(self, **kwargs):
#     def save(self, file_name):
#     def load(self, file_name):
#     def transpose(self):
#     def evaluate(self, **kwargs):
#     def evaluate_single(self, param):
#     def evaluate_list(self, param_list):
#     def derivatives(self, u, v, order=0, **kwargs):
#     def insert_knot(self, u=None, v=None, **kwargs):
#     def remove_knot(self, u=None, v=None, **kwargs):
#     def tangent(self, parpos, **kwargs):
#     def normal(self, parpos, **kwargs):
#     def __init__(self, **kwargs):
#     def save(self, file_name):
#     def load(self, file_name):
#     def evaluate(self, **kwargs):
#     def evaluate_single(self, param):
#     def evaluate_list(self, param_list):
#     def insert_knot(self, u=None, v=None, w=None, **kwargs):
#     def remove_knot(self, u=None, v=None, w=None, **kwargs):
# 
# Path: geomdl/convert.py
# def bspline_to_nurbs(obj, **kwargs):
# def nurbs_to_bspline(obj, **kwargs):


# Path: tests/test_convert.py
from geomdl import BSpline
from geomdl import convert

S_CTRLPTS = [[0, 0, 0], [0, 1, 0], [0, 2, -3],
             [1, 0, 6], [1, 1, 0], [1, 2, 0],
             [2, 0, 0], [2, 1, 0], [2, 2, 3]]
S_KV_U = [0, 0, 0, 1, 1, 1]
S_KV_V = [0, 0, 0, 1, 1, 1]


def test_convert_curve():
    curve_bs = BSpline.Curve()
    curve_bs.degree = C_DEGREE
    curve_bs.ctrlpts = C_CTRLPTS
    curve_bs.knotvector = C_KV
    curve_bs.sample_size = SAMPLE_SIZE

    curve_nurbs = convert.bspline_to_nurbs(curve_bs)
    curve_nurbs.sample_size = SAMPLE_SIZE

    # Expected weights vector
    res_weights = [1.0 for _ in range(len(C_CTRLPTS))]

    # Expected evaluation result
    res = [[1.0, 1.0, 0.0], [1.4375, 1.0625, -0.375], [1.75, 1.25, -0.5], [1.9375, 1.5625, -0.375], [2.0, 2.0, 0.0]]

    assert not curve_bs.rational
    assert curve_nurbs.rational
    assert curve_nurbs.evalpts == res
    assert curve_nurbs.weights == res_weights


def test_convert_surface():

    surf_bs = BSpline.Surface()