From ba08816d8d582c8bd8a37f109f6e0a3bd6c5efeb Mon Sep 17 00:00:00 2001 From: Yuto Horikawa Date: Fri, 27 May 2022 20:31:03 -0700 Subject: [PATCH] Update documentation (#222) * update docs for B-spline manifold * remove citation * update documentation for refinement * fix typo --- README.md | 16 ---------------- docs/src/math-bsplinemanifold.md | 26 ++++++++++---------------- docs/src/math-refinement.md | 11 ++++++++--- src/_Fitting.jl | 2 +- 4 files changed, 19 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index 0d511d054..c8f444dea 100644 --- a/README.md +++ b/README.md @@ -172,19 +172,3 @@ save_svg("sine-curve_no-points.svg", M, unitlength=50, xlims=(-2,2), ylims=(-8,8 This is useful when you edit graphs (or curves) with your favorite vector graphics editor. ![](docs/src/img/inkscape.png) - -## Citation -If you use BasicBSpline.jl in your work, please consider citing it by - -```bibtex -@software{yuto_horikawa_2022_6465801, - author = {Yuto Horikawa}, - title = {hyrodium/BasicBSpline.jl: v0.5.6}, - month = apr, - year = 2022, - publisher = {Zenodo}, - version = {v0.5.6}, - doi = {10.5281/zenodo.6465801}, - url = {https://doi.org/10.5281/zenodo.6465801} -} -``` diff --git a/docs/src/math-bsplinemanifold.md b/docs/src/math-bsplinemanifold.md index b15489feb..29b7b6890 100644 --- a/docs/src/math-bsplinemanifold.md +++ b/docs/src/math-bsplinemanifold.md @@ -27,7 +27,7 @@ Higher dimensional tensor products ``\mathcal{P}[p^1,k^1]\otimes\cdots\otimes\ma B-spline manifold is a parametric representation of a shape. !!! tip "Def. B-spline manifold" - For given ``d``-dimensional B-spline basis functions ``B_{(i^1,p^1,k^1)} \otimes \cdots \otimes B_{(i^d,p^d,k^d)}`` and given points ``\bm{a}_{i^1,\dots,i^d} \in \mathbb{R}^{\hat{d}}``, B-spline manifold is defined by following equality: + For given ``d``-dimensional B-spline basis functions ``B_{(i^1,p^1,k^1)} \otimes \cdots \otimes B_{(i^d,p^d,k^d)}`` and given points ``\bm{a}_{i^1,\dots,i^d} \in V``, B-spline manifold is defined by following equality: ```math \bm{p}(t^1,\dots,t^d;\bm{a}_{i^1,\dots,i^d}) =\sum_{i^1,\dots,i^d}(B_{(i^1,p^1,k^1)} \otimes \cdots \otimes B_{(i^d,p^d,k^d)})(t^1,\dots,t^d) \bm{a}_{i^1,\dots,i^d} @@ -88,33 +88,27 @@ savefig("2dim-manifold.html") # hide ## Affine commutativity !!! info "Thm. Affine commutativity" - If ``T`` is a affine transform ``\mathbb{R}^d\to\mathbb{R}^d``, then the following equality holds. + Let ``T`` be a affine transform ``V \to W``, then the following equality holds. ```math T(\bm{p}(t; \bm{a})) =\bm{p}(t; T(\bm{a})) ``` -## Currying +## Fixing arguments (currying) +Just like fixing first index such as `A[3,:]::Array{1}` for matrix `A::Array{2}`, fixing first argument `M(4.3,:)` will create `BSplineManifold{1}` for B-spline surface `M::BSplineManifold{2}`. ```@repl math -p = 2; # degree of polynomial -k = KnotVector(1:8); # knot vector -P = BSplineSpace{p}(k); # B-spline space -rand_a = [SVector(rand(), rand(), rand()) for i in 1:dim(P), j in 1:dim(P)]; -a = [SVector(2*i-6.5, 2*j-6.5, 0) for i in 1:dim(P), j in 1:dim(P)] + rand_a; # random generated control points -M = BSplineManifold(a,(P,P)); # Define B-spline manifold +p = 2; +k = KnotVector(1:8); +P = BSplineSpace{p}(k); +a = [SVector(5i+5j+rand(), 5i-5j+rand(), rand()) for i in 1:dim(P), j in 1:dim(P)]; +M = BSplineManifold(a,(P,P)); M isa BSplineManifold{2} M(:,:) isa BSplineManifold{2} -M(4.3,:) isa BSplineManifold{1} +M(4.3,:) isa BSplineManifold{1} # Fix first argument ``` ```@example math -p = 2 # degree of polynomial -k = KnotVector(1:8) # knot vector -P = BSplineSpace{p}(k) # B-spline space -rand_a = [SVector(rand(), rand(), rand()) for i in 1:dim(P), j in 1:dim(P)] -a = [SVector(2*i-6.5, 2*j-6.5, 0) for i in 1:dim(P), j in 1:dim(P)] + rand_a # random generated control points -M = BSplineManifold(a,(P,P)) # Define B-spline manifold plot(M) plot!(M(4.3,:), linewidth = 5, color=:white) savefig("2dim-manifold-currying.html") # hide diff --git a/docs/src/math-refinement.md b/docs/src/math-refinement.md index b60a0decf..a03d172fd 100644 --- a/docs/src/math-refinement.md +++ b/docs/src/math-refinement.md @@ -7,11 +7,16 @@ using StaticArrays using Plots; plotly() ``` +## Documentation + ```@docs refinement ``` -```@repl math +## Example +### Define original manifold + +```@example math p = 2 # degree of polynomial k = KnotVector(1:8) # knot vector P = BSplineSpace{p}(k) # B-spline space @@ -20,7 +25,7 @@ a = [SVector(2*i-6.5, 2*j-6.5) for i in 1:dim(P), j in 1:dim(P)] + rand_a # rand M = BSplineManifold(a,(P,P)) # Define B-spline manifold ``` -## h-refinemnet +### h-refinemnet Insert additional knots to knot vector. ```@repl math @@ -33,7 +38,7 @@ save_png("2dim_h-refinement.png", M_h) # save image Note that this shape and the last shape are identical. -## p-refinemnet +### p-refinemnet Increase the polynomial degree of B-spline manifold. ```@repl math diff --git a/src/_Fitting.jl b/src/_Fitting.jl index 48b1e5d6e..55364e028 100644 --- a/src/_Fitting.jl +++ b/src/_Fitting.jl @@ -365,7 +365,7 @@ Similarly, for the two-dimensional case, minimize the following integral. ```math \int_{I^1 \times I^2} \left\|f(t^1, t^2)-\sum_{i,j} B_{(i,p^1,k^1)}(t^1)B_{(j,p^2,k^2)}(t^2) \bm{a}_{ij}\right\|^2 dt^1dt^2 ``` -Currently, this function currently supports up to three dimensions. +Currently, this function supports up to three dimensions. # Examples ```jldoctest