Java based cubic spline interpolation with JavaFX user interface.
This program can show four different types of cubic spline interpolation within eight nodes.
Types of common boundary conditions:
- Clamped (fixed)
- Natural (soft)
- Cyclic
- Acyclic
Java version 23.0.1
JavaFX version 23.0.1
800x600 pixels screen
-
Download latest JDK and install it (adding variables to PATH).
-
Make sure you have javac.exe compiler
C:\Users\USER\.jdks\jdk-{version}\bin\javac.exe
-
Download latest JavaFx library and extract contents whereever it is reachable.
-
To compile, open command line in source code directory and write
javac.exe --module-path {Path to your javafx lib folder} --add-modules=javafx.controls Main.java
- For example if JavaFx contents extracted to
С:\Java
Then command should look like this:
javac.exe --module-path "C:\Java\javafx-sdk-23.0.1\lib" --add-modules=javafx.controls Main.java
- If you have problems with javac.exe, try to write absolute path to javac.exe (see p.2)
- For example if JavaFx contents extracted to
-
After compilation run
Main
file:
java --module-path {Path to your javafx lib folder} --add-modules=javafx.controls Main
-
Run
sudo apt update
andsudo apt upgrade
-
Download latest JDK for your Linux system and install it.
-
Download latest JavaFx library and extract contents whereever it is reachable.
-
To compile, open command line in source code directory and write
javac --module-path {Path to your javafx lib folder} --add-modules=javafx.controls Main.java
- For example if JavaFx contents extracted to
home/USER/Java
Then command should look like this:
javac --module-path "home/USER/Java/javafx-sdk-23.0.1/lib" --add-modules=javafx.controls Main.java
- For example if JavaFx contents extracted to
-
After compilation run
Main
file:
java --module-path {Path to your javafx lib folder} --add-modules=javafx.controls Main
After successful compilation you will see something like this:
It is possible to change each node coordinate within 20x20 Cartesian coordinate system. To do such thing you need to enter coordinate in exact text field and then condirm your choise by pressing "Enter!" button. Nodes will move.
Or you can just press randomization button "Random".
Note
Two different nodes can not have same X and Y coordinate
After that you can choose type of cubic spline interpolation by opening a dropdown menu like this:
After choosing boundary type just press big button "Calculate!". By pressing that program will calculate cubic spline interpolation.
Tip
Fixed (clamped) boundary condition implies that endpoint vectors are known. To enter them use four text fields just below dropdown menu. By default endpoint vectors are (0;0)
and (0;0)
To erase cubic spline just press "Clear" button on top right of the screen.
Sometimes due to simplicity of interpolation ("Loaded" spline method is not used) it is possible to go beyond the coordinate system towards the interface buttons. The program will indicate that some parts of the lines are not drawn.
If you see such a thing try to switch to "Fixed" type of boundary condition or just regenerate set of nodes.
- Mathematical Elements for Computer Graphics. David F. Rodgers, James Alan Adams. ISBN 0070535272.