├── .gitattributes ├── .github └── workflows │ ├── check-spotless.yaml │ └── ci.yaml ├── .gitignore ├── CONTRIBUTING.md ├── HEADER.txt ├── LICENSE.txt ├── README.md ├── build.gradle ├── gradle.properties ├── gradle ├── libs.versions.toml └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── renovate.json ├── settings.gradle └── src ├── main ├── float-templates │ └── org │ │ └── spongepowered │ │ └── math │ │ ├── imaginary │ │ ├── Complex{{E}}.java.peb │ │ ├── Imaginary{{E}}.java.peb │ │ └── Quaternion{{E}}.java.peb │ │ ├── matrix │ │ ├── Matrix2{{E}}.java.peb │ │ ├── Matrix3{{E}}.java.peb │ │ ├── Matrix4{{E}}.java.peb │ │ ├── MatrixN{{E}}.java.peb │ │ └── Matrix{{E}}.java.peb │ │ └── vector │ │ ├── Vector2{{E}}.java.peb │ │ ├── Vector3{{E}}.java.peb │ │ ├── Vector4{{E}}.java.peb │ │ ├── VectorN{{E}}.java.peb │ │ └── Vector{{E}}.java.peb ├── floatCommon-templates │ └── org │ │ └── spongepowered │ │ └── math │ │ └── GenericMath.java.peb ├── integer-templates │ └── org │ │ └── spongepowered │ │ └── math │ │ └── vector │ │ ├── Vector2{{E}}.java.peb │ │ ├── Vector3{{E}}.java.peb │ │ ├── Vector4{{E}}.java.peb │ │ ├── VectorN{{E}}.java.peb │ │ └── Vector{{E}}.java.peb ├── java │ └── org │ │ └── spongepowered │ │ └── math │ │ ├── HashFunctions.java │ │ ├── TrigMath.java │ │ ├── imaginary │ │ └── package-info.java │ │ ├── matrix │ │ └── package-info.java │ │ └── vector │ │ └── package-info.java └── java9 │ └── module-info.java ├── templateData ├── float.yaml └── integer.yaml └── test ├── float-templates └── com │ └── flowpowered │ └── math │ └── test │ ├── TestUtil{{E}}.java.peb │ ├── imaginary │ ├── Complex{{E}}Test.java.peb │ └── Quaternion{{E}}Test.java.peb │ ├── matrix │ ├── Matrix2{{E}}Test.java.peb │ ├── Matrix3{{E}}Test.java.peb │ ├── Matrix4{{E}}Test.java.peb │ └── MatrixN{{E}}Test.java.peb │ └── vector │ ├── Vector2{{E}}Test.java.peb │ ├── Vector3{{E}}Test.java.peb │ ├── Vector4{{E}}Test.java.peb │ └── VectorN{{E}}Test.java.peb ├── integer-templates └── com │ └── flowpowered │ └── math │ └── test │ ├── TestUtil{{E}}.java.peb │ └── vector │ ├── Vector2{{E}}Test.java.peb │ ├── Vector3{{E}}Test.java.peb │ ├── Vector4{{E}}Test.java.peb │ └── VectorN{{E}}Test.java.peb └── java └── org └── spongepowered └── math └── test ├── GenericMathTest.java └── TrigMathTest.java /.gitattributes: -------------------------------------------------------------------------------- 1 | # Normalize as LF in the repository, OS native locally 2 | * text=auto 3 | *.java text 4 | 5 | # Binary files that should not be modified 6 | *.dat binary 7 | *.db binary 8 | *.gif binary 9 | *.icns binary 10 | *.ico binary 11 | *.jks binary 12 | *.jpg binary 13 | *.key binary 14 | *.png binary 15 | *.ttf binary 16 | *.wav binary 17 | JavaApplicationStub binary 18 | -------------------------------------------------------------------------------- /.github/workflows/check-spotless.yaml: -------------------------------------------------------------------------------- 1 | # This workflow will build a Java project with Gradle 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle 3 | 4 | name: Spotless Check 5 | 6 | on: 7 | push: 8 | branches: "**" 9 | tags-ignore: ["**"] 10 | pull_request: 11 | 12 | jobs: 13 | call-check: 14 | uses: SpongePowered/.github/.github/workflows/shared-check-spotless.yaml@master 15 | with: 16 | runtime_version: 17 17 | secrets: inherit 18 | -------------------------------------------------------------------------------- /.github/workflows/ci.yaml: -------------------------------------------------------------------------------- 1 | # Making changes? https://github.com/nektos/act may help you test locally 2 | 3 | name: Build, Test, and Deploy 4 | 5 | on: 6 | push: 7 | branches: "**" 8 | tags-ignore: ["**"] 9 | pull_request: 10 | release: 11 | types: [released] 12 | 13 | jobs: 14 | call-build: 15 | uses: SpongePowered/.github/.github/workflows/shared-ci.yaml@master 16 | with: 17 | runtime_version: 17 18 | publish_snapshot_javadoc: true 19 | secrets: inherit 20 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Build # 2 | ######### 3 | MANIFEST.MF 4 | dependency-reduced-pom.xml 5 | 6 | # Compiled # 7 | ############ 8 | bin 9 | build 10 | dist 11 | lib 12 | out 13 | run 14 | target/ 15 | !target/generated-sources 16 | !target/generated-test-sources 17 | *.com 18 | *.class 19 | *.dll 20 | *.exe 21 | *.o 22 | *.so 23 | 24 | # Databases # 25 | ############# 26 | *.db 27 | *.sql 28 | *.sqlite 29 | 30 | # Packages # 31 | ############ 32 | *.7z 33 | *.dmg 34 | *.ear 35 | *.gz 36 | *.iso 37 | *.jar 38 | !/gradle/wrapper/gradle-wrapper.jar 39 | *.rar 40 | *.tar 41 | *.war 42 | *.zip 43 | 44 | # Repository # 45 | ############## 46 | .git 47 | 48 | # Logging # 49 | ########### 50 | /logs 51 | *.log 52 | 53 | # Misc # 54 | ######## 55 | *.bak 56 | *.tmp 57 | 58 | # System # 59 | ########## 60 | .DS_Store 61 | ehthumbs.db 62 | Thumbs.db 63 | 64 | # Project # 65 | ########### 66 | .buildpath 67 | .classpath 68 | .cproject 69 | .externalToolBuilders 70 | .gradle 71 | .idea 72 | .project 73 | .settings 74 | nbproject 75 | atlassian-ide-plugin.xml 76 | build.xml 77 | nb-configuration.xml 78 | *.iml 79 | *.ipr 80 | *.iws 81 | *.launch 82 | *.pydevproject 83 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Sponge's math library is happy to accept improvements and fixes from interested contributors! 4 | 5 | While the `math` library targets Java 8 and below at runtime, the preferred development environment is JDK 11. 6 | 7 | Developing on the library is a bit complicated due to the use of the [Pebble] template engine -- the majority of the project's 8 | source is generated based on several sets of templates. Any additions should use templates wherever applicable to reduce duplication. 9 | 10 | ## Working with templates 11 | 12 | On first import into an IDE, run the `generateTemplates` task to ensure templates have been generated. In Eclipse, 13 | this task is registered as an "autobuild" task, which should keep the IDE in sync with changes to templates. 14 | 15 | There is some IDE support for the Pebble syntax. An [IntelliJ plugin](https://plugins.jetbrains.com/plugin/9407-pebble) exists, though it does 16 | little more than syntax highlighting. 17 | 18 | IntelliJ also has a setting that attempts to highlight template files as Java source files 19 | (available under Preferences > Languages & Frameworks > Template Data Languages). This option is of varying effectiveness depending on the source file. 20 | 21 | ## Inside the template generator 22 | 23 | *Math* uses a simple Gradle plugin that allows attaching *template sets* to Gradle source sets. 24 | 25 | Each template set produces output from a different source directory, by default in the `src//template/