Skip to content

Commit 7e75517

Browse files
committed
Update screenshots, README
1 parent c43b984 commit 7e75517

File tree

6 files changed

+41
-7
lines changed

6 files changed

+41
-7
lines changed

README.md

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,41 @@
11
# SimplyGraph
22

3-
#### This project is in very early development, and most features are not yet ready
3+
A simple, fast graphing calculator for Android
4+
5+
Follows the latest Material 3 design guidelines and adapts to the system color (Material You)
6+
7+
Supports explicit and implicit functions and relations, polar functions, and parametric relations
8+
9+
## Screenshots
410

511
<p width="100%">
6-
<img src="screenshot.png" width="30%">
7-
<img src="screenshot2.png" width="30%">
8-
<img src="screenshot3.png" width="30%">
9-
</p>
12+
<img src="screenshot.png" width="24%">
13+
<img src="screenshot2.png" width="24%">
14+
<img src="screenshot3.png" width="24%">
15+
<img src="screenshot4.png" width="24%">
16+
</p>
17+
18+
## How it works
19+
20+
This app utilises JNI to offload the graph point calculation to native C++ for extremely fast
21+
calculation of points (at least a few orders of magnitude improvement over Kotlin code in my own
22+
benchmarks). The basic layout of how it works is:
23+
24+
- (Steps)
25+
26+
1. Function string input by user
27+
2. JNI function called: Function string, canvas geometry data, scale and offset are passed
28+
3. JNI performs C++ function call passing all the data
29+
4. C++ function returns std::vector<float> containing point data
30+
5. JNI returns array of floats
31+
6. Points are plotted on Jetpack Compose Canvas
32+
33+
The exact working is slightly more complex, for example the C++ point calculation function analyses
34+
the function string to determine whether it is explicit, implicit, polar or parametric and performs
35+
the calculations accordingly, and also simplifies the graph if there are too many points to save
36+
memory and drawing time.
37+
38+
### Special thanks
39+
40+
- This app uses [ExprTk](https://github.com/ArashPartow/exprtk) to evaluate mathematical
41+
expressions. Thanks to Arash Partow for creating this library.

app/src/main/java/org/nsh07/simplygraph/ui/AppScreen.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ import androidx.compose.ui.Modifier
4848
import androidx.compose.ui.draw.clipToBounds
4949
import androidx.compose.ui.geometry.Offset
5050
import androidx.compose.ui.graphics.PointMode
51+
import androidx.compose.ui.graphics.StrokeCap
5152
import androidx.compose.ui.res.painterResource
5253
import androidx.compose.ui.text.input.ImeAction
5354
import androidx.compose.ui.text.style.TextAlign
@@ -68,7 +69,7 @@ fun AppScreen(modifier: Modifier = Modifier) {
6869

6970
val expandSheet = remember(functionsState.function) {
7071
functionsState.function.matches(
71-
"\\s*r\\s*=\\s*\\S+\\s*|\\s*\\(\\s*\\S+\\s*,\\s*\\S+\\s*\\)\\s*".toRegex()
72+
"\\s*r\\s*=.+|\\s*\\(.+,.+\\)\\s*".toRegex()
7273
)
7374
}
7475

@@ -282,7 +283,8 @@ fun AppScreen(modifier: Modifier = Modifier) {
282283
PointMode.Points
283284
else PointMode.Polygon,
284285
color = colorScheme.primary,
285-
strokeWidth = 3.dp.toPx()
286+
strokeWidth = 3.dp.toPx(),
287+
cap = StrokeCap.Round
286288
)
287289
}
288290
FloatingActionButton(

screenshot.png

-61.7 KB
Loading

screenshot2.png

-2.8 KB
Loading

screenshot3.png

-45.6 KB
Loading

screenshot4.png

312 KB
Loading

0 commit comments

Comments
 (0)