tataratat / splinepy

Library for prototyping spline geometries of arbitrary dimensions and degrees, and IGA
https://tataratat.github.io/splinepy
Other
47 stars 13 forks source link

add conform flag to parametric_view #226

Closed j042 closed 1 year ago

j042 commented 1 year ago

Overview

add conform flag to parametric_view. then resulting spline has conforming parametric space and cps are placed on parametric space "box". Expected use case is in interactive mode, where you can set boundary conditions based on difference in control point locations in parametric view. Added test Also fixes some errors in create

Addressed issues

Checklists

jzwar commented 1 year ago

This PR looks reasonable to me for non-rational splines. However I am not sure about the meaningfulness of the parametric view of rational splines. For example, consider the following spline:

import splinepy as sp
import numpy as np
# Create a nurbs
nurbs = sp.NURBS(
    degrees=[2, 1],
    knot_vectors=[
        [0.0, 0.0, 0.0, 0.5, 1.0, 1.0, 1.0],
        [0.0, 0.0, 1.0, 1.0],
    ],
    control_points=[
        [0.0, 0.0],
        [1.0, 0.0],
        [2.0, 0.0],
        [3.0, 0.0],
        [0.0, 1.0],
        [1.0, 1.0],
        [2.0, 1.0],
        [3.0, 1.0],
    ],
    weights=[1.0, 0.5, 1.0, 1.0, 1, 1, 0.5, 1],
)
nurbs.create.parametric_view(conform=True).show()

This will plot like so: image

Is this what you intended?

j042 commented 1 year ago

This PR looks reasonable to me for non-rational splines. However I am not sure about the meaningfulness of the parametric view of rational splines. For example, consider the following spline:

import splinepy as sp
import numpy as np
# Create a nurbs
nurbs = sp.NURBS(
    degrees=[2, 1],
    knot_vectors=[
        [0.0, 0.0, 0.0, 0.5, 1.0, 1.0, 1.0],
        [0.0, 0.0, 1.0, 1.0],
    ],
    control_points=[
        [0.0, 0.0],
        [1.0, 0.0],
        [2.0, 0.0],
        [3.0, 0.0],
        [0.0, 1.0],
        [1.0, 1.0],
        [2.0, 1.0],
        [3.0, 1.0],
    ],
    weights=[1.0, 0.5, 1.0, 1.0, 1, 1, 0.5, 1],
)
nurbs.create.parametric_view(conform=True).show()

This will plot like so: image

Is this what you intended?

not really, thanks for pointing this out!

j042 commented 1 year ago
Screenshot 2023-08-23 at 15 13 40

The goal was to visualize boundary conditions in parametric view. but in this case, I see that knot lines are somewhat confusing