Skip to content

Commit

Permalink
Update documentation (#222)
Browse files Browse the repository at this point in the history
* update docs for B-spline manifold

* remove citation

* update documentation for refinement

* fix typo
  • Loading branch information
hyrodium authored May 28, 2022
1 parent 98cb027 commit ba08816
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 36 deletions.
16 changes: 0 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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}
}
```
26 changes: 10 additions & 16 deletions docs/src/math-bsplinemanifold.md
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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
Expand Down
11 changes: 8 additions & 3 deletions docs/src/math-refinement.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/_Fitting.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ba08816

Please sign in to comment.