Comments (5)
Fantastic, this is exactly what I was looking for. Thanks!
from basicbspline.jl.
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?
from basicbspline.jl.
Thank you for your interest in this package!
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'm not much familiar with s-parameter etc. Could you provide some math expressions or references for this?
from basicbspline.jl.
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:
evalpoints = collect(0:0.0005:1.0)
CBspline = curvePoints(NBspline, evalpoints)
However, that library seems to no longer be maintained and therefore I was hoping to use yours instead.
from basicbspline.jl.
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 BSplineManifold
is callable, so you can just add arguments to that. Note that there is also unbounde_mapping
function. This function extrapolate the manifold.
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.
from basicbspline.jl.
Related Issues (20)
- Bug around `issubset` with `UniformKnotVector` HOT 1
- Ways to plot slices of 3D phase fields? HOT 3
- Change return type of `changebasis` from `Matrix` to `SparseMatrixCSC`
- Add string macro to define `KnotVector{Int}` HOT 1
- Performance degression in `changebasis`
- Fix CI failure on Julia1.6
- `changebasis_I` sometimes returns a matrix with `NaN` HOT 2
- Add support for `(::BSplineManifold{1})(::ClosedInterval)` etc.
- Add support for `reverse(::BSplineManifold{1})` etc.
- Use package extensions
- Strange `issqsubset` behavior
- `issqsubset` can be faser
- missing constructor `BSplineSpace`
- Define `hash(::KnotVector, ::UInt)` etc.
- Incorrect `changebasis_I`
- Remove flexibility of `BSplineManifold`
- Add support for Enzyme rules
- `expandspace_I` should throw an error
- Equally spaced points along spline HOT 2
- Add dependency on Public.jl
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from basicbspline.jl.