Skip to content
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

rewrite to rust #4

Merged
merged 52 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
1bec7a3
rewrite to rust, dynamics and wobble logic
Doublonmousse May 16, 2024
4936552
remove na dependency (use f32 instead)
Doublonmousse May 16, 2024
cb641ad
add state modeler and prediction
Doublonmousse May 17, 2024
3619419
update example svg
Doublonmousse May 17, 2024
02fc609
use `ModelerResult` for return values
Doublonmousse May 17, 2024
d8272b7
remove `KalmanPredictorParams`
Doublonmousse May 17, 2024
531bf87
Create todo.md
Doublonmousse May 17, 2024
16cce22
fmt
Doublonmousse May 17, 2024
2784da5
more tests and fixes
Doublonmousse May 17, 2024
71422cc
more testing and fixes
Doublonmousse May 17, 2024
1dd1fa8
debug tests
Doublonmousse May 17, 2024
497d143
reserve capacities for `vecs` and `vecdecque`
Doublonmousse May 17, 2024
a759ce3
`Copy` vs clone changes
Doublonmousse May 17, 2024
a80fa1a
doc updates (with mathml)
Doublonmousse May 17, 2024
2fb51d8
clippy and fmt fixes
Doublonmousse May 18, 2024
afd651d
fixing wobble test
Doublonmousse May 18, 2024
1df32c1
fix `generate_output_up_nodelta` test
Doublonmousse May 18, 2024
2e21121
Update todo.md
Doublonmousse May 18, 2024
38eff76
fmt
Doublonmousse May 18, 2024
ee91412
justfile for documentation
Doublonmousse May 26, 2024
119dd8b
minor fixes
Doublonmousse May 26, 2024
5553dac
make testing and utils private
Doublonmousse May 26, 2024
d0c409c
visibility changes (pub(crate) instead of public)
Doublonmousse May 26, 2024
b63013c
additional visibility changes and fmt
Doublonmousse May 26, 2024
af717c3
remove getters for `ModelerInput` and `ModelerResult`
Doublonmousse May 26, 2024
cb99866
use `approx` for float comparison
Doublonmousse May 26, 2024
3b299f7
reorganise files (impl closer to their structs)
Doublonmousse May 26, 2024
77666d2
reorganise tests
Doublonmousse May 26, 2024
6509dd5
fix stroke example
Doublonmousse May 30, 2024
98729dd
renamings
Doublonmousse May 30, 2024
cc56d62
fixes for reset and better validation
Doublonmousse May 31, 2024
ec609a2
reset the state modeler and use the new params when resetting with pa…
Doublonmousse May 31, 2024
bdbf252
error if two down event occur in the same stroke
Doublonmousse May 31, 2024
0c7008e
removing the last k
Doublonmousse May 31, 2024
c3149db
catch duplicate event and negative time delta
Doublonmousse May 31, 2024
787d682
fmt and doc update
Doublonmousse May 31, 2024
1fefc23
fix reset bugs
Doublonmousse May 31, 2024
82f8231
Update todo.md
Doublonmousse Jun 2, 2024
eeb21f8
Update README.md
Doublonmousse Jun 2, 2024
ea43035
strongly typed errors for the `update` calls
Doublonmousse Jun 2, 2024
5b0e8d8
Merge branch 'riir' of https://github.com/Doublonmousse/ink-stroke-mo…
Doublonmousse Jun 2, 2024
fc44855
export errors
Doublonmousse Jun 2, 2024
46b43dd
test (change to f64)
Doublonmousse Jun 2, 2024
a4d892e
change tolerance for f64
Doublonmousse Jun 3, 2024
a1f6283
update todo
Doublonmousse Jun 4, 2024
9e77d7a
Merge pull request #1 from Doublonmousse/f64_change
Doublonmousse Jun 5, 2024
db8af85
Merge branch 'riir' of https://github.com/Doublonmousse/ink-stroke-mo…
Doublonmousse Jun 5, 2024
f315433
Update Cargo.toml
Doublonmousse Jun 5, 2024
d1cf321
Update README.md
Doublonmousse Jun 5, 2024
8be3231
Merge pull request #2 from flxzt/Doublonmousse-riir
Doublonmousse Jun 5, 2024
5942187
remove exported submodules
Doublonmousse Jun 6, 2024
2cdd943
remove submodules
Doublonmousse Jun 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,6 @@ license = "MIT OR Apache-2.0"
version = "0.1.0"
edition = "2021"
rust-version = "1.65"
build = "build.rs"

[dependencies]
autocxx = "0.26.0"
cxx = "1.0"
thiserror = "1.0"

[build-dependencies]
autocxx-build = "0.26.0"
cmake = "0.1.50"
miette = {version = "7.2", features = ["fancy"] }
path-slash = "0.2.1"

[dev-dependencies]
anyhow = "1.0"
Expand Down
1 change: 0 additions & 1 deletion abseil-cpp
Submodule abseil-cpp deleted from d7aaad
122 changes: 0 additions & 122 deletions build.rs

This file was deleted.

Binary file added docs/math_part.pdf
Binary file not shown.
6 changes: 6 additions & 0 deletions docs/math_part.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include "notations.typ" //exported to html
#include "wobble.typ" //exported using wobble_list.typ, ok
#include "resampling.typ" //exporting using resampling_list
#include "position_modeling.typ" //exported to html
#include "stroke_end.typ" //exported using `stroke_end_list`
#include "stylus_state_modeler.typ" //exported using `stylus_state_modeler_list`
47 changes: 47 additions & 0 deletions docs/notations.html
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>kDown</code> event</p></li>
<li><p>contains <code>KMove</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>kMove</code> or a <code>kUp</code> . If
it is a <code>kUp</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>
31 changes: 31 additions & 0 deletions docs/notations.typ
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("kDown") event
- contains #raw("KMove") for $k >=1$
- ends either with a #raw("kMove") or a #raw("kUp") . If it is a #raw("kUp") 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$
]
Loading
Loading