-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: rewrite of
ink-stroke-modeler
in Rust (#4)
- Loading branch information
1 parent
94d5d72
commit 124cde7
Showing
35 changed files
with
5,193 additions
and
2,428 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +0,0 @@ | ||
[submodule "ink-stroke-modeler"] | ||
path = ink-stroke-modeler | ||
url = https://github.com/flxzt/ink-stroke-modeler | ||
[submodule "abseil-cpp"] | ||
path = abseil-cpp | ||
url = https://github.com/abseil/abseil-cpp.git | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,14 @@ | ||
[package] | ||
build = "build.rs" | ||
edition = "2021" | ||
license = "MIT OR Apache-2.0" | ||
name = "ink-stroke-modeler-rs" | ||
rust-version = "1.65" | ||
license = "MIT OR Apache-2.0" | ||
version = "0.1.0" | ||
|
||
[dependencies] | ||
autocxx = "0.26.0" | ||
cxx = "1.0" | ||
thiserror = "1.0" | ||
|
||
[build-dependencies] | ||
anyhow = "1.0" | ||
autocxx-build = "0.26.0" | ||
autocxx-engine = "0.26.0" | ||
cmake = "0.1.50" | ||
path-slash = "0.2.1" | ||
pkg-config = "0.3.30" | ||
edition = "2021" | ||
rust-version = "1.65" | ||
|
||
[dev-dependencies] | ||
approx = "0.5.1" | ||
anyhow = "1.0" | ||
svg = "0.17.0" | ||
svg = "0.16.0" | ||
tracing = "0.1.40" | ||
|
||
[features] | ||
default = ["build_absl"] | ||
build_absl = [] | ||
[dependencies] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule abseil-cpp
deleted from
d7aaad
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#include "notations.typ" | ||
#include "wobble.typ" | ||
#include "resampling.typ" | ||
#include "position_modeling.typ" | ||
#include "stroke_end.typ" | ||
#include "stylus_state_modeler.typ" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<h2>Notations</h2> | ||
<div class="box"> | ||
<p>We denote :</p> | ||
<ul> | ||
<li><p>Pressure : | ||
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>ν</mi><mo>∈</mo><mo stretchy="false" form="prefix">[</mo><mn>0</mn><mo>,</mo><mn>1</mn><mo stretchy="false" form="postfix">]</mo></mrow><annotation encoding="application/x-tex">\nu \in \lbrack 0,1\rbrack</annotation></semantics></math></p></li> | ||
<li><p>time : | ||
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>t</mi><mo>≥</mo><mn>0</mn></mrow><annotation encoding="application/x-tex">t \geq 0</annotation></semantics></math></p></li> | ||
<li><p>point : defined by position | ||
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mi>x</mi><annotation encoding="application/x-tex">x</annotation></semantics></math> | ||
and | ||
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mi>y</mi><annotation encoding="application/x-tex">y</annotation></semantics></math> | ||
(or | ||
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>p</mi><mo>=</mo><mrow><mo stretchy="true" form="prefix">(</mo><mi>x</mi><mo>,</mo><mi>y</mi><mo stretchy="true" form="postfix">)</mo></mrow><mo>∈</mo><msup><mi>ℝ</mi><mn>2</mn></msup></mrow><annotation encoding="application/x-tex">p = (x,y) \in {\mathbb{R}}^{2}</annotation></semantics></math>)</p></li> | ||
<li><p>Raw inputs are denoted by a tuple | ||
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>i</mi><mo stretchy="false" form="prefix">[</mo><mi>k</mi><mo stretchy="false" form="postfix">]</mo><mo>=</mo><mrow><mo stretchy="true" form="prefix">(</mo><mi>ν</mi><mo stretchy="false" form="prefix">[</mo><mi>k</mi><mo stretchy="false" form="postfix">]</mo><mo>,</mo><mi>t</mi><mo stretchy="false" form="prefix">[</mo><mi>k</mi><mo stretchy="false" form="postfix">]</mo><mo>,</mo><mi>x</mi><mo stretchy="false" form="prefix">[</mo><mi>k</mi><mo stretchy="false" form="postfix">]</mo><mo>,</mo><mi>y</mi><mo stretchy="false" form="prefix">[</mo><mi>k</mi><mo stretchy="false" form="postfix">]</mo><mo stretchy="true" form="postfix">)</mo></mrow></mrow><annotation encoding="application/x-tex">i\lbrack k\rbrack = \left( \nu\lbrack k\rbrack,t\lbrack k\rbrack,x\lbrack k\rbrack,y\lbrack k\rbrack \right)</annotation></semantics></math> | ||
with | ||
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>k</mi><mo>∈</mo><mi>ℕ</mi></mrow><annotation encoding="application/x-tex">k \in {\mathbb{N}}</annotation></semantics></math>.</p></li> | ||
</ul> | ||
</div> | ||
<div class="box"> | ||
<p>An <em>input stream</em> is a sequence of raw inputs | ||
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>i</mi><mo>=</mo><mrow><mo stretchy="true" form="prefix">(</mo><mi>ν</mi><mo>,</mo><mi>t</mi><mo>,</mo><mi>x</mi><mo>,</mo><mi>y</mi><mo stretchy="true" form="postfix">)</mo></mrow></mrow><annotation encoding="application/x-tex">i = (\nu,t,x,y)</annotation></semantics></math></p> | ||
<ul> | ||
<li><p>with time | ||
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>t</mi><mo stretchy="false" form="prefix">[</mo><mi>k</mi><mo stretchy="false" form="postfix">]</mo></mrow><annotation encoding="application/x-tex">t\lbrack k\rbrack</annotation></semantics></math> | ||
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mo>↗</mo><mo>↗</mo></mrow><annotation encoding="application/x-tex">\nearrow \nearrow</annotation></semantics></math> | ||
strictly increasing</p></li> | ||
<li><p>starts with a <code>Down</code> event</p></li> | ||
<li><p>contains <code>Move</code> for | ||
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>k</mi><mo>≥</mo><mn>1</mn></mrow><annotation encoding="application/x-tex">k \geq 1</annotation></semantics></math></p></li> | ||
<li><p>ends either with a <code>Move</code> or a <code>Up</code> . If it | ||
is a <code>Up</code> we say the input stream is | ||
<em>complete</em></p></li> | ||
</ul> | ||
</div> | ||
<div class="box"> | ||
<p>We addition define</p> | ||
<ul> | ||
<li><p><math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>v</mi><mi>x</mi></msub><mo>,</mo><msub><mi>v</mi><mi>y</mi></msub><mo>,</mo><msub><mi>a</mi><mi>x</mi></msub><mo>,</mo><msub><mi>a</mi><mi>y</mi></msub></mrow><annotation encoding="application/x-tex">v_{x},v_{y},a_{x},a_{y}</annotation></semantics></math> | ||
as the velocity and acceleration.</p></li> | ||
</ul> | ||
<p>With the vector shorthand | ||
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>v</mi><mo>=</mo><mrow><mo stretchy="true" form="prefix">(</mo><msub><mi>v</mi><mi>x</mi></msub><mo>,</mo><msub><mi>v</mi><mi>y</mi></msub><mo stretchy="true" form="postfix">)</mo></mrow><mo>∈</mo><msup><mi>ℝ</mi><mn>2</mn></msup></mrow><annotation encoding="application/x-tex">v = \left( v_{x},v_{y} \right) \in {\mathbb{R}}^{2}</annotation></semantics></math> | ||
and | ||
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>a</mi><mo>=</mo><mrow><mo stretchy="true" form="prefix">(</mo><msub><mi>a</mi><mi>x</mi></msub><mo>,</mo><msub><mi>a</mi><mi>y</mi></msub><mo stretchy="true" form="postfix">)</mo></mrow><mo>∈</mo><msup><mi>ℝ</mi><mn>2</mn></msup></mrow><annotation encoding="application/x-tex">a = \left( a_{x},a_{y} \right) \in {\mathbb{R}}^{2}</annotation></semantics></math></p> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#set page(width: 16cm, margin: 0.5em, height: auto) | ||
#let definition(content) = box(fill: luma(92%), width: 100%, inset: 0.5em, stroke: black)[#content] | ||
|
||
#import "@preview/lovelace:0.2.0": * | ||
#show: setup-lovelace.with(body-inset: 0pt) | ||
|
||
#let pr = $nu$ | ||
#let time = $t$ | ||
== Notations | ||
|
||
#definition[ | ||
We denote : | ||
- Pressure : $pr in [0,1]$ | ||
- time : $t >=0$ | ||
- point : defined by position $x$ and $y$ (or $p = (x,y) in RR^2$) | ||
- Raw inputs are denoted by a tuple $i[k] = (pr[k], t[k], x[k],y[k])$ with $k in NN$. | ||
] | ||
|
||
#definition[ | ||
An _input stream_ is a sequence of raw inputs $i = (pr, t,x,y)$ | ||
- with time $t[k]$ $arrow.tr arrow.tr$ strictly increasing | ||
- starts with a #raw("Down") event | ||
- contains #raw("Move") for $k >=1$ | ||
- ends either with a #raw("Move") or a #raw("Up") . If it is a #raw("Up") we say the input stream is _complete_ | ||
] | ||
|
||
#definition[ | ||
We addition define | ||
- $v_x, v_y, a_x, a_y$ as the velocity and acceleration. | ||
With the vector shorthand $v = (v_x,v_y) in RR^2$ and $a = (a_x, a_y) in RR^2$ | ||
] |
Oops, something went wrong.