-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add more documentation #150
Comments
Hi, I have just come across your package and it seems exactly like what I need. Ultimately, I want to be able to compute the signed distance function from a spline. To do that, I need to evaluate the curve at specific s-parameter values. I am trying to understand how to do that from the code, but being new to Julia, I am progressing very slowly. Could you please point me to the right place? |
Thank you for your interest in this package!
I'm not much familiar with s-parameter etc. Could you provide some math expressions or references for this? |
I just mean the non-dimensional length of the curve ranging from 0 to 1. For instance, in the NURBS.jl package you can do this:
However, that library seems to no longer be maintained and therefore I was hoping to use yours instead. |
Ah, I see. Here's a simple example: julia> using StaticArrays, BasicBSpline
julia> k = KnotVector([0.0, 0.0, 0.0, 0.5, 1.0, 1.0, 1.0]) # knot vector in parameter space
KnotVector([0.0, 0.0, 0.0, 0.5, 1.0, 1.0, 1.0])
julia> P = BSplineSpace{2}(k)
BSplineSpace{2, Float64, KnotVector{Float64}}(KnotVector([0.0, 0.0, 0.0, 0.5, 1.0, 1.0, 1.0]))
julia> C = BSplineManifold([SVector(1,2), SVector(2,3), SVector(-2,2), SVector(-4,1)], P)
BSplineManifold{1, (2,), SVector{2, Int64}, Tuple{BSplineSpace{2, Float64, KnotVector{Float64}}}}((BSplineSpace{2, Float64, KnotVector{Float64}}(KnotVector([0.0, 0.0, 0.0, 0.5, 1.0, 1.0, 1.0])),), SVector{2, Int64}[[1, 2], [2, 3], [-2, 2], [-4, 1]])
julia> C.(0:0.1:1)
11-element Vector{SVector{2, Float64}}:
[1.0, 2.0]
[1.2800000000000002, 2.3400000000000007]
[1.3199999999999998, 2.5600000000000005]
[1.12, 2.6599999999999997]
[0.6799999999999997, 2.6399999999999997]
[0.0, 2.5]
[-0.7999999999999996, 2.2800000000000002]
[-1.5999999999999996, 2.0200000000000005]
[-2.4000000000000004, 1.72]
[-3.2, 1.38]
[-4.0, 1.0] An instance of julia> unbounded_mapping.(C, 0:0.1:1)
11-element Vector{SVector{2, Float64}}:
[1.0, 2.0]
[1.2800000000000002, 2.3400000000000007]
[1.3199999999999998, 2.5600000000000005]
[1.12, 2.6599999999999997]
[0.6799999999999997, 2.6399999999999997]
[0.0, 2.5]
[-0.7999999999999996, 2.2800000000000002]
[-1.5999999999999996, 2.0200000000000005]
[-2.4000000000000004, 1.72]
[-3.2, 1.38]
[-4.0, 1.0]
julia> unbounded_mapping.(C, -1)
2-element SVector{2, Float64} with indices SOneTo(2):
-15.0
-8.0
julia> C(-1)
ERROR: DomainError with -1:
The input -1 is out of range.
Stacktrace:
[1] macro expansion
@ ~/.julia/dev/BasicBSpline/src/_BSplineManifold.jl:146 [inlined]
[2] (::BSplineManifold{1, (2,), SVector{2, Int64}, Tuple{BSplineSpace{2, Float64, KnotVector{Float64}}}})(t::Int64)
@ BasicBSpline ~/.julia/dev/BasicBSpline/src/_BSplineManifold.jl:146
[3] top-level scope
@ REPL[26]:1 Please check the documentation for more information. |
Fantastic, this is exactly what I was looking for. Thanks! |
TODO:
BSplineManifold
vsCustomBSplineManifold
KnotVector
vsUniformKnotVector
bsplinebasis
vsbsplinebasisall
BSplineSpace
vsUniformBSplineSpace
issubset
vsissqsubset
bsplinebasis
vsbsplinebasis₊₀
vsbsplinebasis₋₀
unsafe_*
methodsbsplinebasis′
BSplineDerivativeSpace
The text was updated successfully, but these errors were encountered: