├── .github ├── dependabot.yml └── workflows │ ├── Tools.java │ ├── deploy-release.sh │ ├── deploy-snapshot.sh │ ├── deploy.linux.temurin.lts.yml │ ├── main.linux.temurin.current.yml │ ├── main.linux.temurin.lts.yml │ ├── main.windows.temurin.current.yml │ ├── main.windows.temurin.lts.yml │ ├── pr.linux.temurin.current.yml │ ├── pr.linux.temurin.lts.yml │ ├── pr.windows.temurin.current.yml │ ├── pr.windows.temurin.lts.yml │ ├── run-with-xvfb.sh │ └── wallpaper.png ├── .gitignore ├── .gitmodules ├── README-CHANGES.xml ├── README-LICENSE.txt ├── README.md ├── com.io7m.jspatial.api ├── pom.xml └── src │ └── main │ └── java │ ├── com │ └── io7m │ │ └── jspatial │ │ └── api │ │ ├── Ray2DType.java │ │ ├── Ray3DType.java │ │ ├── TreeVisitResult.java │ │ ├── octtrees │ │ ├── OctTreeConfigurationDType.java │ │ ├── OctTreeConfigurationIType.java │ │ ├── OctTreeConfigurationLType.java │ │ ├── OctTreeDType.java │ │ ├── OctTreeIType.java │ │ ├── OctTreeLType.java │ │ ├── OctTreeOctantDType.java │ │ ├── OctTreeOctantIType.java │ │ ├── OctTreeOctantIterationDType.java │ │ ├── OctTreeOctantIterationIType.java │ │ ├── OctTreeOctantIterationLType.java │ │ ├── OctTreeOctantLType.java │ │ ├── OctTreeRaycastResultDType.java │ │ ├── OctTreeRaycastResultIType.java │ │ ├── OctTreeRaycastResultLType.java │ │ ├── OctTreeReadableDType.java │ │ ├── OctTreeReadableIType.java │ │ ├── OctTreeReadableLType.java │ │ ├── OctTreeReadableType.java │ │ ├── OctTreeSupplierDType.java │ │ ├── OctTreeSupplierIType.java │ │ ├── OctTreeSupplierLType.java │ │ └── package-info.java │ │ ├── package-info.java │ │ └── quadtrees │ │ ├── QuadTreeConfigurationDType.java │ │ ├── QuadTreeConfigurationIType.java │ │ ├── QuadTreeConfigurationLType.java │ │ ├── QuadTreeDType.java │ │ ├── QuadTreeIType.java │ │ ├── QuadTreeLType.java │ │ ├── QuadTreeQuadrantDType.java │ │ ├── QuadTreeQuadrantIType.java │ │ ├── QuadTreeQuadrantIterationDType.java │ │ ├── QuadTreeQuadrantIterationIType.java │ │ ├── QuadTreeQuadrantIterationLType.java │ │ ├── QuadTreeQuadrantLType.java │ │ ├── QuadTreeRaycastResultDType.java │ │ ├── QuadTreeRaycastResultIType.java │ │ ├── QuadTreeRaycastResultLType.java │ │ ├── QuadTreeReadableDType.java │ │ ├── QuadTreeReadableIType.java │ │ ├── QuadTreeReadableLType.java │ │ ├── QuadTreeReadableType.java │ │ ├── QuadTreeSupplierDType.java │ │ ├── QuadTreeSupplierIType.java │ │ ├── QuadTreeSupplierLType.java │ │ └── package-info.java │ └── module-info.java ├── com.io7m.jspatial.documentation ├── pom.xml └── src │ └── main │ ├── assembly │ └── documentation.xml │ ├── java │ ├── com │ │ └── io7m │ │ │ └── jspatial │ │ │ └── documentation │ │ │ ├── Documentation.java │ │ │ └── package-info.java │ └── module-info.java │ └── resources │ └── com │ └── io7m │ └── jspatial │ └── documentation │ ├── brand.xml │ ├── documentation.css │ └── documentation.xml ├── com.io7m.jspatial.examples.swing ├── pom.xml └── src │ └── main │ ├── assembly │ └── viewer.xml │ ├── exe │ ├── quadtree-viewer-unix.sh │ ├── quadtree-viewer.ico │ ├── quadtree-viewer.l4j.ini │ └── quadtree-viewer.xcf │ └── java │ ├── com │ └── io7m │ │ └── jspatial │ │ └── examples │ │ └── swing │ │ ├── LogMessageType.java │ │ ├── QuadTreeCanvas.java │ │ ├── QuadTreeComboBox.java │ │ ├── QuadTreeCommandType.java │ │ ├── QuadTreeControls.java │ │ ├── QuadTreeKind.java │ │ ├── QuadTreeViewerMain.java │ │ ├── QuadTreeWindow.java │ │ └── package-info.java │ └── module-info.java ├── com.io7m.jspatial.implementation ├── pom.xml └── src │ └── main │ ├── java │ ├── com │ │ └── io7m │ │ │ └── jspatial │ │ │ └── implementation │ │ │ ├── OctTreeD.java │ │ │ ├── OctTreeI.java │ │ │ ├── OctTreeL.java │ │ │ ├── OctTreeSupplierD.java │ │ │ ├── OctTreeSupplierI.java │ │ │ ├── OctTreeSupplierL.java │ │ │ ├── OctantsD.java │ │ │ ├── OctantsI.java │ │ │ ├── OctantsL.java │ │ │ ├── QuadTreeD.java │ │ │ ├── QuadTreeI.java │ │ │ ├── QuadTreeL.java │ │ │ ├── QuadTreeSupplierD.java │ │ │ ├── QuadTreeSupplierI.java │ │ │ ├── QuadTreeSupplierL.java │ │ │ ├── QuadrantsD.java │ │ │ ├── QuadrantsI.java │ │ │ ├── QuadrantsL.java │ │ │ └── package-info.java │ └── module-info.java │ └── resources │ └── META-INF │ └── services │ ├── com.io7m.jspatial.api.octtrees.OctTreeSupplierDType │ ├── com.io7m.jspatial.api.octtrees.OctTreeSupplierIType │ ├── com.io7m.jspatial.api.octtrees.OctTreeSupplierLType │ ├── com.io7m.jspatial.api.quadtrees.QuadTreeSupplierDType │ ├── com.io7m.jspatial.api.quadtrees.QuadTreeSupplierIType │ └── com.io7m.jspatial.api.quadtrees.QuadTreeSupplierLType ├── com.io7m.jspatial.tests ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── io7m │ └── jspatial │ └── tests │ ├── TestUtilities.java │ ├── api │ ├── AreaDContainedGenerator.java │ ├── AreaIContainedGenerator.java │ ├── AreaLContainedGenerator.java │ ├── RayI2DTest.java │ ├── RayI3DTest.java │ ├── VolumeDContainedGenerator.java │ ├── VolumeIContainedGenerator.java │ ├── VolumeLContainedGenerator.java │ ├── octtrees │ │ ├── OctTreeConfigurationDContract.java │ │ ├── OctTreeConfigurationDGenerator.java │ │ ├── OctTreeConfigurationDTest.java │ │ ├── OctTreeConfigurationIContract.java │ │ ├── OctTreeConfigurationIGenerator.java │ │ ├── OctTreeConfigurationITest.java │ │ ├── OctTreeConfigurationLContract.java │ │ ├── OctTreeConfigurationLGenerator.java │ │ ├── OctTreeConfigurationLTest.java │ │ ├── OctTreeDContract.java │ │ ├── OctTreeIContract.java │ │ ├── OctTreeLContract.java │ │ ├── OctTreeRaycastResultDContract.java │ │ ├── OctTreeRaycastResultDGenerator.java │ │ ├── OctTreeRaycastResultDTest.java │ │ ├── OctTreeRaycastResultIContract.java │ │ ├── OctTreeRaycastResultIGenerator.java │ │ ├── OctTreeRaycastResultITest.java │ │ ├── OctTreeRaycastResultLContract.java │ │ ├── OctTreeRaycastResultLGenerator.java │ │ ├── OctTreeRaycastResultLTest.java │ │ └── package-info.java │ ├── package-info.java │ └── quadtrees │ │ ├── QuadTreeConfigurationDContract.java │ │ ├── QuadTreeConfigurationDGenerator.java │ │ ├── QuadTreeConfigurationDTest.java │ │ ├── QuadTreeConfigurationIContract.java │ │ ├── QuadTreeConfigurationIGenerator.java │ │ ├── QuadTreeConfigurationITest.java │ │ ├── QuadTreeConfigurationLContract.java │ │ ├── QuadTreeConfigurationLGenerator.java │ │ ├── QuadTreeConfigurationLTest.java │ │ ├── QuadTreeDContract.java │ │ ├── QuadTreeIContract.java │ │ ├── QuadTreeLContract.java │ │ ├── QuadTreeRaycastResultDContract.java │ │ ├── QuadTreeRaycastResultDGenerator.java │ │ ├── QuadTreeRaycastResultDTest.java │ │ ├── QuadTreeRaycastResultIContract.java │ │ ├── QuadTreeRaycastResultIGenerator.java │ │ ├── QuadTreeRaycastResultITest.java │ │ ├── QuadTreeRaycastResultLContract.java │ │ ├── QuadTreeRaycastResultLGenerator.java │ │ ├── QuadTreeRaycastResultLTest.java │ │ └── package-info.java │ ├── bugs │ └── Bug7.java │ ├── implementation │ ├── OctTreeDTest.java │ ├── OctTreeITest.java │ ├── OctTreeLTest.java │ ├── OctantsDTest.java │ ├── OctantsITest.java │ ├── OctantsLTest.java │ ├── QuadTreeDTest.java │ ├── QuadTreeITest.java │ ├── QuadTreeLTest.java │ ├── QuadrantsDTest.java │ ├── QuadrantsITest.java │ ├── QuadrantsLTest.java │ └── package-info.java │ ├── package-info.java │ └── rules │ ├── PercentagePassRule.java │ ├── PercentagePassTest.java │ ├── PercentagePassing.java │ └── package-info.java ├── pom.xml ├── spotbugs-filter.xml └── src └── site └── resources ├── documentation.xml ├── features.xml ├── header.xml ├── icon.png ├── jspatial.jpg ├── overview.xml ├── quadview.png ├── quadview_sm.png ├── site.css └── viewer.png /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | 2 | version: 2 3 | 4 | updates: 5 | - package-ecosystem: "github-actions" 6 | directory: "/" 7 | schedule: 8 | interval: "monthly" 9 | 10 | - package-ecosystem: "maven" 11 | directory: "/" 12 | schedule: 13 | interval: "monthly" 14 | 15 | target-branch: "develop" 16 | ignore: 17 | - dependency-name: "*" 18 | update-types: [ "version-update:semver-major" ] 19 | -------------------------------------------------------------------------------- /.github/workflows/deploy-release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Automatically generated: DO NOT EDIT. 4 | # 5 | # Generation code: https://www.github.com/io7m-com/.github/ 6 | # 7 | 8 | fatal() 9 | { 10 | echo "fatal: $1" 1>&2 11 | exit 1 12 | } 13 | 14 | if [ -z "${MAVEN_CENTRAL_USERNAME}" ] 15 | then 16 | fatal "MAVEN_CENTRAL_USERNAME is not set." 17 | fi 18 | 19 | if [ -z "${MAVEN_CENTRAL_PASSWORD}" ] 20 | then 21 | fatal "MAVEN_CENTRAL_PASSWORD is not set." 22 | fi 23 | 24 | (cat < 29 | 30 | 31 | 32 | io7m-oci-image 33 | 34 | 35 | 36 | 37 | io7m 38 | 39 | true 40 | github-ci-maven-rsa-key 41 | true 42 | 43 | 44 | 45 | 46 | 47 | 48 | sonatype-nexus-snapshots 49 | ${MAVEN_CENTRAL_USERNAME} 50 | ${MAVEN_CENTRAL_PASSWORD} 51 | 52 | 53 | sonatype-nexus-staging 54 | ${MAVEN_CENTRAL_USERNAME} 55 | ${MAVEN_CENTRAL_PASSWORD} 56 | 57 | 58 | 59 | EOF 60 | ) > "$HOME/.m2/settings.xml" || fatal "could not update $HOME/.m2/settings.xml" 61 | 62 | exec mvn \ 63 | -Dio7m.release=true \ 64 | -Dio7m.deployment=true \ 65 | --batch-mode \ 66 | --strict-checksums \ 67 | -Denforcer.skip=true \ 68 | -DskipTests=true \ 69 | -DskipITs=true deploy 70 | -------------------------------------------------------------------------------- /.github/workflows/deploy-snapshot.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Automatically generated: DO NOT EDIT. 4 | # 5 | # Generation code: https://www.github.com/io7m-com/.github/ 6 | # 7 | 8 | fatal() 9 | { 10 | echo "fatal: $1" 1>&2 11 | exit 1 12 | } 13 | 14 | if [ -z "${MAVEN_CENTRAL_USERNAME}" ] 15 | then 16 | fatal "MAVEN_CENTRAL_USERNAME is not set." 17 | fi 18 | 19 | if [ -z "${MAVEN_CENTRAL_PASSWORD}" ] 20 | then 21 | fatal "MAVEN_CENTRAL_PASSWORD is not set." 22 | fi 23 | 24 | (cat < 29 | 30 | 31 | 32 | io7m-oci-image 33 | 34 | 35 | 36 | 37 | sonatype-nexus-snapshots 38 | ${MAVEN_CENTRAL_USERNAME} 39 | ${MAVEN_CENTRAL_PASSWORD} 40 | 41 | 42 | sonatype-nexus-staging 43 | ${MAVEN_CENTRAL_USERNAME} 44 | ${MAVEN_CENTRAL_PASSWORD} 45 | 46 | 47 | 48 | EOF 49 | ) > "$HOME/.m2/settings.xml" || fatal "could not update $HOME/.m2/settings.xml" 50 | 51 | exec mvn \ 52 | --batch-mode \ 53 | --strict-checksums \ 54 | -Denforcer.skip=true \ 55 | -DskipTests=true \ 56 | -DskipITs=true deploy 57 | -------------------------------------------------------------------------------- /.github/workflows/deploy.linux.temurin.lts.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Automatically generated: DO NOT EDIT. 3 | # 4 | # Generation code: https://www.github.com/io7m-com/.github/ 5 | # Workflow profile: Core 6 | # 7 | 8 | name: deploy.linux.temurin.lts 9 | 10 | on: 11 | push: 12 | tags: [ com.io7m.jspatial-* ] 13 | 14 | permissions: 15 | contents: read 16 | 17 | jobs: 18 | build: 19 | runs-on: ubuntu-latest 20 | steps: 21 | - uses: actions/checkout@v4 22 | with: 23 | submodules: true 24 | 25 | - name: JDK 26 | uses: actions/setup-java@v4 27 | with: 28 | java-version: 23 29 | distribution: temurin 30 | 31 | - name: Check PGP version 32 | run: gpg --version 33 | 34 | - name: Import signing key 35 | env: 36 | PGP_SIGNING_KEY: ${{ secrets.PGP_SIGNING_KEY }} 37 | run: echo "${PGP_SIGNING_KEY}" | gpg -v --import 38 | 39 | - name: Log in to Quay.io. 40 | uses: redhat-actions/podman-login@4934294ad0449894bcd1e9f191899d7292469603 41 | with: 42 | username: ${{ secrets.QUAY_IO_USERNAME }} 43 | password: ${{ secrets.QUAY_IO_PASSWORD }} 44 | registry: 'quay.io' 45 | 46 | - name: Deploy release 47 | env: 48 | MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }} 49 | MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} 50 | run: .github/workflows/deploy-release.sh 51 | 52 | -------------------------------------------------------------------------------- /.github/workflows/main.linux.temurin.current.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Automatically generated: DO NOT EDIT. 3 | # 4 | # Generation code: https://www.github.com/io7m-com/.github/ 5 | # Workflow profile: Core 6 | # 7 | 8 | name: main.linux.temurin.current 9 | 10 | on: 11 | push: 12 | branches: [ master, main, develop, feature/*, release/* ] 13 | 14 | permissions: 15 | contents: read 16 | 17 | jobs: 18 | build: 19 | runs-on: ubuntu-latest 20 | steps: 21 | - uses: actions/checkout@v4 22 | with: 23 | submodules: true 24 | 25 | - name: JDK 26 | uses: actions/setup-java@v4 27 | with: 28 | java-version: 23 29 | distribution: 'temurin' 30 | 31 | - name: Collect project version 32 | id: project_version 33 | run: java .github/workflows/Tools.java ShowProjectVersion pom.xml >> "$GITHUB_OUTPUT" 34 | 35 | - name: Collect project snapshot 36 | id: project_is_snapshot 37 | run: java .github/workflows/Tools.java ShowProjectIsSnapshot pom.xml >> "$GITHUB_OUTPUT" 38 | 39 | 40 | - name: Build 41 | env: 42 | XOANON_REALLY_USE_LOCAL_DISPLAY: true 43 | run: mvn --batch-mode --strict-checksums --errors clean verify site 44 | 45 | - name: Upload test logs 46 | uses: actions/upload-artifact@v4 47 | if: always() 48 | with: 49 | name: test-logs 50 | path: ./com.io7m.jspatial.tests/target/surefire-reports 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /.github/workflows/main.linux.temurin.lts.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Automatically generated: DO NOT EDIT. 3 | # 4 | # Generation code: https://www.github.com/io7m-com/.github/ 5 | # Workflow profile: Core 6 | # 7 | 8 | name: main.linux.temurin.lts 9 | 10 | on: 11 | push: 12 | branches: [ master, main, develop, feature/*, release/* ] 13 | 14 | permissions: 15 | contents: read 16 | 17 | jobs: 18 | build: 19 | runs-on: ubuntu-latest 20 | steps: 21 | - uses: actions/checkout@v4 22 | with: 23 | submodules: true 24 | 25 | - name: JDK 26 | uses: actions/setup-java@v4 27 | with: 28 | java-version: 23 29 | distribution: 'temurin' 30 | 31 | - name: Collect project version 32 | id: project_version 33 | run: java .github/workflows/Tools.java ShowProjectVersion pom.xml >> "$GITHUB_OUTPUT" 34 | 35 | - name: Collect project snapshot 36 | id: project_is_snapshot 37 | run: java .github/workflows/Tools.java ShowProjectIsSnapshot pom.xml >> "$GITHUB_OUTPUT" 38 | 39 | 40 | - name: Build 41 | env: 42 | XOANON_REALLY_USE_LOCAL_DISPLAY: true 43 | run: mvn --batch-mode --strict-checksums --errors clean verify site 44 | 45 | - name: Upload test logs 46 | uses: actions/upload-artifact@v4 47 | if: always() 48 | with: 49 | name: test-logs 50 | path: ./com.io7m.jspatial.tests/target/surefire-reports 51 | 52 | - name: Coverage 53 | uses: codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24 54 | with: 55 | token: ${{ secrets.CODECOV_TOKEN }} 56 | files: com.io7m.jspatial.tests/target/site/jacoco-aggregate/jacoco.xml 57 | 58 | - name: Log in to Quay.io. 59 | uses: redhat-actions/podman-login@4934294ad0449894bcd1e9f191899d7292469603 60 | with: 61 | username: ${{ secrets.QUAY_IO_USERNAME }} 62 | password: ${{ secrets.QUAY_IO_PASSWORD }} 63 | registry: 'quay.io' 64 | 65 | - name: Deploy snapshot 66 | if: ${{ steps.project_is_snapshot.outputs.IO7M_PROJECT_VERSION_IS_SNAPSHOT == 'true' }} 67 | env: 68 | MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }} 69 | MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} 70 | run: .github/workflows/deploy-snapshot.sh 71 | 72 | -------------------------------------------------------------------------------- /.github/workflows/main.windows.temurin.current.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Automatically generated: DO NOT EDIT. 3 | # 4 | # Generation code: https://www.github.com/io7m-com/.github/ 5 | # Workflow profile: Core 6 | # 7 | 8 | name: main.windows.temurin.current 9 | 10 | on: 11 | push: 12 | branches: [ master, main, develop, feature/*, release/* ] 13 | 14 | permissions: 15 | contents: read 16 | 17 | jobs: 18 | build: 19 | runs-on: windows-latest 20 | steps: 21 | - uses: actions/checkout@v4 22 | with: 23 | submodules: true 24 | 25 | - name: JDK 26 | uses: actions/setup-java@v4 27 | with: 28 | java-version: 23 29 | distribution: 'temurin' 30 | 31 | - name: Collect project version 32 | id: project_version 33 | run: java .github/workflows/Tools.java ShowProjectVersion pom.xml >> "$GITHUB_OUTPUT" 34 | 35 | - name: Collect project snapshot 36 | id: project_is_snapshot 37 | run: java .github/workflows/Tools.java ShowProjectIsSnapshot pom.xml >> "$GITHUB_OUTPUT" 38 | 39 | 40 | - name: Build 41 | env: 42 | XOANON_REALLY_USE_LOCAL_DISPLAY: true 43 | run: mvn --batch-mode --strict-checksums --errors clean verify site 44 | 45 | - name: Upload test logs 46 | uses: actions/upload-artifact@v4 47 | if: always() 48 | with: 49 | name: test-logs 50 | path: ./com.io7m.jspatial.tests/target/surefire-reports 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /.github/workflows/main.windows.temurin.lts.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Automatically generated: DO NOT EDIT. 3 | # 4 | # Generation code: https://www.github.com/io7m-com/.github/ 5 | # Workflow profile: Core 6 | # 7 | 8 | name: main.windows.temurin.lts 9 | 10 | on: 11 | push: 12 | branches: [ master, main, develop, feature/*, release/* ] 13 | 14 | permissions: 15 | contents: read 16 | 17 | jobs: 18 | build: 19 | runs-on: windows-latest 20 | steps: 21 | - uses: actions/checkout@v4 22 | with: 23 | submodules: true 24 | 25 | - name: JDK 26 | uses: actions/setup-java@v4 27 | with: 28 | java-version: 23 29 | distribution: 'temurin' 30 | 31 | - name: Collect project version 32 | id: project_version 33 | run: java .github/workflows/Tools.java ShowProjectVersion pom.xml >> "$GITHUB_OUTPUT" 34 | 35 | - name: Collect project snapshot 36 | id: project_is_snapshot 37 | run: java .github/workflows/Tools.java ShowProjectIsSnapshot pom.xml >> "$GITHUB_OUTPUT" 38 | 39 | 40 | - name: Build 41 | env: 42 | XOANON_REALLY_USE_LOCAL_DISPLAY: true 43 | run: mvn --batch-mode --strict-checksums --errors clean verify site 44 | 45 | - name: Upload test logs 46 | uses: actions/upload-artifact@v4 47 | if: always() 48 | with: 49 | name: test-logs 50 | path: ./com.io7m.jspatial.tests/target/surefire-reports 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /.github/workflows/pr.linux.temurin.current.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Automatically generated: DO NOT EDIT. 3 | # 4 | # Generation code: https://www.github.com/io7m-com/.github/ 5 | # Workflow profile: Core 6 | # 7 | 8 | name: pr.linux.temurin.current 9 | 10 | on: 11 | pull_request: 12 | branches: [ master, main, develop, feature/*, release/* ] 13 | 14 | permissions: 15 | contents: read 16 | 17 | jobs: 18 | build: 19 | runs-on: ubuntu-latest 20 | steps: 21 | - uses: actions/checkout@v4 22 | with: 23 | submodules: true 24 | 25 | - name: JDK 26 | uses: actions/setup-java@v4 27 | with: 28 | java-version: 23 29 | distribution: 'temurin' 30 | 31 | - name: Collect project version 32 | id: project_version 33 | run: java .github/workflows/Tools.java ShowProjectVersion pom.xml >> "$GITHUB_OUTPUT" 34 | 35 | - name: Collect project snapshot 36 | id: project_is_snapshot 37 | run: java .github/workflows/Tools.java ShowProjectIsSnapshot pom.xml >> "$GITHUB_OUTPUT" 38 | 39 | 40 | - name: Build 41 | env: 42 | XOANON_REALLY_USE_LOCAL_DISPLAY: true 43 | run: mvn --batch-mode --strict-checksums --errors clean verify site 44 | 45 | - name: Upload test logs 46 | uses: actions/upload-artifact@v4 47 | if: always() 48 | with: 49 | name: test-logs 50 | path: ./com.io7m.jspatial.tests/target/surefire-reports 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /.github/workflows/pr.linux.temurin.lts.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Automatically generated: DO NOT EDIT. 3 | # 4 | # Generation code: https://www.github.com/io7m-com/.github/ 5 | # Workflow profile: Core 6 | # 7 | 8 | name: pr.linux.temurin.lts 9 | 10 | on: 11 | pull_request: 12 | branches: [ master, main, develop, feature/*, release/* ] 13 | 14 | permissions: 15 | contents: read 16 | 17 | jobs: 18 | build: 19 | runs-on: ubuntu-latest 20 | steps: 21 | - uses: actions/checkout@v4 22 | with: 23 | submodules: true 24 | 25 | - name: JDK 26 | uses: actions/setup-java@v4 27 | with: 28 | java-version: 23 29 | distribution: 'temurin' 30 | 31 | - name: Collect project version 32 | id: project_version 33 | run: java .github/workflows/Tools.java ShowProjectVersion pom.xml >> "$GITHUB_OUTPUT" 34 | 35 | - name: Collect project snapshot 36 | id: project_is_snapshot 37 | run: java .github/workflows/Tools.java ShowProjectIsSnapshot pom.xml >> "$GITHUB_OUTPUT" 38 | 39 | 40 | - name: Build 41 | env: 42 | XOANON_REALLY_USE_LOCAL_DISPLAY: true 43 | run: mvn --batch-mode --strict-checksums --errors clean verify site 44 | 45 | - name: Upload test logs 46 | uses: actions/upload-artifact@v4 47 | if: always() 48 | with: 49 | name: test-logs 50 | path: ./com.io7m.jspatial.tests/target/surefire-reports 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /.github/workflows/pr.windows.temurin.current.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Automatically generated: DO NOT EDIT. 3 | # 4 | # Generation code: https://www.github.com/io7m-com/.github/ 5 | # Workflow profile: Core 6 | # 7 | 8 | name: pr.windows.temurin.current 9 | 10 | on: 11 | pull_request: 12 | branches: [ master, main, develop, feature/*, release/* ] 13 | 14 | permissions: 15 | contents: read 16 | 17 | jobs: 18 | build: 19 | runs-on: windows-latest 20 | steps: 21 | - uses: actions/checkout@v4 22 | with: 23 | submodules: true 24 | 25 | - name: JDK 26 | uses: actions/setup-java@v4 27 | with: 28 | java-version: 23 29 | distribution: 'temurin' 30 | 31 | - name: Collect project version 32 | id: project_version 33 | run: java .github/workflows/Tools.java ShowProjectVersion pom.xml >> "$GITHUB_OUTPUT" 34 | 35 | - name: Collect project snapshot 36 | id: project_is_snapshot 37 | run: java .github/workflows/Tools.java ShowProjectIsSnapshot pom.xml >> "$GITHUB_OUTPUT" 38 | 39 | 40 | - name: Build 41 | env: 42 | XOANON_REALLY_USE_LOCAL_DISPLAY: true 43 | run: mvn --batch-mode --strict-checksums --errors clean verify site 44 | 45 | - name: Upload test logs 46 | uses: actions/upload-artifact@v4 47 | if: always() 48 | with: 49 | name: test-logs 50 | path: ./com.io7m.jspatial.tests/target/surefire-reports 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /.github/workflows/pr.windows.temurin.lts.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Automatically generated: DO NOT EDIT. 3 | # 4 | # Generation code: https://www.github.com/io7m-com/.github/ 5 | # Workflow profile: Core 6 | # 7 | 8 | name: pr.windows.temurin.lts 9 | 10 | on: 11 | pull_request: 12 | branches: [ master, main, develop, feature/*, release/* ] 13 | 14 | permissions: 15 | contents: read 16 | 17 | jobs: 18 | build: 19 | runs-on: windows-latest 20 | steps: 21 | - uses: actions/checkout@v4 22 | with: 23 | submodules: true 24 | 25 | - name: JDK 26 | uses: actions/setup-java@v4 27 | with: 28 | java-version: 23 29 | distribution: 'temurin' 30 | 31 | - name: Collect project version 32 | id: project_version 33 | run: java .github/workflows/Tools.java ShowProjectVersion pom.xml >> "$GITHUB_OUTPUT" 34 | 35 | - name: Collect project snapshot 36 | id: project_is_snapshot 37 | run: java .github/workflows/Tools.java ShowProjectIsSnapshot pom.xml >> "$GITHUB_OUTPUT" 38 | 39 | 40 | - name: Build 41 | env: 42 | XOANON_REALLY_USE_LOCAL_DISPLAY: true 43 | run: mvn --batch-mode --strict-checksums --errors clean verify site 44 | 45 | - name: Upload test logs 46 | uses: actions/upload-artifact@v4 47 | if: always() 48 | with: 49 | name: test-logs 50 | path: ./com.io7m.jspatial.tests/target/surefire-reports 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /.github/workflows/run-with-xvfb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -ex 2 | # 3 | # Automatically generated: DO NOT EDIT. 4 | # 5 | # Generation code: https://www.github.com/io7m-com/.github/ 6 | # 7 | 8 | exec > >(tee build.txt) 2>&1 9 | 10 | #--------------------------------------------------------------------- 11 | # Install all of the various required packages. 12 | # 13 | # We use: 14 | # xvfb to provide a virtual X server 15 | # fluxbox to provide a bare-minimum window manager with click-to-focus 16 | # ffmpeg to record the session 17 | # feh to set a background 18 | # 19 | 20 | sudo apt-get -y update 21 | sudo apt-get -y upgrade 22 | sudo apt-get -y install xvfb fluxbox feh ffmpeg 23 | 24 | #--------------------------------------------------------------------- 25 | # Start Xvfb on a new display. 26 | # 27 | 28 | Xvfb :99 & 29 | export DISPLAY=:99 30 | sleep 1 31 | 32 | #--------------------------------------------------------------------- 33 | # Start recording the session. 34 | # 35 | 36 | ffmpeg -f x11grab -y -r 60 -video_size 1280x1024 -i :99 -vcodec vp9 test-suite.webm & 37 | FFMPEG_PID="$!" 38 | 39 | #--------------------------------------------------------------------- 40 | # Start fluxbox on the X server. 41 | # 42 | 43 | fluxbox & 44 | sleep 1 45 | 46 | #--------------------------------------------------------------------- 47 | # Set a desktop image. 48 | # 49 | 50 | feh --bg-tile .github/workflows/wallpaper.png 51 | sleep 1 52 | 53 | #--------------------------------------------------------------------- 54 | # Execute the passed-in build command. 55 | # 56 | 57 | "$@" 58 | 59 | #--------------------------------------------------------------------- 60 | # Wait a while, and then instruct ffmpeg to stop recording. This step 61 | # is necessary because video files need to be processed when recording 62 | # stops. 63 | # 64 | 65 | sleep 20 66 | kill -INT "${FFMPEG_PID}" || true 67 | -------------------------------------------------------------------------------- /.github/workflows/wallpaper.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/io7m-com/jspatial/5743debd0b5a5ed82f386f3fe4597d77015fe94f/.github/workflows/wallpaper.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | *.ipr 3 | *.iws 4 | .checkstyle 5 | .classpath 6 | .fslckout 7 | .idea 8 | .project 9 | .settings 10 | bin 11 | out 12 | pom.xml.versionsBackup 13 | target 14 | .jqwik-database 15 | dependency-reduced-pom.xml 16 | pom.xml.versionsBackup 17 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/io7m-com/jspatial/5743debd0b5a5ed82f386f3fe4597d77015fe94f/.gitmodules -------------------------------------------------------------------------------- /README-LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright © 2023 Mark Raynsford https://www.io7m.com 2 | 3 | Permission to use, copy, modify, and/or distribute this software for any 4 | purpose with or without fee is hereby granted, provided that the above 5 | copyright notice and this permission notice appear in all copies. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 8 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 9 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 10 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 11 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 12 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 13 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | jspatial 2 | === 3 | 4 | [![Maven Central](https://img.shields.io/maven-central/v/com.io7m.jspatial/com.io7m.jspatial.svg?style=flat-square)](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.io7m.jspatial%22) 5 | [![Maven Central (snapshot)](https://img.shields.io/nexus/s/com.io7m.jspatial/com.io7m.jspatial?server=https%3A%2F%2Fs01.oss.sonatype.org&style=flat-square)](https://s01.oss.sonatype.org/content/repositories/snapshots/com/io7m/jspatial/) 6 | [![Codecov](https://img.shields.io/codecov/c/github/io7m-com/jspatial.svg?style=flat-square)](https://codecov.io/gh/io7m-com/jspatial) 7 | ![Java Version](https://img.shields.io/badge/21-java?label=java&color=e6c35c) 8 | 9 | ![com.io7m.jspatial](./src/site/resources/jspatial.jpg?raw=true) 10 | 11 | | JVM | Platform | Status | 12 | |-----|----------|--------| 13 | | OpenJDK (Temurin) Current | Linux | [![Build (OpenJDK (Temurin) Current, Linux)](https://img.shields.io/github/actions/workflow/status/io7m-com/jspatial/main.linux.temurin.current.yml)](https://www.github.com/io7m-com/jspatial/actions?query=workflow%3Amain.linux.temurin.current)| 14 | | OpenJDK (Temurin) LTS | Linux | [![Build (OpenJDK (Temurin) LTS, Linux)](https://img.shields.io/github/actions/workflow/status/io7m-com/jspatial/main.linux.temurin.lts.yml)](https://www.github.com/io7m-com/jspatial/actions?query=workflow%3Amain.linux.temurin.lts)| 15 | | OpenJDK (Temurin) Current | Windows | [![Build (OpenJDK (Temurin) Current, Windows)](https://img.shields.io/github/actions/workflow/status/io7m-com/jspatial/main.windows.temurin.current.yml)](https://www.github.com/io7m-com/jspatial/actions?query=workflow%3Amain.windows.temurin.current)| 16 | | OpenJDK (Temurin) LTS | Windows | [![Build (OpenJDK (Temurin) LTS, Windows)](https://img.shields.io/github/actions/workflow/status/io7m-com/jspatial/main.windows.temurin.lts.yml)](https://www.github.com/io7m-com/jspatial/actions?query=workflow%3Amain.windows.temurin.lts)| 17 | -------------------------------------------------------------------------------- /com.io7m.jspatial.api/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 4.0.0 8 | 9 | com.io7m.jspatial 10 | com.io7m.jspatial 11 | 3.0.0-SNAPSHOT 12 | 13 | com.io7m.jspatial.api 14 | 15 | jar 16 | com.io7m.jspatial.api 17 | Spatial data structures (API) 18 | https://www.io7m.com/software/jspatial/ 19 | 20 | 21 | 22 | com.io7m.jtensors 23 | com.io7m.jtensors.core 24 | 25 | 26 | com.io7m.jregions 27 | com.io7m.jregions.core 28 | 29 | 30 | 31 | org.osgi 32 | org.osgi.annotation.versioning 33 | provided 34 | 35 | 36 | org.osgi 37 | org.osgi.annotation.bundle 38 | provided 39 | 40 | 41 | org.immutables 42 | value 43 | provided 44 | 45 | 46 | com.io7m.immutables.style 47 | com.io7m.immutables.style 48 | provided 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /com.io7m.jspatial.api/src/main/java/com/io7m/jspatial/api/TreeVisitResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.api; 18 | 19 | /** 20 | * The result of traversing a tree. 21 | * 22 | * @since 3.0.0 23 | */ 24 | 25 | public enum TreeVisitResult 26 | { 27 | /** 28 | * Continue the traversal. 29 | */ 30 | 31 | RESULT_CONTINUE, 32 | 33 | /** 34 | * Terminate the traversal. 35 | */ 36 | 37 | RESULT_TERMINATE 38 | } 39 | -------------------------------------------------------------------------------- /com.io7m.jspatial.api/src/main/java/com/io7m/jspatial/api/octtrees/OctTreeConfigurationDType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.api.octtrees; 18 | 19 | import com.io7m.immutables.styles.ImmutablesStyleType; 20 | import com.io7m.jregions.core.unparameterized.volumes.VolumeD; 21 | import org.immutables.value.Value; 22 | 23 | /** 24 | * The type of double precision octtree configurations. 25 | * 26 | * @since 3.0.0 27 | */ 28 | 29 | @ImmutablesStyleType 30 | @Value.Immutable 31 | public interface OctTreeConfigurationDType 32 | { 33 | /** 34 | * @return The maximum bounding volume of the tree 35 | */ 36 | 37 | @Value.Parameter 38 | VolumeD volume(); 39 | 40 | /** 41 | * @return The minimum width of octants (must be {@code >= 0.0001}) 42 | */ 43 | 44 | @Value.Parameter 45 | @Value.Default 46 | default double minimumOctantWidth() 47 | { 48 | return 2.0; 49 | } 50 | 51 | /** 52 | * @return The minimum height of octants (must be {@code >= 0.0001}) 53 | */ 54 | 55 | @Value.Parameter 56 | @Value.Default 57 | default double minimumOctantHeight() 58 | { 59 | return 2.0; 60 | } 61 | 62 | /** 63 | * @return The minimum depth of octants (must be {@code >= 0.0001}) 64 | */ 65 | 66 | @Value.Parameter 67 | @Value.Default 68 | default double minimumOctantDepth() 69 | { 70 | return 2.0; 71 | } 72 | 73 | /** 74 | * @return {@code true} iff the implementation should attempt to trim empty leaf nodes when an 75 | * item is removed 76 | */ 77 | 78 | @Value.Parameter 79 | @Value.Default 80 | default boolean trimOnRemove() 81 | { 82 | return false; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /com.io7m.jspatial.api/src/main/java/com/io7m/jspatial/api/octtrees/OctTreeConfigurationIType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.api.octtrees; 18 | 19 | import com.io7m.immutables.styles.ImmutablesStyleType; 20 | import com.io7m.jregions.core.unparameterized.volumes.VolumeI; 21 | import org.immutables.value.Value; 22 | 23 | /** 24 | * The type of integer octtree configurations. 25 | * 26 | * @since 3.0.0 27 | */ 28 | 29 | @ImmutablesStyleType 30 | @Value.Immutable 31 | public interface OctTreeConfigurationIType 32 | { 33 | /** 34 | * @return The maximum bounding volume of the tree 35 | */ 36 | 37 | @Value.Parameter 38 | VolumeI volume(); 39 | 40 | /** 41 | * @return The minimum width of octants (must be {@code >= 2}) 42 | */ 43 | 44 | @Value.Parameter 45 | @Value.Default 46 | default int minimumOctantWidth() 47 | { 48 | return 2; 49 | } 50 | 51 | /** 52 | * @return The minimum height of octants (must be {@code >= 2}) 53 | */ 54 | 55 | @Value.Parameter 56 | @Value.Default 57 | default int minimumOctantHeight() 58 | { 59 | return 2; 60 | } 61 | 62 | /** 63 | * @return The minimum depth of octants (must be {@code >= 2}) 64 | */ 65 | 66 | @Value.Parameter 67 | @Value.Default 68 | default int minimumOctantDepth() 69 | { 70 | return 2; 71 | } 72 | 73 | /** 74 | * @return {@code true} iff the implementation should attempt to trim empty leaf nodes when an 75 | * item is removed 76 | */ 77 | 78 | @Value.Parameter 79 | @Value.Default 80 | default boolean trimOnRemove() 81 | { 82 | return false; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /com.io7m.jspatial.api/src/main/java/com/io7m/jspatial/api/octtrees/OctTreeConfigurationLType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.api.octtrees; 18 | 19 | import com.io7m.immutables.styles.ImmutablesStyleType; 20 | import com.io7m.jregions.core.unparameterized.volumes.VolumeL; 21 | import org.immutables.value.Value; 22 | 23 | /** 24 | * The type of long integer octtree configurations. 25 | * 26 | * @since 3.0.0 27 | */ 28 | 29 | @ImmutablesStyleType 30 | @Value.Immutable 31 | public interface OctTreeConfigurationLType 32 | { 33 | /** 34 | * @return The maximum bounding volume of the tree 35 | */ 36 | 37 | @Value.Parameter 38 | VolumeL volume(); 39 | 40 | /** 41 | * @return The minimum width of octants (must be {@code >= 2}) 42 | */ 43 | 44 | @Value.Parameter 45 | @Value.Default 46 | default long minimumOctantWidth() 47 | { 48 | return 2L; 49 | } 50 | 51 | /** 52 | * @return The minimum height of octants (must be {@code >= 2}) 53 | */ 54 | 55 | @Value.Parameter 56 | @Value.Default 57 | default long minimumOctantHeight() 58 | { 59 | return 2L; 60 | } 61 | 62 | /** 63 | * @return The minimum depth of octants (must be {@code >= 2}) 64 | */ 65 | 66 | @Value.Parameter 67 | @Value.Default 68 | default long minimumOctantDepth() 69 | { 70 | return 2L; 71 | } 72 | 73 | /** 74 | * @return {@code true} iff the implementation should attempt to trim empty leaf nodes when an 75 | * item is removed 76 | */ 77 | 78 | @Value.Parameter 79 | @Value.Default 80 | default boolean trimOnRemove() 81 | { 82 | return false; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /com.io7m.jspatial.api/src/main/java/com/io7m/jspatial/api/octtrees/OctTreeOctantDType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.api.octtrees; 18 | 19 | import com.io7m.jregions.core.unparameterized.volumes.VolumeD; 20 | 21 | import java.util.Map; 22 | 23 | /** 24 | * A octant as it appears within the context of an octtree. 25 | * 26 | * @param The precise type of objects 27 | * 28 | * @since 3.0.0 29 | */ 30 | 31 | public interface OctTreeOctantDType 32 | { 33 | /** 34 | * @return A read-only view of the objects directly contained within this octant 35 | */ 36 | 37 | Map objects(); 38 | 39 | /** 40 | * @return The volume of the octant 41 | */ 42 | 43 | VolumeD volume(); 44 | } 45 | -------------------------------------------------------------------------------- /com.io7m.jspatial.api/src/main/java/com/io7m/jspatial/api/octtrees/OctTreeOctantIType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.api.octtrees; 18 | 19 | import com.io7m.jregions.core.unparameterized.volumes.VolumeI; 20 | 21 | import java.util.Map; 22 | 23 | /** 24 | * A octant as it appears within the context of an octtree. 25 | * 26 | * @param The precise type of objects 27 | * 28 | * @since 3.0.0 29 | */ 30 | 31 | public interface OctTreeOctantIType 32 | { 33 | /** 34 | * @return A read-only view of the objects directly contained within this octant 35 | */ 36 | 37 | Map objects(); 38 | 39 | /** 40 | * @return The volume of the octant 41 | */ 42 | 43 | VolumeI volume(); 44 | } 45 | -------------------------------------------------------------------------------- /com.io7m.jspatial.api/src/main/java/com/io7m/jspatial/api/octtrees/OctTreeOctantIterationDType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.api.octtrees; 18 | 19 | import com.io7m.jspatial.api.TreeVisitResult; 20 | 21 | /** 22 | * The type of functions used to iterate over the octants of octtrees. 23 | * 24 | * @param The type of tree objects 25 | * @param The type of contextual values 26 | * 27 | * @since 3.0.0 28 | */ 29 | 30 | @FunctionalInterface 31 | public interface OctTreeOctantIterationDType 32 | { 33 | /** 34 | * Apply the function. 35 | * 36 | * @param context A context value 37 | * @param octant The current octant 38 | * @param depth The current octant depth 39 | * 40 | * @return A value indicating how or if the traversal should continue 41 | */ 42 | 43 | TreeVisitResult apply( 44 | C context, 45 | OctTreeOctantDType octant, 46 | long depth); 47 | } 48 | -------------------------------------------------------------------------------- /com.io7m.jspatial.api/src/main/java/com/io7m/jspatial/api/octtrees/OctTreeOctantIterationIType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.api.octtrees; 18 | 19 | import com.io7m.jspatial.api.TreeVisitResult; 20 | 21 | /** 22 | * The type of functions used to iterate over the octants of octtrees. 23 | * 24 | * @param The type of tree objects 25 | * @param The type of contextual values 26 | * 27 | * @since 3.0.0 28 | */ 29 | 30 | @FunctionalInterface 31 | public interface OctTreeOctantIterationIType 32 | { 33 | /** 34 | * Apply the function. 35 | * 36 | * @param context A context value 37 | * @param octant The current octant 38 | * @param depth The current octant depth 39 | * 40 | * @return A value indicating how or if the traversal should continue 41 | */ 42 | 43 | TreeVisitResult apply( 44 | C context, 45 | OctTreeOctantIType octant, 46 | long depth); 47 | } 48 | -------------------------------------------------------------------------------- /com.io7m.jspatial.api/src/main/java/com/io7m/jspatial/api/octtrees/OctTreeOctantIterationLType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.api.octtrees; 18 | 19 | import com.io7m.jspatial.api.TreeVisitResult; 20 | 21 | /** 22 | * The type of functions used to iterate over the octants of octtrees. 23 | * 24 | * @param The type of tree objects 25 | * @param The type of contextual values 26 | * 27 | * @since 3.0.0 28 | */ 29 | 30 | @FunctionalInterface 31 | public interface OctTreeOctantIterationLType 32 | { 33 | /** 34 | * Apply the function. 35 | * 36 | * @param context A context value 37 | * @param octant The current octant 38 | * @param depth The current octant depth 39 | * 40 | * @return A value indicating how or if the traversal should continue 41 | */ 42 | 43 | TreeVisitResult apply( 44 | C context, 45 | OctTreeOctantLType octant, 46 | long depth); 47 | } 48 | -------------------------------------------------------------------------------- /com.io7m.jspatial.api/src/main/java/com/io7m/jspatial/api/octtrees/OctTreeOctantLType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.api.octtrees; 18 | 19 | import com.io7m.jregions.core.unparameterized.volumes.VolumeL; 20 | 21 | import java.util.Map; 22 | 23 | /** 24 | * A octant as it appears within the context of an octtree. 25 | * 26 | * @param The precise type of objects 27 | * 28 | * @since 3.0.0 29 | */ 30 | 31 | public interface OctTreeOctantLType 32 | { 33 | /** 34 | * @return A read-only view of the objects directly contained within this octant 35 | */ 36 | 37 | Map objects(); 38 | 39 | /** 40 | * @return The volume of the octant 41 | */ 42 | 43 | VolumeL volume(); 44 | } 45 | -------------------------------------------------------------------------------- /com.io7m.jspatial.api/src/main/java/com/io7m/jspatial/api/octtrees/OctTreeRaycastResultDType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.api.octtrees; 18 | 19 | import com.io7m.immutables.styles.ImmutablesStyleType; 20 | import com.io7m.jregions.core.unparameterized.volumes.VolumeD; 21 | import org.immutables.value.Value; 22 | 23 | /** 24 | * The type of octtree raycast results. 25 | * 26 | * @param The precise type of objects 27 | * 28 | * @since 3.0.0 29 | */ 30 | 31 | @Value.Immutable 32 | @ImmutablesStyleType 33 | public interface OctTreeRaycastResultDType 34 | extends Comparable> 35 | { 36 | @Override 37 | default int compareTo(final OctTreeRaycastResultDType o) 38 | { 39 | return Double.compare(this.distance(), o.distance()); 40 | } 41 | 42 | /** 43 | * @return The distance to the object 44 | */ 45 | 46 | @Value.Parameter(order = 0) 47 | double distance(); 48 | 49 | /** 50 | * @return The object volume 51 | */ 52 | 53 | @Value.Parameter(order = 1) 54 | VolumeD volume(); 55 | 56 | /** 57 | * @return The object 58 | */ 59 | 60 | @Value.Parameter(order = 2) 61 | T item(); 62 | } 63 | -------------------------------------------------------------------------------- /com.io7m.jspatial.api/src/main/java/com/io7m/jspatial/api/octtrees/OctTreeRaycastResultIType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.api.octtrees; 18 | 19 | import com.io7m.immutables.styles.ImmutablesStyleType; 20 | import com.io7m.jregions.core.unparameterized.volumes.VolumeI; 21 | import org.immutables.value.Value; 22 | 23 | /** 24 | * The type of octtree raycast results. 25 | * 26 | * @param The precise type of objects 27 | * 28 | * @since 3.0.0 29 | */ 30 | 31 | @Value.Immutable 32 | @ImmutablesStyleType 33 | public interface OctTreeRaycastResultIType 34 | extends Comparable> 35 | { 36 | @Override 37 | default int compareTo(final OctTreeRaycastResultIType o) 38 | { 39 | return Double.compare(this.distance(), o.distance()); 40 | } 41 | 42 | /** 43 | * @return The distance to the object 44 | */ 45 | 46 | @Value.Parameter(order = 0) 47 | double distance(); 48 | 49 | /** 50 | * @return The object volume 51 | */ 52 | 53 | @Value.Parameter(order = 1) 54 | VolumeI volume(); 55 | 56 | /** 57 | * @return The object 58 | */ 59 | 60 | @Value.Parameter(order = 2) 61 | T item(); 62 | } 63 | -------------------------------------------------------------------------------- /com.io7m.jspatial.api/src/main/java/com/io7m/jspatial/api/octtrees/OctTreeRaycastResultLType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.api.octtrees; 18 | 19 | import com.io7m.immutables.styles.ImmutablesStyleType; 20 | import com.io7m.jregions.core.unparameterized.volumes.VolumeL; 21 | import org.immutables.value.Value; 22 | 23 | /** 24 | * The type of octtree raycast results. 25 | * 26 | * @param The precise type of objects 27 | * 28 | * @since 3.0.0 29 | */ 30 | 31 | @Value.Immutable 32 | @ImmutablesStyleType 33 | public interface OctTreeRaycastResultLType 34 | extends Comparable> 35 | { 36 | @Override 37 | default int compareTo(final OctTreeRaycastResultLType o) 38 | { 39 | return Double.compare(this.distance(), o.distance()); 40 | } 41 | 42 | /** 43 | * @return The distance to the object 44 | */ 45 | 46 | @Value.Parameter(order = 0) 47 | double distance(); 48 | 49 | /** 50 | * @return The object volume 51 | */ 52 | 53 | @Value.Parameter(order = 1) 54 | VolumeL volume(); 55 | 56 | /** 57 | * @return The object 58 | */ 59 | 60 | @Value.Parameter(order = 2) 61 | T item(); 62 | } 63 | -------------------------------------------------------------------------------- /com.io7m.jspatial.api/src/main/java/com/io7m/jspatial/api/octtrees/OctTreeReadableType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.api.octtrees; 18 | 19 | /** 20 | * The type of readable octtrees. 21 | * 22 | * @since 3.0.0 23 | */ 24 | 25 | public interface OctTreeReadableType 26 | { 27 | /** 28 | * @return The number of elements in the tree 29 | */ 30 | 31 | long size(); 32 | 33 | /** 34 | * @return {@code true} iff the tree is empty 35 | */ 36 | 37 | default boolean isEmpty() 38 | { 39 | return this.size() == 0L; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /com.io7m.jspatial.api/src/main/java/com/io7m/jspatial/api/octtrees/OctTreeSupplierDType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.api.octtrees; 18 | 19 | /** 20 | * The type of constructors for trees. 21 | * 22 | * @since 3.0.0 23 | */ 24 | 25 | @FunctionalInterface 26 | public interface OctTreeSupplierDType 27 | { 28 | /** 29 | * Create a new tree based on the given configuration. 30 | * 31 | * @param config The configuration 32 | * @param The type of objects in the tree 33 | * 34 | * @return A new tree 35 | */ 36 | 37 | OctTreeDType create( 38 | OctTreeConfigurationD config); 39 | } 40 | -------------------------------------------------------------------------------- /com.io7m.jspatial.api/src/main/java/com/io7m/jspatial/api/octtrees/OctTreeSupplierIType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.api.octtrees; 18 | 19 | /** 20 | * The type of constructors for trees. 21 | * 22 | * @since 3.0.0 23 | */ 24 | 25 | @FunctionalInterface 26 | public interface OctTreeSupplierIType 27 | { 28 | /** 29 | * Create a new tree based on the given configuration. 30 | * 31 | * @param config The configuration 32 | * @param The type of objects in the tree 33 | * 34 | * @return A new tree 35 | */ 36 | 37 | OctTreeIType create( 38 | OctTreeConfigurationI config); 39 | } 40 | -------------------------------------------------------------------------------- /com.io7m.jspatial.api/src/main/java/com/io7m/jspatial/api/octtrees/OctTreeSupplierLType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.api.octtrees; 18 | 19 | /** 20 | * The type of constructors for trees. 21 | * 22 | * @since 3.0.0 23 | */ 24 | 25 | @FunctionalInterface 26 | public interface OctTreeSupplierLType 27 | { 28 | /** 29 | * Create a new tree based on the given configuration. 30 | * 31 | * @param config The configuration 32 | * @param The type of objects in the tree 33 | * 34 | * @return A new tree 35 | */ 36 | 37 | OctTreeLType create( 38 | OctTreeConfigurationL config); 39 | } 40 | -------------------------------------------------------------------------------- /com.io7m.jspatial.api/src/main/java/com/io7m/jspatial/api/octtrees/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | /** 18 | * Octtree API specification. 19 | */ 20 | 21 | @Export 22 | @Version("3.0.0") 23 | package com.io7m.jspatial.api.octtrees; 24 | 25 | import org.osgi.annotation.bundle.Export; 26 | import org.osgi.annotation.versioning.Version; 27 | -------------------------------------------------------------------------------- /com.io7m.jspatial.api/src/main/java/com/io7m/jspatial/api/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | /** 18 | * API specification. 19 | */ 20 | 21 | @Export 22 | @Version("3.0.0") 23 | package com.io7m.jspatial.api; 24 | 25 | import org.osgi.annotation.bundle.Export; 26 | import org.osgi.annotation.versioning.Version; 27 | -------------------------------------------------------------------------------- /com.io7m.jspatial.api/src/main/java/com/io7m/jspatial/api/quadtrees/QuadTreeConfigurationDType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.api.quadtrees; 18 | 19 | import com.io7m.immutables.styles.ImmutablesStyleType; 20 | import com.io7m.jregions.core.unparameterized.areas.AreaD; 21 | import org.immutables.value.Value; 22 | 23 | /** 24 | * The type of double precision quadtree configurations. 25 | * 26 | * @since 3.0.0 27 | */ 28 | 29 | @ImmutablesStyleType 30 | @Value.Immutable 31 | public interface QuadTreeConfigurationDType 32 | { 33 | /** 34 | * @return The maximum bounding area of the tree 35 | */ 36 | 37 | @Value.Parameter 38 | AreaD area(); 39 | 40 | /** 41 | * @return The minimum width of quadrants (must be {@code >= 0.0001}) 42 | */ 43 | 44 | @Value.Parameter 45 | @Value.Default 46 | default double minimumQuadrantWidth() 47 | { 48 | return 2.0; 49 | } 50 | 51 | /** 52 | * @return The minimum height of quadrants (must be {@code >= 0.0001}) 53 | */ 54 | 55 | @Value.Parameter 56 | @Value.Default 57 | default double minimumQuadrantHeight() 58 | { 59 | return 2.0; 60 | } 61 | 62 | /** 63 | * @return {@code true} iff the implementation should attempt to trim empty leaf nodes when an 64 | * item is removed 65 | */ 66 | 67 | @Value.Parameter 68 | @Value.Default 69 | default boolean trimOnRemove() 70 | { 71 | return false; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /com.io7m.jspatial.api/src/main/java/com/io7m/jspatial/api/quadtrees/QuadTreeConfigurationIType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.api.quadtrees; 18 | 19 | import com.io7m.immutables.styles.ImmutablesStyleType; 20 | import com.io7m.jregions.core.unparameterized.areas.AreaI; 21 | import org.immutables.value.Value; 22 | 23 | /** 24 | * The type of integer quadtree configurations. 25 | * 26 | * @since 3.0.0 27 | */ 28 | 29 | @ImmutablesStyleType 30 | @Value.Immutable 31 | public interface QuadTreeConfigurationIType 32 | { 33 | /** 34 | * @return The maximum bounding area of the tree 35 | */ 36 | 37 | @Value.Parameter 38 | AreaI area(); 39 | 40 | /** 41 | * @return The minimum width of quadrants (must be {@code >= 2}) 42 | */ 43 | 44 | @Value.Parameter 45 | @Value.Default 46 | default int minimumQuadrantWidth() 47 | { 48 | return 2; 49 | } 50 | 51 | /** 52 | * @return The minimum height of quadrants (must be {@code >= 2}) 53 | */ 54 | 55 | @Value.Parameter 56 | @Value.Default 57 | default int minimumQuadrantHeight() 58 | { 59 | return 2; 60 | } 61 | 62 | /** 63 | * @return {@code true} iff the implementation should attempt to trim empty leaf nodes when an 64 | * item is removed 65 | */ 66 | 67 | @Value.Parameter 68 | @Value.Default 69 | default boolean trimOnRemove() 70 | { 71 | return false; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /com.io7m.jspatial.api/src/main/java/com/io7m/jspatial/api/quadtrees/QuadTreeConfigurationLType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.api.quadtrees; 18 | 19 | import com.io7m.immutables.styles.ImmutablesStyleType; 20 | import com.io7m.jregions.core.unparameterized.areas.AreaL; 21 | import org.immutables.value.Value; 22 | 23 | /** 24 | * The type of long integer quadtree configurations. 25 | * 26 | * @since 3.0.0 27 | */ 28 | 29 | @ImmutablesStyleType 30 | @Value.Immutable 31 | public interface QuadTreeConfigurationLType 32 | { 33 | /** 34 | * @return The maximum bounding area of the tree 35 | */ 36 | 37 | @Value.Parameter 38 | AreaL area(); 39 | 40 | /** 41 | * @return The minimum width of quadrants (must be {@code >= 2}) 42 | */ 43 | 44 | @Value.Parameter 45 | @Value.Default 46 | default long minimumQuadrantWidth() 47 | { 48 | return 2L; 49 | } 50 | 51 | /** 52 | * @return The minimum height of quadrants (must be {@code >= 2}) 53 | */ 54 | 55 | @Value.Parameter 56 | @Value.Default 57 | default long minimumQuadrantHeight() 58 | { 59 | return 2L; 60 | } 61 | 62 | /** 63 | * @return {@code true} iff the implementation should attempt to trim empty leaf nodes when an 64 | * item is removed 65 | */ 66 | 67 | @Value.Parameter 68 | @Value.Default 69 | default boolean trimOnRemove() 70 | { 71 | return false; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /com.io7m.jspatial.api/src/main/java/com/io7m/jspatial/api/quadtrees/QuadTreeQuadrantDType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.api.quadtrees; 18 | 19 | import com.io7m.jregions.core.unparameterized.areas.AreaD; 20 | 21 | import java.util.Map; 22 | 23 | /** 24 | * A quadrant as it appears within the context of a quadtree. 25 | * 26 | * @param The precise type of objects 27 | * 28 | * @since 3.0.0 29 | */ 30 | 31 | public interface QuadTreeQuadrantDType 32 | { 33 | /** 34 | * @return A read-only view of the objects directly contained within this quadrant 35 | */ 36 | 37 | Map objects(); 38 | 39 | /** 40 | * @return The area of the quadrant 41 | */ 42 | 43 | AreaD area(); 44 | } 45 | -------------------------------------------------------------------------------- /com.io7m.jspatial.api/src/main/java/com/io7m/jspatial/api/quadtrees/QuadTreeQuadrantIType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.api.quadtrees; 18 | 19 | import com.io7m.jregions.core.unparameterized.areas.AreaI; 20 | 21 | import java.util.Map; 22 | 23 | /** 24 | * A quadrant as it appears within the context of a quadtree. 25 | * 26 | * @param The precise type of objects 27 | * 28 | * @since 3.0.0 29 | */ 30 | 31 | public interface QuadTreeQuadrantIType 32 | { 33 | /** 34 | * @return A read-only view of the objects directly contained within this quadrant 35 | */ 36 | 37 | Map objects(); 38 | 39 | /** 40 | * @return The area of the quadrant 41 | */ 42 | 43 | AreaI area(); 44 | } 45 | -------------------------------------------------------------------------------- /com.io7m.jspatial.api/src/main/java/com/io7m/jspatial/api/quadtrees/QuadTreeQuadrantIterationDType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.api.quadtrees; 18 | 19 | import com.io7m.jspatial.api.TreeVisitResult; 20 | 21 | /** 22 | * The type of functions used to iterate over the quadrants of quadtrees. 23 | * 24 | * @param The type of tree objects 25 | * @param The type of contextual values 26 | * 27 | * @since 3.0.0 28 | */ 29 | 30 | @FunctionalInterface 31 | public interface QuadTreeQuadrantIterationDType 32 | { 33 | /** 34 | * Apply the function. 35 | * 36 | * @param context A context value 37 | * @param quadrant The current quadrant 38 | * @param depth The current quadrant depth 39 | * 40 | * @return A value indicating how or if the traversal should continue 41 | */ 42 | 43 | TreeVisitResult apply( 44 | C context, 45 | QuadTreeQuadrantDType quadrant, 46 | long depth); 47 | } 48 | -------------------------------------------------------------------------------- /com.io7m.jspatial.api/src/main/java/com/io7m/jspatial/api/quadtrees/QuadTreeQuadrantIterationIType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.api.quadtrees; 18 | 19 | import com.io7m.jspatial.api.TreeVisitResult; 20 | 21 | /** 22 | * The type of functions used to iterate over the quadrants of quadtrees. 23 | * 24 | * @param The type of tree objects 25 | * @param The type of contextual values 26 | * 27 | * @since 3.0.0 28 | */ 29 | 30 | @FunctionalInterface 31 | public interface QuadTreeQuadrantIterationIType 32 | { 33 | /** 34 | * Apply the function. 35 | * 36 | * @param context A context value 37 | * @param quadrant The current quadrant 38 | * @param depth The current quadrant depth 39 | * 40 | * @return A value indicating how or if the traversal should continue 41 | */ 42 | 43 | TreeVisitResult apply( 44 | C context, 45 | QuadTreeQuadrantIType quadrant, 46 | long depth); 47 | } 48 | -------------------------------------------------------------------------------- /com.io7m.jspatial.api/src/main/java/com/io7m/jspatial/api/quadtrees/QuadTreeQuadrantIterationLType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.api.quadtrees; 18 | 19 | import com.io7m.jspatial.api.TreeVisitResult; 20 | 21 | /** 22 | * The type of functions used to iterate over the quadrants of quadtrees. 23 | * 24 | * @param The type of tree objects 25 | * @param The type of contextual values 26 | * 27 | * @since 3.0.0 28 | */ 29 | 30 | @FunctionalInterface 31 | public interface QuadTreeQuadrantIterationLType 32 | { 33 | /** 34 | * Apply the function. 35 | * 36 | * @param context A context value 37 | * @param quadrant The current quadrant 38 | * @param depth The current quadrant depth 39 | * 40 | * @return A value indicating how or if the traversal should continue 41 | */ 42 | 43 | TreeVisitResult apply( 44 | C context, 45 | QuadTreeQuadrantLType quadrant, 46 | long depth); 47 | } 48 | -------------------------------------------------------------------------------- /com.io7m.jspatial.api/src/main/java/com/io7m/jspatial/api/quadtrees/QuadTreeQuadrantLType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.api.quadtrees; 18 | 19 | import com.io7m.jregions.core.unparameterized.areas.AreaL; 20 | 21 | import java.util.Map; 22 | 23 | /** 24 | * A quadrant as it appears within the context of a quadtree. 25 | * 26 | * @param The precise type of objects 27 | * 28 | * @since 3.0.0 29 | */ 30 | 31 | public interface QuadTreeQuadrantLType 32 | { 33 | /** 34 | * @return A read-only view of the objects directly contained within this quadrant 35 | */ 36 | 37 | Map objects(); 38 | 39 | /** 40 | * @return The area of the quadrant 41 | */ 42 | 43 | AreaL area(); 44 | } 45 | -------------------------------------------------------------------------------- /com.io7m.jspatial.api/src/main/java/com/io7m/jspatial/api/quadtrees/QuadTreeRaycastResultDType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.api.quadtrees; 18 | 19 | import com.io7m.immutables.styles.ImmutablesStyleType; 20 | import com.io7m.jregions.core.unparameterized.areas.AreaD; 21 | import org.immutables.value.Value; 22 | 23 | /** 24 | * The type of quadtree raycast results. 25 | * 26 | * @param The precise type of objects 27 | * 28 | * @since 3.0.0 29 | */ 30 | 31 | @Value.Immutable 32 | @ImmutablesStyleType 33 | public interface QuadTreeRaycastResultDType 34 | extends Comparable> 35 | { 36 | @Override 37 | default int compareTo(final QuadTreeRaycastResultDType o) 38 | { 39 | return Double.compare(this.distance(), o.distance()); 40 | } 41 | 42 | /** 43 | * @return The distance to the object 44 | */ 45 | 46 | @Value.Parameter(order = 0) 47 | double distance(); 48 | 49 | /** 50 | * @return The object area 51 | */ 52 | 53 | @Value.Parameter(order = 1) 54 | AreaD area(); 55 | 56 | /** 57 | * @return The object 58 | */ 59 | 60 | @Value.Parameter(order = 2) 61 | T item(); 62 | } 63 | -------------------------------------------------------------------------------- /com.io7m.jspatial.api/src/main/java/com/io7m/jspatial/api/quadtrees/QuadTreeRaycastResultIType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.api.quadtrees; 18 | 19 | import com.io7m.immutables.styles.ImmutablesStyleType; 20 | import com.io7m.jregions.core.unparameterized.areas.AreaI; 21 | import org.immutables.value.Value; 22 | 23 | /** 24 | * The type of quadtree raycast results. 25 | * 26 | * @param The precise type of objects 27 | * 28 | * @since 3.0.0 29 | */ 30 | 31 | @Value.Immutable 32 | @ImmutablesStyleType 33 | public interface QuadTreeRaycastResultIType 34 | extends Comparable> 35 | { 36 | @Override 37 | default int compareTo(final QuadTreeRaycastResultIType o) 38 | { 39 | return Double.compare(this.distance(), o.distance()); 40 | } 41 | 42 | /** 43 | * @return The distance to the object 44 | */ 45 | 46 | @Value.Parameter(order = 0) 47 | double distance(); 48 | 49 | /** 50 | * @return The object area 51 | */ 52 | 53 | @Value.Parameter(order = 1) 54 | AreaI area(); 55 | 56 | /** 57 | * @return The object 58 | */ 59 | 60 | @Value.Parameter(order = 2) 61 | T item(); 62 | } 63 | -------------------------------------------------------------------------------- /com.io7m.jspatial.api/src/main/java/com/io7m/jspatial/api/quadtrees/QuadTreeRaycastResultLType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.api.quadtrees; 18 | 19 | import com.io7m.immutables.styles.ImmutablesStyleType; 20 | import com.io7m.jregions.core.unparameterized.areas.AreaL; 21 | import org.immutables.value.Value; 22 | 23 | /** 24 | * The type of quadtree raycast results. 25 | * 26 | * @param The precise type of objects 27 | * 28 | * @since 3.0.0 29 | */ 30 | 31 | @Value.Immutable 32 | @ImmutablesStyleType 33 | public interface QuadTreeRaycastResultLType 34 | extends Comparable> 35 | { 36 | @Override 37 | default int compareTo(final QuadTreeRaycastResultLType o) 38 | { 39 | return Double.compare(this.distance(), o.distance()); 40 | } 41 | 42 | /** 43 | * @return The distance to the object 44 | */ 45 | 46 | @Value.Parameter(order = 0) 47 | double distance(); 48 | 49 | /** 50 | * @return The object area 51 | */ 52 | 53 | @Value.Parameter(order = 1) 54 | AreaL area(); 55 | 56 | /** 57 | * @return The object 58 | */ 59 | 60 | @Value.Parameter(order = 2) 61 | T item(); 62 | } 63 | -------------------------------------------------------------------------------- /com.io7m.jspatial.api/src/main/java/com/io7m/jspatial/api/quadtrees/QuadTreeReadableType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.api.quadtrees; 18 | 19 | /** 20 | * The type of readable quadtrees. 21 | * 22 | * @since 3.0.0 23 | */ 24 | 25 | public interface QuadTreeReadableType 26 | { 27 | /** 28 | * @return The number of elements in the tree 29 | */ 30 | 31 | long size(); 32 | 33 | /** 34 | * @return {@code true} iff the tree is empty 35 | */ 36 | 37 | default boolean isEmpty() 38 | { 39 | return this.size() == 0L; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /com.io7m.jspatial.api/src/main/java/com/io7m/jspatial/api/quadtrees/QuadTreeSupplierDType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.api.quadtrees; 18 | 19 | /** 20 | * The type of constructors for trees. 21 | * 22 | * @since 3.0.0 23 | */ 24 | 25 | @FunctionalInterface 26 | public interface QuadTreeSupplierDType 27 | { 28 | /** 29 | * Create a new tree based on the given configuration. 30 | * 31 | * @param config The configuration 32 | * @param The type of objects in the tree 33 | * 34 | * @return A new tree 35 | */ 36 | 37 | QuadTreeDType create( 38 | QuadTreeConfigurationD config); 39 | } 40 | -------------------------------------------------------------------------------- /com.io7m.jspatial.api/src/main/java/com/io7m/jspatial/api/quadtrees/QuadTreeSupplierIType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.api.quadtrees; 18 | 19 | /** 20 | * The type of constructors for trees. 21 | * 22 | * @since 3.0.0 23 | */ 24 | 25 | @FunctionalInterface 26 | public interface QuadTreeSupplierIType 27 | { 28 | /** 29 | * Create a new tree based on the given configuration. 30 | * 31 | * @param config The configuration 32 | * @param The type of objects in the tree 33 | * 34 | * @return A new tree 35 | */ 36 | 37 | QuadTreeIType create( 38 | QuadTreeConfigurationI config); 39 | } 40 | -------------------------------------------------------------------------------- /com.io7m.jspatial.api/src/main/java/com/io7m/jspatial/api/quadtrees/QuadTreeSupplierLType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.api.quadtrees; 18 | 19 | /** 20 | * The type of constructors for trees. 21 | * 22 | * @since 3.0.0 23 | */ 24 | 25 | @FunctionalInterface 26 | public interface QuadTreeSupplierLType 27 | { 28 | /** 29 | * Create a new tree based on the given configuration. 30 | * 31 | * @param config The configuration 32 | * @param The type of objects in the tree 33 | * 34 | * @return A new tree 35 | */ 36 | 37 | QuadTreeLType create( 38 | QuadTreeConfigurationL config); 39 | } 40 | -------------------------------------------------------------------------------- /com.io7m.jspatial.api/src/main/java/com/io7m/jspatial/api/quadtrees/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | /** 18 | * Quadtree API specification. 19 | */ 20 | 21 | @Export 22 | @Version("3.0.0") 23 | package com.io7m.jspatial.api.quadtrees; 24 | 25 | import org.osgi.annotation.bundle.Export; 26 | import org.osgi.annotation.versioning.Version; 27 | -------------------------------------------------------------------------------- /com.io7m.jspatial.api/src/main/java/module-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | /** 18 | * Spatial data structures (API) 19 | */ 20 | 21 | module com.io7m.jspatial.api 22 | { 23 | requires static com.io7m.immutables.style; 24 | requires static org.immutables.value; 25 | requires static org.osgi.annotation.bundle; 26 | requires static org.osgi.annotation.versioning; 27 | 28 | requires com.io7m.jregions.core; 29 | requires com.io7m.jtensors.core; 30 | 31 | exports com.io7m.jspatial.api; 32 | exports com.io7m.jspatial.api.octtrees; 33 | exports com.io7m.jspatial.api.quadtrees; 34 | } 35 | -------------------------------------------------------------------------------- /com.io7m.jspatial.documentation/src/main/assembly/documentation.xml: -------------------------------------------------------------------------------- 1 | 5 | documentation 6 | ${project.name}-${project.version} 7 | 8 | zip 9 | 10 | 11 | 12 | ${project.build.directory}/documentation 13 | / 14 | 15 | 16 | ${project.build.directory}/site/apidocs 17 | /apidocs 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /com.io7m.jspatial.documentation/src/main/java/com/io7m/jspatial/documentation/Documentation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.documentation; 18 | 19 | /** 20 | * Documentation marker class. 21 | */ 22 | 23 | public final class Documentation 24 | { 25 | private Documentation() 26 | { 27 | throw new AssertionError("Unreachable code!"); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /com.io7m.jspatial.documentation/src/main/java/com/io7m/jspatial/documentation/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | /** 18 | * Documentation. 19 | */ 20 | 21 | package com.io7m.jspatial.documentation; 22 | -------------------------------------------------------------------------------- /com.io7m.jspatial.documentation/src/main/java/module-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | /** 18 | * Spatial data structures (Documentation) 19 | */ 20 | 21 | module com.io7m.jspatial.documentation 22 | { 23 | requires static org.immutables.value; 24 | requires static com.io7m.immutables.style; 25 | requires static org.osgi.annotation; 26 | requires static org.osgi.service.component.annotations; 27 | 28 | requires it.unimi.dsi.fastutil; 29 | requires com.io7m.jspatial.api; 30 | requires com.io7m.jspatial.implementation; 31 | 32 | exports com.io7m.jspatial.documentation; 33 | } 34 | -------------------------------------------------------------------------------- /com.io7m.jspatial.documentation/src/main/resources/com/io7m/jspatial/documentation/brand.xml: -------------------------------------------------------------------------------- 1 | 2 |
3 | 6 |
7 | ${project.parent.name} ${project.version} 8 |
9 |
-------------------------------------------------------------------------------- /com.io7m.jspatial.documentation/src/main/resources/com/io7m/jspatial/documentation/documentation.css: -------------------------------------------------------------------------------- 1 | .brand 2 | { 3 | font-size: 75%; 4 | font-family: monospace; 5 | } 6 | 7 | .brand_left 8 | { 9 | float: left; 10 | } 11 | 12 | .brand_right 13 | { 14 | text-align: right; 15 | } 16 | 17 | .package 18 | { 19 | font-family: monospace; 20 | font-weight: bold; 21 | } 22 | 23 | .attribute, 24 | .class, 25 | .command, 26 | .constant, 27 | .element, 28 | .expression, 29 | .file, 30 | .function, 31 | .keyword, 32 | .variable, 33 | .type 34 | { 35 | font-family: monospace; 36 | } 37 | 38 | .example, .license, .terminal 39 | { 40 | font-family: monospace; 41 | border: 1px solid #ccc; 42 | padding-top: 1.0em; 43 | padding-left: 1.0em; 44 | padding-bottom: 1.0em; 45 | margin-top: 1.2em; 46 | overflow: auto; 47 | } 48 | 49 | .dependencies table td 50 | { 51 | padding-right: 3.0em; 52 | font-family: monospace; 53 | font-size: 9pt; 54 | } 55 | 56 | .platforms table td 57 | { 58 | padding-right: 2.0em; 59 | } 60 | .platforms table tbody, 61 | .platforms table thead 62 | { 63 | font-size: 8pt; 64 | font-family: monospace; 65 | } 66 | -------------------------------------------------------------------------------- /com.io7m.jspatial.examples.swing/src/main/assembly/viewer.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | dist 8 | ${project.name}-${project.version} 9 | 10 | 11 | zip 12 | 13 | 14 | 15 | 16 | 17 | / 18 | 0755 19 | src/main/exe/quadtree-viewer-unix.sh 20 | quadtree-viewer-unix.sh 21 | 22 | 23 | 24 | 25 | / 26 | 0755 27 | target/quadtree-viewer.exe 28 | quadtree-viewer.exe 29 | 30 | 31 | / 32 | 0644 33 | src/main/exe/quadtree-viewer.l4j.ini 34 | quadtree-viewer.l4j.ini 35 | false 36 | 37 | 38 | 39 | 40 | 41 | 42 | /lib 43 | true 44 | false 45 | runtime 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /com.io7m.jspatial.examples.swing/src/main/exe/quadtree-viewer-unix.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | JAR_PATH="" 4 | 5 | for JAR in `ls lib/*.jar` 6 | do 7 | if [ -z "${JAR_PATH}" ] 8 | then 9 | JAR_PATH="${JAR}" 10 | else 11 | JAR_PATH="${JAR_PATH}:${JAR}" 12 | fi 13 | done 14 | 15 | exec java -cp "${JAR_PATH}" "com.io7m.jspatial.examples.swing.QuadTreeViewerMain" $@ 16 | -------------------------------------------------------------------------------- /com.io7m.jspatial.examples.swing/src/main/exe/quadtree-viewer.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/io7m-com/jspatial/5743debd0b5a5ed82f386f3fe4597d77015fe94f/com.io7m.jspatial.examples.swing/src/main/exe/quadtree-viewer.ico -------------------------------------------------------------------------------- /com.io7m.jspatial.examples.swing/src/main/exe/quadtree-viewer.l4j.ini: -------------------------------------------------------------------------------- 1 | # Launch4j runtime configuration 2 | -enableassertions -------------------------------------------------------------------------------- /com.io7m.jspatial.examples.swing/src/main/exe/quadtree-viewer.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/io7m-com/jspatial/5743debd0b5a5ed82f386f3fe4597d77015fe94f/com.io7m.jspatial.examples.swing/src/main/exe/quadtree-viewer.xcf -------------------------------------------------------------------------------- /com.io7m.jspatial.examples.swing/src/main/java/com/io7m/jspatial/examples/swing/LogMessageType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.examples.swing; 18 | 19 | import com.io7m.immutables.styles.ImmutablesStyleType; 20 | import org.immutables.value.Value; 21 | 22 | /** 23 | * Log message type. 24 | */ 25 | 26 | @ImmutablesStyleType 27 | @Value.Immutable 28 | interface LogMessageType 29 | { 30 | /** 31 | * @return The message severity 32 | */ 33 | 34 | @Value.Parameter(order = 0) 35 | Severity severity(); 36 | 37 | /** 38 | * @return The message text 39 | */ 40 | 41 | @Value.Parameter(order = 1) 42 | String message(); 43 | 44 | /** 45 | * Log message severity. 46 | */ 47 | 48 | enum Severity 49 | { 50 | /** 51 | * Debug level. 52 | */ 53 | 54 | DEBUG, 55 | 56 | /** 57 | * Info level. 58 | */ 59 | 60 | INFO, 61 | 62 | /** 63 | * Error level. 64 | */ 65 | 66 | ERROR 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /com.io7m.jspatial.examples.swing/src/main/java/com/io7m/jspatial/examples/swing/QuadTreeComboBox.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.examples.swing; 18 | 19 | import javax.swing.JComboBox; 20 | 21 | /** 22 | * A combo box over an enum. 23 | * 24 | * @param The precise enum type 25 | */ 26 | 27 | final class QuadTreeComboBox> extends JComboBox 28 | { 29 | private final T[] values; 30 | 31 | QuadTreeComboBox(final Class c) 32 | { 33 | this.values = c.getEnumConstants(); 34 | for (final T cons : this.values) { 35 | this.addItem(cons); 36 | } 37 | } 38 | 39 | @Override 40 | public T getSelectedItem() 41 | { 42 | final int index = this.getSelectedIndex(); 43 | if (index < 0) { 44 | return null; 45 | } 46 | return this.values[index]; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /com.io7m.jspatial.examples.swing/src/main/java/com/io7m/jspatial/examples/swing/QuadTreeKind.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.examples.swing; 18 | 19 | /** 20 | * The kind of quad tree. 21 | */ 22 | 23 | enum QuadTreeKind 24 | { 25 | /** 26 | * Long integer coordinates. 27 | */ 28 | 29 | LONG_INTEGER, 30 | 31 | /** 32 | * Double coordinates. 33 | */ 34 | 35 | DOUBLE 36 | } 37 | -------------------------------------------------------------------------------- /com.io7m.jspatial.examples.swing/src/main/java/com/io7m/jspatial/examples/swing/QuadTreeViewerMain.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.examples.swing; 18 | 19 | import javax.swing.SwingUtilities; 20 | import javax.swing.WindowConstants; 21 | 22 | /** 23 | * Main program. 24 | */ 25 | 26 | public final class QuadTreeViewerMain 27 | { 28 | private QuadTreeViewerMain() 29 | { 30 | 31 | } 32 | 33 | /** 34 | * Command line entry point. 35 | * 36 | * @param args Command line arguments 37 | */ 38 | 39 | public static void main(final String[] args) 40 | { 41 | SwingUtilities.invokeLater(() -> { 42 | final QuadTreeWindow win = new QuadTreeWindow(); 43 | win.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); 44 | win.pack(); 45 | win.setVisible(true); 46 | }); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /com.io7m.jspatial.examples.swing/src/main/java/com/io7m/jspatial/examples/swing/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | /** 18 | * Swing QuadTree viewer. 19 | */ 20 | 21 | 22 | package com.io7m.jspatial.examples.swing; 23 | 24 | -------------------------------------------------------------------------------- /com.io7m.jspatial.examples.swing/src/main/java/module-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | module com.io7m.jspatial.examples.swing 18 | { 19 | requires java.desktop; 20 | 21 | requires static org.immutables.value; 22 | requires static com.io7m.immutables.style; 23 | 24 | requires com.io7m.jaffirm.core; 25 | requires com.io7m.jregions.core; 26 | requires com.io7m.jspatial.api; 27 | requires com.io7m.jspatial.implementation; 28 | requires com.io7m.jtensors.core; 29 | requires designgridlayout; 30 | requires io.reactivex.rxjava2; 31 | requires org.slf4j; 32 | 33 | exports com.io7m.jspatial.examples.swing; 34 | } 35 | -------------------------------------------------------------------------------- /com.io7m.jspatial.implementation/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 4.0.0 8 | 9 | com.io7m.jspatial 10 | com.io7m.jspatial 11 | 3.0.0-SNAPSHOT 12 | 13 | com.io7m.jspatial.implementation 14 | 15 | jar 16 | com.io7m.jspatial.implementation 17 | Spatial data structures (Main implementation) 18 | https://www.io7m.com/software/jspatial/ 19 | 20 | 21 | 22 | ${project.groupId} 23 | com.io7m.jspatial.api 24 | ${project.version} 25 | 26 | 27 | 28 | com.io7m.jaffirm 29 | com.io7m.jaffirm.core 30 | 31 | 32 | com.io7m.junreachable 33 | com.io7m.junreachable.core 34 | 35 | 36 | com.io7m.jtensors 37 | com.io7m.jtensors.core 38 | 39 | 40 | com.io7m.jregions 41 | com.io7m.jregions.core 42 | 43 | 44 | 45 | it.unimi.dsi 46 | fastutil 47 | 48 | 49 | 50 | org.osgi 51 | org.osgi.annotation.versioning 52 | provided 53 | 54 | 55 | org.osgi 56 | org.osgi.annotation.bundle 57 | provided 58 | 59 | 60 | 61 | org.osgi 62 | org.osgi.service.component.annotations 63 | provided 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /com.io7m.jspatial.implementation/src/main/java/com/io7m/jspatial/implementation/OctTreeSupplierD.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.implementation; 18 | 19 | import com.io7m.jspatial.api.octtrees.OctTreeConfigurationD; 20 | import com.io7m.jspatial.api.octtrees.OctTreeDType; 21 | import com.io7m.jspatial.api.octtrees.OctTreeSupplierDType; 22 | import org.osgi.service.component.annotations.Component; 23 | 24 | /** 25 | * The default implementation of the {@link OctTreeSupplierDType} interface. 26 | */ 27 | 28 | @Component 29 | public final class OctTreeSupplierD implements OctTreeSupplierDType 30 | { 31 | /** 32 | * Construct a new supplier. 33 | */ 34 | 35 | public OctTreeSupplierD() 36 | { 37 | 38 | } 39 | 40 | @Override 41 | public OctTreeDType create(final OctTreeConfigurationD config) 42 | { 43 | return OctTreeD.create(config); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /com.io7m.jspatial.implementation/src/main/java/com/io7m/jspatial/implementation/OctTreeSupplierI.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.implementation; 18 | 19 | import com.io7m.jspatial.api.octtrees.OctTreeConfigurationI; 20 | import com.io7m.jspatial.api.octtrees.OctTreeIType; 21 | import com.io7m.jspatial.api.octtrees.OctTreeSupplierIType; 22 | import org.osgi.service.component.annotations.Component; 23 | 24 | /** 25 | * The default implementation of the {@link OctTreeSupplierIType} interface. 26 | */ 27 | 28 | @Component 29 | public final class OctTreeSupplierI implements OctTreeSupplierIType 30 | { 31 | /** 32 | * Construct a new supplier. 33 | */ 34 | 35 | public OctTreeSupplierI() 36 | { 37 | 38 | } 39 | 40 | @Override 41 | public OctTreeIType create(final OctTreeConfigurationI config) 42 | { 43 | return OctTreeI.create(config); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /com.io7m.jspatial.implementation/src/main/java/com/io7m/jspatial/implementation/OctTreeSupplierL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.implementation; 18 | 19 | import com.io7m.jspatial.api.octtrees.OctTreeConfigurationL; 20 | import com.io7m.jspatial.api.octtrees.OctTreeLType; 21 | import com.io7m.jspatial.api.octtrees.OctTreeSupplierLType; 22 | import org.osgi.service.component.annotations.Component; 23 | 24 | /** 25 | * The default implementation of the {@link OctTreeSupplierLType} interface. 26 | */ 27 | 28 | @Component 29 | public final class OctTreeSupplierL implements OctTreeSupplierLType 30 | { 31 | /** 32 | * Construct a new supplier. 33 | */ 34 | 35 | public OctTreeSupplierL() 36 | { 37 | 38 | } 39 | 40 | @Override 41 | public OctTreeLType create(final OctTreeConfigurationL config) 42 | { 43 | return OctTreeL.create(config); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /com.io7m.jspatial.implementation/src/main/java/com/io7m/jspatial/implementation/OctantsD.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.implementation; 18 | 19 | import com.io7m.jregions.core.unparameterized.volumes.VolumeD; 20 | import com.io7m.jregions.core.unparameterized.volumes.VolumeXYZSplitD; 21 | import com.io7m.jregions.core.unparameterized.volumes.VolumesD; 22 | import com.io7m.junreachable.UnreachableCodeException; 23 | 24 | import java.util.Objects; 25 | 26 | /** 27 | * Functions to divide volumes into octants. 28 | */ 29 | 30 | public final class OctantsD 31 | { 32 | private OctantsD() 33 | { 34 | throw new UnreachableCodeException(); 35 | } 36 | 37 | /** 38 | * Subdivide a volume into eight octants. 39 | * 40 | * @param area The area 41 | * 42 | * @return The resulting area 43 | */ 44 | 45 | public static VolumeXYZSplitD subdivide( 46 | final VolumeD area) 47 | { 48 | Objects.requireNonNull(area, "Volume"); 49 | 50 | return VolumesD.splitAtXYZ( 51 | area, 52 | area.sizeX() / 2.0, 53 | area.sizeY() / 2.0, 54 | area.sizeZ() / 2.0); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /com.io7m.jspatial.implementation/src/main/java/com/io7m/jspatial/implementation/OctantsI.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.implementation; 18 | 19 | import com.io7m.jregions.core.unparameterized.volumes.VolumeI; 20 | import com.io7m.jregions.core.unparameterized.volumes.VolumeXYZSplitI; 21 | import com.io7m.jregions.core.unparameterized.volumes.VolumesI; 22 | import com.io7m.junreachable.UnreachableCodeException; 23 | 24 | import java.util.Objects; 25 | import java.util.Optional; 26 | 27 | /** 28 | * Functions to divide areas into quadrants. 29 | */ 30 | 31 | public final class OctantsI 32 | { 33 | private OctantsI() 34 | { 35 | throw new UnreachableCodeException(); 36 | } 37 | 38 | /** 39 | * Subdivide a volume into eight equal sized quadrants. The volume is not split if the size on any 40 | * axis is less than 2. 41 | * 42 | * @param volume The volume 43 | * 44 | * @return The resulting area 45 | */ 46 | 47 | public static Optional> subdivide( 48 | final VolumeI volume) 49 | { 50 | Objects.requireNonNull(volume, "Volume"); 51 | 52 | if (volume.sizeX() >= 2 && volume.sizeY() >= 2 && volume.sizeZ() >= 2) { 53 | final int size_x = volume.sizeX() / 2; 54 | final int size_y = volume.sizeY() / 2; 55 | final int size_z = volume.sizeZ() / 2; 56 | final VolumeXYZSplitI result = 57 | VolumesI.splitAtXYZ(volume, size_x, size_y, size_z); 58 | return Optional.of(result); 59 | } 60 | return Optional.empty(); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /com.io7m.jspatial.implementation/src/main/java/com/io7m/jspatial/implementation/OctantsL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.implementation; 18 | 19 | import com.io7m.jregions.core.unparameterized.volumes.VolumeL; 20 | import com.io7m.jregions.core.unparameterized.volumes.VolumeXYZSplitL; 21 | import com.io7m.jregions.core.unparameterized.volumes.VolumesL; 22 | import com.io7m.junreachable.UnreachableCodeException; 23 | 24 | import java.util.Objects; 25 | import java.util.Optional; 26 | 27 | /** 28 | * Functions to divide areas into quadrants. 29 | */ 30 | 31 | public final class OctantsL 32 | { 33 | private OctantsL() 34 | { 35 | throw new UnreachableCodeException(); 36 | } 37 | 38 | /** 39 | * Subdivide a volume into eight equal sized quadrants. The volume is not split if the size on any 40 | * axis is less than 2. 41 | * 42 | * @param volume The volume 43 | * 44 | * @return The resulting area 45 | */ 46 | 47 | public static Optional> subdivide( 48 | final VolumeL volume) 49 | { 50 | Objects.requireNonNull(volume, "Volume"); 51 | 52 | if (volume.sizeX() >= 2L && volume.sizeY() >= 2L && volume.sizeZ() >= 2L) { 53 | final long size_x = volume.sizeX() / 2L; 54 | final long size_y = volume.sizeY() / 2L; 55 | final long size_z = volume.sizeZ() / 2L; 56 | final VolumeXYZSplitL result = 57 | VolumesL.splitAtXYZ(volume, size_x, size_y, size_z); 58 | return Optional.of(result); 59 | } 60 | return Optional.empty(); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /com.io7m.jspatial.implementation/src/main/java/com/io7m/jspatial/implementation/QuadTreeSupplierD.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.implementation; 18 | 19 | import com.io7m.jspatial.api.quadtrees.QuadTreeConfigurationD; 20 | import com.io7m.jspatial.api.quadtrees.QuadTreeDType; 21 | import com.io7m.jspatial.api.quadtrees.QuadTreeSupplierDType; 22 | import org.osgi.service.component.annotations.Component; 23 | 24 | /** 25 | * The default implementation of the {@link QuadTreeSupplierDType} interface. 26 | */ 27 | 28 | @Component 29 | public final class QuadTreeSupplierD implements QuadTreeSupplierDType 30 | { 31 | /** 32 | * Construct a new supplier. 33 | */ 34 | 35 | public QuadTreeSupplierD() 36 | { 37 | 38 | } 39 | 40 | @Override 41 | public QuadTreeDType create(final QuadTreeConfigurationD config) 42 | { 43 | return QuadTreeD.create(config); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /com.io7m.jspatial.implementation/src/main/java/com/io7m/jspatial/implementation/QuadTreeSupplierI.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.implementation; 18 | 19 | import com.io7m.jspatial.api.quadtrees.QuadTreeConfigurationI; 20 | import com.io7m.jspatial.api.quadtrees.QuadTreeIType; 21 | import com.io7m.jspatial.api.quadtrees.QuadTreeSupplierIType; 22 | import org.osgi.service.component.annotations.Component; 23 | 24 | /** 25 | * The default implementation of the {@link QuadTreeSupplierIType} interface. 26 | */ 27 | 28 | @Component 29 | public final class QuadTreeSupplierI implements QuadTreeSupplierIType 30 | { 31 | /** 32 | * Construct a new supplier. 33 | */ 34 | 35 | public QuadTreeSupplierI() 36 | { 37 | 38 | } 39 | 40 | @Override 41 | public QuadTreeIType create(final QuadTreeConfigurationI config) 42 | { 43 | return QuadTreeI.create(config); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /com.io7m.jspatial.implementation/src/main/java/com/io7m/jspatial/implementation/QuadTreeSupplierL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.implementation; 18 | 19 | import com.io7m.jspatial.api.quadtrees.QuadTreeConfigurationL; 20 | import com.io7m.jspatial.api.quadtrees.QuadTreeLType; 21 | import com.io7m.jspatial.api.quadtrees.QuadTreeSupplierLType; 22 | import org.osgi.service.component.annotations.Component; 23 | 24 | /** 25 | * The default implementation of the {@link QuadTreeSupplierLType} interface. 26 | */ 27 | 28 | @Component 29 | public final class QuadTreeSupplierL implements QuadTreeSupplierLType 30 | { 31 | /** 32 | * Construct a new supplier. 33 | */ 34 | 35 | public QuadTreeSupplierL() 36 | { 37 | 38 | } 39 | 40 | @Override 41 | public QuadTreeLType create(final QuadTreeConfigurationL config) 42 | { 43 | return QuadTreeL.create(config); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /com.io7m.jspatial.implementation/src/main/java/com/io7m/jspatial/implementation/QuadrantsD.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.implementation; 18 | 19 | import com.io7m.jregions.core.unparameterized.areas.AreaD; 20 | import com.io7m.jregions.core.unparameterized.areas.AreaXYSplitD; 21 | import com.io7m.jregions.core.unparameterized.areas.AreasD; 22 | import com.io7m.junreachable.UnreachableCodeException; 23 | 24 | import java.util.Objects; 25 | 26 | /** 27 | * Functions to divide areas into quadrants. 28 | */ 29 | 30 | public final class QuadrantsD 31 | { 32 | private QuadrantsD() 33 | { 34 | throw new UnreachableCodeException(); 35 | } 36 | 37 | /** 38 | * Subdivide an area into four quadrants. 39 | * 40 | * @param area The area 41 | * 42 | * @return The resulting area 43 | */ 44 | 45 | public static AreaXYSplitD subdivide( 46 | final AreaD area) 47 | { 48 | Objects.requireNonNull(area, "Area"); 49 | 50 | return AreasD.splitAlongXY( 51 | area, 52 | area.sizeX() / 2.0, 53 | area.sizeY() / 2.0); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /com.io7m.jspatial.implementation/src/main/java/com/io7m/jspatial/implementation/QuadrantsI.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.implementation; 18 | 19 | import com.io7m.jregions.core.unparameterized.areas.AreaI; 20 | import com.io7m.jregions.core.unparameterized.areas.AreaXYSplitI; 21 | import com.io7m.jregions.core.unparameterized.areas.AreasI; 22 | import com.io7m.junreachable.UnreachableCodeException; 23 | 24 | import java.util.Objects; 25 | import java.util.Optional; 26 | 27 | /** 28 | * Functions to divide areas into quadrants. 29 | */ 30 | 31 | public final class QuadrantsI 32 | { 33 | private QuadrantsI() 34 | { 35 | throw new UnreachableCodeException(); 36 | } 37 | 38 | /** 39 | * Subdivide an area into four equal sized quadrants. The area is not split if the width and 40 | * height are less than 2. 41 | * 42 | * @param area The area 43 | * 44 | * @return The resulting area 45 | */ 46 | 47 | public static Optional> subdivide( 48 | final AreaI area) 49 | { 50 | Objects.requireNonNull(area, "Area"); 51 | 52 | if (area.sizeX() >= 2 && area.sizeY() >= 2) { 53 | return Optional.of( 54 | AreasI.splitAlongXY( 55 | area, 56 | area.sizeX() / 2, 57 | area.sizeY() / 2)); 58 | } 59 | return Optional.empty(); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /com.io7m.jspatial.implementation/src/main/java/com/io7m/jspatial/implementation/QuadrantsL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.implementation; 18 | 19 | import com.io7m.jregions.core.unparameterized.areas.AreaL; 20 | import com.io7m.jregions.core.unparameterized.areas.AreaXYSplitL; 21 | import com.io7m.jregions.core.unparameterized.areas.AreasL; 22 | import com.io7m.junreachable.UnreachableCodeException; 23 | 24 | import java.util.Objects; 25 | import java.util.Optional; 26 | 27 | /** 28 | * Functions to divide areas into quadrants. 29 | */ 30 | 31 | public final class QuadrantsL 32 | { 33 | private QuadrantsL() 34 | { 35 | throw new UnreachableCodeException(); 36 | } 37 | 38 | /** 39 | * Subdivide an area into four equal sized quadrants. The area is not split if the width and 40 | * height are less than 2. 41 | * 42 | * @param area The area 43 | * 44 | * @return The resulting area 45 | */ 46 | 47 | public static Optional> subdivide( 48 | final AreaL area) 49 | { 50 | Objects.requireNonNull(area, "Area"); 51 | 52 | if (area.sizeX() >= 2L && area.sizeY() >= 2L) { 53 | return Optional.of( 54 | AreasL.splitAlongXY( 55 | area, 56 | area.sizeX() / 2L, 57 | area.sizeY() / 2L)); 58 | } 59 | return Optional.empty(); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /com.io7m.jspatial.implementation/src/main/java/com/io7m/jspatial/implementation/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | /** 18 | * Main implementation. 19 | */ 20 | 21 | @Export 22 | @Version("3.0.0") 23 | package com.io7m.jspatial.implementation; 24 | 25 | import org.osgi.annotation.bundle.Export; 26 | import org.osgi.annotation.versioning.Version; 27 | -------------------------------------------------------------------------------- /com.io7m.jspatial.implementation/src/main/java/module-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | import com.io7m.jspatial.implementation.OctTreeSupplierD; 18 | import com.io7m.jspatial.implementation.OctTreeSupplierI; 19 | import com.io7m.jspatial.implementation.OctTreeSupplierL; 20 | import com.io7m.jspatial.implementation.QuadTreeSupplierD; 21 | import com.io7m.jspatial.implementation.QuadTreeSupplierI; 22 | import com.io7m.jspatial.implementation.QuadTreeSupplierL; 23 | 24 | /** 25 | * Spatial data structures (Main implementation) 26 | */ 27 | 28 | module com.io7m.jspatial.implementation 29 | { 30 | requires static org.osgi.annotation.bundle; 31 | requires static org.osgi.annotation.versioning; 32 | requires static org.osgi.service.component.annotations; 33 | 34 | requires com.io7m.jspatial.api; 35 | requires com.io7m.junreachable.core; 36 | requires com.io7m.jregions.core; 37 | requires it.unimi.dsi.fastutil; 38 | requires com.io7m.jaffirm.core; 39 | requires com.io7m.jtensors.core; 40 | 41 | provides com.io7m.jspatial.api.octtrees.OctTreeSupplierDType with OctTreeSupplierD; 42 | provides com.io7m.jspatial.api.octtrees.OctTreeSupplierLType with OctTreeSupplierL; 43 | provides com.io7m.jspatial.api.octtrees.OctTreeSupplierIType with OctTreeSupplierI; 44 | 45 | provides com.io7m.jspatial.api.quadtrees.QuadTreeSupplierDType with QuadTreeSupplierD; 46 | provides com.io7m.jspatial.api.quadtrees.QuadTreeSupplierLType with QuadTreeSupplierL; 47 | provides com.io7m.jspatial.api.quadtrees.QuadTreeSupplierIType with QuadTreeSupplierI; 48 | 49 | exports com.io7m.jspatial.implementation; 50 | } 51 | -------------------------------------------------------------------------------- /com.io7m.jspatial.implementation/src/main/resources/META-INF/services/com.io7m.jspatial.api.octtrees.OctTreeSupplierDType: -------------------------------------------------------------------------------- 1 | com.io7m.jspatial.implementation.OctTreeSupplierD -------------------------------------------------------------------------------- /com.io7m.jspatial.implementation/src/main/resources/META-INF/services/com.io7m.jspatial.api.octtrees.OctTreeSupplierIType: -------------------------------------------------------------------------------- 1 | com.io7m.jspatial.implementation.OctTreeSupplierI -------------------------------------------------------------------------------- /com.io7m.jspatial.implementation/src/main/resources/META-INF/services/com.io7m.jspatial.api.octtrees.OctTreeSupplierLType: -------------------------------------------------------------------------------- 1 | com.io7m.jspatial.implementation.OctTreeSupplierL -------------------------------------------------------------------------------- /com.io7m.jspatial.implementation/src/main/resources/META-INF/services/com.io7m.jspatial.api.quadtrees.QuadTreeSupplierDType: -------------------------------------------------------------------------------- 1 | com.io7m.jspatial.implementation.QuadTreeSupplierD -------------------------------------------------------------------------------- /com.io7m.jspatial.implementation/src/main/resources/META-INF/services/com.io7m.jspatial.api.quadtrees.QuadTreeSupplierIType: -------------------------------------------------------------------------------- 1 | com.io7m.jspatial.implementation.QuadTreeSupplierI -------------------------------------------------------------------------------- /com.io7m.jspatial.implementation/src/main/resources/META-INF/services/com.io7m.jspatial.api.quadtrees.QuadTreeSupplierLType: -------------------------------------------------------------------------------- 1 | com.io7m.jspatial.implementation.QuadTreeSupplierL -------------------------------------------------------------------------------- /com.io7m.jspatial.tests/src/main/java/com/io7m/jspatial/tests/TestUtilities.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.tests; 18 | 19 | /** 20 | * Test utilities. 21 | */ 22 | 23 | public final class TestUtilities 24 | { 25 | /** 26 | * The number of iterations for each @PercentagePassing rule. 27 | */ 28 | 29 | public static final int TEST_ITERATIONS = 5000; 30 | 31 | private TestUtilities() 32 | { 33 | 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /com.io7m.jspatial.tests/src/main/java/com/io7m/jspatial/tests/api/AreaDContainedGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.tests.api; 18 | 19 | import com.io7m.jaffirm.core.Postconditions; 20 | import java.util.Objects; 21 | import com.io7m.jregions.core.unparameterized.areas.AreaD; 22 | import com.io7m.jregions.core.unparameterized.areas.AreasD; 23 | import net.java.quickcheck.Generator; 24 | 25 | import java.util.Random; 26 | 27 | public final class AreaDContainedGenerator implements Generator 28 | { 29 | private final AreaD container; 30 | 31 | public AreaDContainedGenerator( 32 | final AreaD in_container) 33 | { 34 | this.container = Objects.requireNonNull(in_container, "Container"); 35 | } 36 | 37 | @Override 38 | public AreaD next() 39 | { 40 | final Random random = new Random(); 41 | 42 | final double x_size = 43 | random.nextDouble() * (this.container.sizeX() / 2.0); 44 | final double y_size = 45 | random.nextDouble() * (this.container.sizeY() / 2.0); 46 | 47 | final AreaD initial = AreasD.create( 48 | this.container.minimumX(), 49 | this.container.minimumY(), 50 | x_size, 51 | y_size); 52 | 53 | final double x_shift = random.nextDouble() * x_size; 54 | final double y_shift = random.nextDouble() * y_size; 55 | 56 | final AreaD volume = 57 | AreasD.moveRelative(initial, x_shift, y_shift); 58 | 59 | Postconditions.checkPostconditionV( 60 | AreasD.contains(this.container, volume), 61 | "Area %s contains %s", 62 | this.container, 63 | volume); 64 | return volume; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /com.io7m.jspatial.tests/src/main/java/com/io7m/jspatial/tests/api/AreaIContainedGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.tests.api; 18 | 19 | import com.io7m.jaffirm.core.Postconditions; 20 | import java.util.Objects; 21 | import com.io7m.jregions.core.unparameterized.areas.AreaI; 22 | import com.io7m.jregions.core.unparameterized.areas.AreasI; 23 | import com.io7m.jregions.core.unparameterized.areas.AreasI; 24 | import net.java.quickcheck.Generator; 25 | 26 | import java.util.Random; 27 | 28 | public final class AreaIContainedGenerator implements Generator 29 | { 30 | private final AreaI container; 31 | 32 | public AreaIContainedGenerator( 33 | final AreaI in_container) 34 | { 35 | this.container = Objects.requireNonNull(in_container, "Contaienr"); 36 | } 37 | 38 | @Override 39 | public AreaI next() 40 | { 41 | final Random random = new Random(); 42 | 43 | final int x_size = 44 | random.nextInt(Math.toIntExact((long) (this.container.sizeX() / 2))) + 1; 45 | final int y_size = 46 | random.nextInt(Math.toIntExact((long) (this.container.sizeY() / 2))) + 1; 47 | 48 | final AreaI initial = AreasI.create( 49 | this.container.minimumX(), 50 | this.container.minimumY(), 51 | x_size, 52 | y_size); 53 | 54 | final int x_shift = random.nextInt(Math.toIntExact((long) x_size)); 55 | final int y_shift = random.nextInt(Math.toIntExact((long) y_size)); 56 | 57 | final AreaI area = 58 | AreasI.moveRelative(initial, x_shift, y_shift); 59 | 60 | Postconditions.checkPostconditionV( 61 | AreasI.contains(this.container, area), 62 | "Area %s contains %s", 63 | this.container, 64 | area); 65 | return area; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /com.io7m.jspatial.tests/src/main/java/com/io7m/jspatial/tests/api/AreaLContainedGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.tests.api; 18 | 19 | import com.io7m.jaffirm.core.Postconditions; 20 | import java.util.Objects; 21 | import com.io7m.jregions.core.unparameterized.areas.AreaL; 22 | import com.io7m.jregions.core.unparameterized.areas.AreasL; 23 | import net.java.quickcheck.Generator; 24 | 25 | import java.util.Random; 26 | 27 | public final class AreaLContainedGenerator implements Generator 28 | { 29 | private final AreaL container; 30 | 31 | public AreaLContainedGenerator( 32 | final AreaL in_container) 33 | { 34 | this.container = Objects.requireNonNull(in_container, "Contaienr"); 35 | } 36 | 37 | @Override 38 | public AreaL next() 39 | { 40 | final Random random = new Random(); 41 | 42 | final long x_size = 43 | (long) random.nextInt(Math.toIntExact(this.container.sizeX() / 2L)) + 1L; 44 | final long y_size = 45 | (long) random.nextInt(Math.toIntExact(this.container.sizeY() / 2L)) + 1L; 46 | 47 | final AreaL initial = AreasL.create( 48 | this.container.minimumX(), 49 | this.container.minimumY(), 50 | x_size, 51 | y_size); 52 | 53 | final long x_shift = (long) random.nextInt(Math.toIntExact(x_size)); 54 | final long y_shift = (long) random.nextInt(Math.toIntExact(y_size)); 55 | 56 | final AreaL area = 57 | AreasL.moveRelative(initial, x_shift, y_shift); 58 | 59 | Postconditions.checkPostconditionV( 60 | AreasL.contains(this.container, area), 61 | "Area %s contains %s", 62 | this.container, 63 | area); 64 | return area; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /com.io7m.jspatial.tests/src/main/java/com/io7m/jspatial/tests/api/VolumeDContainedGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.tests.api; 18 | 19 | import com.io7m.jaffirm.core.Postconditions; 20 | import java.util.Objects; 21 | import com.io7m.jregions.core.unparameterized.volumes.VolumeD; 22 | import com.io7m.jregions.core.unparameterized.volumes.VolumesD; 23 | import net.java.quickcheck.Generator; 24 | 25 | import java.util.Random; 26 | 27 | public final class VolumeDContainedGenerator implements Generator 28 | { 29 | private final VolumeD container; 30 | 31 | public VolumeDContainedGenerator( 32 | final VolumeD in_container) 33 | { 34 | this.container = Objects.requireNonNull(in_container, "Container"); 35 | } 36 | 37 | @Override 38 | public VolumeD next() 39 | { 40 | final Random random = new Random(); 41 | 42 | final double x_size = 43 | random.nextDouble() * (this.container.sizeX() / 2.0); 44 | final double y_size = 45 | random.nextDouble() * (this.container.sizeY() / 2.0); 46 | final double z_size = 47 | random.nextDouble() * (this.container.sizeZ() / 2.0); 48 | 49 | final VolumeD initial = VolumesD.create( 50 | this.container.minimumX(), 51 | this.container.minimumY(), 52 | this.container.minimumZ(), 53 | x_size, 54 | y_size, 55 | z_size); 56 | 57 | final double x_shift = random.nextDouble() * x_size; 58 | final double y_shift = random.nextDouble() * y_size; 59 | final double z_shift = random.nextDouble() * z_size; 60 | 61 | final VolumeD volume = 62 | VolumesD.moveRelative(initial, x_shift, y_shift, z_shift); 63 | 64 | Postconditions.checkPostconditionV( 65 | VolumesD.contains(this.container, volume), 66 | "Volume %s contains %s", 67 | this.container, 68 | volume); 69 | return volume; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /com.io7m.jspatial.tests/src/main/java/com/io7m/jspatial/tests/api/octtrees/OctTreeConfigurationDContract.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.tests.api.octtrees; 18 | 19 | import com.io7m.jregions.core.unparameterized.volumes.VolumeD; 20 | import com.io7m.jspatial.api.octtrees.OctTreeConfigurationDType; 21 | import net.java.quickcheck.Generator; 22 | import org.junit.Assert; 23 | import org.junit.Rule; 24 | import org.junit.Test; 25 | import org.junit.rules.ExpectedException; 26 | 27 | /** 28 | * Contract for double precision tree configurations. 29 | */ 30 | 31 | public abstract class OctTreeConfigurationDContract 32 | { 33 | /** 34 | * Expected exception. 35 | */ 36 | 37 | @Rule public final ExpectedException expected = ExpectedException.none(); 38 | 39 | protected abstract Generator generator(); 40 | 41 | protected abstract OctTreeConfigurationDType create( 42 | final VolumeD volume); 43 | 44 | /** 45 | * Identities. 46 | */ 47 | 48 | @Test 49 | public final void testIdentities() 50 | { 51 | final VolumeD volume = VolumeD.of(0.0, 100.0, 0.0, 100.0, 0.0, 100.0); 52 | final OctTreeConfigurationDType c = this.create(volume); 53 | 54 | Assert.assertEquals(volume, c.volume()); 55 | Assert.assertEquals(2.0, c.minimumOctantHeight(), 0.0001); 56 | Assert.assertEquals(2.0, c.minimumOctantWidth(), 0.0001); 57 | Assert.assertEquals(2.0, c.minimumOctantDepth(), 0.0001); 58 | Assert.assertFalse(c.trimOnRemove()); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /com.io7m.jspatial.tests/src/main/java/com/io7m/jspatial/tests/api/octtrees/OctTreeConfigurationDGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.tests.api.octtrees; 18 | 19 | import com.io7m.jregions.generators.VolumeDGenerator; 20 | import com.io7m.jspatial.api.octtrees.OctTreeConfigurationD; 21 | import com.io7m.jspatial.api.octtrees.OctTreeConfigurationDType; 22 | import net.java.quickcheck.Generator; 23 | import net.java.quickcheck.generator.PrimitiveGenerators; 24 | import net.java.quickcheck.generator.support.DoubleGenerator; 25 | 26 | /** 27 | * Generator for tree configurations. 28 | */ 29 | 30 | public final class OctTreeConfigurationDGenerator implements Generator 31 | { 32 | private final VolumeDGenerator volume; 33 | private final DoubleGenerator dgen; 34 | private final Generator bgen; 35 | 36 | public OctTreeConfigurationDGenerator() 37 | { 38 | this.volume = new VolumeDGenerator(new DoubleGenerator()); 39 | this.dgen = new DoubleGenerator(0.0, Double.MAX_VALUE); 40 | this.bgen = PrimitiveGenerators.booleans(); 41 | } 42 | 43 | @Override 44 | public OctTreeConfigurationDType next() 45 | { 46 | final OctTreeConfigurationD.Builder q = OctTreeConfigurationD.builder(); 47 | q.setVolume(this.volume.next()); 48 | q.setMinimumOctantHeight(this.dgen.next().doubleValue()); 49 | q.setMinimumOctantWidth(this.dgen.next().doubleValue()); 50 | q.setMinimumOctantDepth(this.dgen.next().doubleValue()); 51 | q.setTrimOnRemove(this.bgen.next().booleanValue()); 52 | return q.build(); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /com.io7m.jspatial.tests/src/main/java/com/io7m/jspatial/tests/api/octtrees/OctTreeConfigurationIContract.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.tests.api.octtrees; 18 | 19 | import com.io7m.jregions.core.unparameterized.volumes.VolumeI; 20 | import com.io7m.jspatial.api.octtrees.OctTreeConfigurationIType; 21 | import net.java.quickcheck.Generator; 22 | import org.junit.Assert; 23 | import org.junit.Rule; 24 | import org.junit.Test; 25 | import org.junit.rules.ExpectedException; 26 | 27 | /** 28 | * Contract for integer tree configurations. 29 | */ 30 | 31 | public abstract class OctTreeConfigurationIContract 32 | { 33 | /** 34 | * Expected exception. 35 | */ 36 | 37 | @Rule public final ExpectedException expected = ExpectedException.none(); 38 | 39 | protected abstract Generator generator(); 40 | 41 | protected abstract OctTreeConfigurationIType create( 42 | final VolumeI area); 43 | 44 | /** 45 | * Identities. 46 | */ 47 | 48 | @Test 49 | public final void testIdentities() 50 | { 51 | final VolumeI area = VolumeI.of(0, 100, 0, 100, 0, 100); 52 | final OctTreeConfigurationIType c = this.create(area); 53 | 54 | Assert.assertEquals(area, c.volume()); 55 | Assert.assertEquals(2, c.minimumOctantHeight()); 56 | Assert.assertEquals(2, c.minimumOctantWidth()); 57 | Assert.assertEquals(2, c.minimumOctantDepth()); 58 | Assert.assertFalse(c.trimOnRemove()); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /com.io7m.jspatial.tests/src/main/java/com/io7m/jspatial/tests/api/octtrees/OctTreeConfigurationIGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.tests.api.octtrees; 18 | 19 | import com.io7m.jregions.generators.VolumeIGenerator; 20 | import com.io7m.jspatial.api.octtrees.OctTreeConfigurationI; 21 | import com.io7m.jspatial.api.octtrees.OctTreeConfigurationIType; 22 | import net.java.quickcheck.Generator; 23 | import net.java.quickcheck.generator.PrimitiveGenerators; 24 | import net.java.quickcheck.generator.support.IntegerGenerator; 25 | 26 | /** 27 | * Generator for tree configurations. 28 | */ 29 | 30 | public final class OctTreeConfigurationIGenerator 31 | implements Generator 32 | { 33 | private final VolumeIGenerator area; 34 | private final IntegerGenerator igen; 35 | private final Generator bgen; 36 | 37 | public OctTreeConfigurationIGenerator() 38 | { 39 | this.igen = new IntegerGenerator(2, Integer.MAX_VALUE); 40 | this.area = new VolumeIGenerator(this.igen); 41 | this.bgen = PrimitiveGenerators.booleans(); 42 | } 43 | 44 | @Override 45 | public OctTreeConfigurationIType next() 46 | { 47 | final OctTreeConfigurationI.Builder q = OctTreeConfigurationI.builder(); 48 | q.setVolume(this.area.next()); 49 | q.setMinimumOctantHeight(this.igen.next().intValue()); 50 | q.setMinimumOctantWidth(this.igen.next().intValue()); 51 | q.setMinimumOctantDepth(this.igen.next().intValue()); 52 | q.setTrimOnRemove(this.bgen.next().booleanValue()); 53 | return q.build(); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /com.io7m.jspatial.tests/src/main/java/com/io7m/jspatial/tests/api/octtrees/OctTreeConfigurationLContract.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.tests.api.octtrees; 18 | 19 | import com.io7m.jregions.core.unparameterized.volumes.VolumeL; 20 | import com.io7m.jspatial.api.octtrees.OctTreeConfigurationLType; 21 | import net.java.quickcheck.Generator; 22 | import org.junit.Assert; 23 | import org.junit.Rule; 24 | import org.junit.Test; 25 | import org.junit.rules.ExpectedException; 26 | 27 | /** 28 | * Contract for long integer tree configurations. 29 | */ 30 | 31 | public abstract class OctTreeConfigurationLContract 32 | { 33 | /** 34 | * Expected exception. 35 | */ 36 | 37 | @Rule public final ExpectedException expected = ExpectedException.none(); 38 | 39 | protected abstract Generator generator(); 40 | 41 | protected abstract OctTreeConfigurationLType create( 42 | final VolumeL area); 43 | 44 | /** 45 | * Identities. 46 | */ 47 | 48 | @Test 49 | public final void testIdentities() 50 | { 51 | final VolumeL area = VolumeL.of(0L, 100L, 0L, 100L, 0L, 100L); 52 | final OctTreeConfigurationLType c = this.create(area); 53 | 54 | Assert.assertEquals(area, c.volume()); 55 | Assert.assertEquals(2L, c.minimumOctantHeight()); 56 | Assert.assertEquals(2L, c.minimumOctantWidth()); 57 | Assert.assertEquals(2L, c.minimumOctantDepth()); 58 | Assert.assertFalse(c.trimOnRemove()); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /com.io7m.jspatial.tests/src/main/java/com/io7m/jspatial/tests/api/octtrees/OctTreeConfigurationLGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.tests.api.octtrees; 18 | 19 | import com.io7m.jregions.generators.VolumeLGenerator; 20 | import com.io7m.jspatial.api.octtrees.OctTreeConfigurationL; 21 | import com.io7m.jspatial.api.octtrees.OctTreeConfigurationLType; 22 | import net.java.quickcheck.Generator; 23 | import net.java.quickcheck.generator.PrimitiveGenerators; 24 | import net.java.quickcheck.generator.support.LongGenerator; 25 | 26 | /** 27 | * Generator for tree configurations. 28 | */ 29 | 30 | public final class OctTreeConfigurationLGenerator 31 | implements Generator 32 | { 33 | private final VolumeLGenerator area; 34 | private final LongGenerator lgen; 35 | private final Generator bgen; 36 | 37 | public OctTreeConfigurationLGenerator() 38 | { 39 | this.lgen = new LongGenerator(2L, Long.MAX_VALUE); 40 | this.area = new VolumeLGenerator(this.lgen); 41 | this.bgen = PrimitiveGenerators.booleans(); 42 | } 43 | 44 | @Override 45 | public OctTreeConfigurationLType next() 46 | { 47 | final OctTreeConfigurationL.Builder q = OctTreeConfigurationL.builder(); 48 | q.setVolume(this.area.next()); 49 | q.setMinimumOctantHeight(this.lgen.next().longValue()); 50 | q.setMinimumOctantWidth(this.lgen.next().longValue()); 51 | q.setMinimumOctantDepth(this.lgen.next().longValue()); 52 | q.setTrimOnRemove(this.bgen.next().booleanValue()); 53 | return q.build(); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /com.io7m.jspatial.tests/src/main/java/com/io7m/jspatial/tests/api/octtrees/OctTreeRaycastResultDGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.tests.api.octtrees; 18 | 19 | import com.io7m.jregions.generators.VolumeDGenerator; 20 | import com.io7m.jspatial.api.octtrees.OctTreeRaycastResultD; 21 | import com.io7m.jspatial.api.octtrees.OctTreeRaycastResultDType; 22 | import net.java.quickcheck.Generator; 23 | import net.java.quickcheck.generator.support.DoubleGenerator; 24 | 25 | public final class OctTreeRaycastResultDGenerator 26 | implements Generator> 27 | { 28 | private final DoubleGenerator dgen; 29 | private final VolumeDGenerator agen; 30 | private final Generator ogen; 31 | 32 | public OctTreeRaycastResultDGenerator( 33 | final Generator in_ogen) 34 | { 35 | this.dgen = new DoubleGenerator(0.0, Double.MAX_VALUE); 36 | this.agen = new VolumeDGenerator(new DoubleGenerator()); 37 | this.ogen = in_ogen; 38 | } 39 | 40 | @Override 41 | public OctTreeRaycastResultDType next() 42 | { 43 | return OctTreeRaycastResultD.of( 44 | this.dgen.next().doubleValue(), 45 | this.agen.next(), 46 | this.ogen.next()); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /com.io7m.jspatial.tests/src/main/java/com/io7m/jspatial/tests/api/octtrees/OctTreeRaycastResultIGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.tests.api.octtrees; 18 | 19 | import com.io7m.jregions.generators.VolumeIGenerator; 20 | import com.io7m.jspatial.api.octtrees.OctTreeRaycastResultI; 21 | import com.io7m.jspatial.api.octtrees.OctTreeRaycastResultIType; 22 | import net.java.quickcheck.Generator; 23 | import net.java.quickcheck.generator.support.DoubleGenerator; 24 | import net.java.quickcheck.generator.support.IntegerGenerator; 25 | 26 | public final class OctTreeRaycastResultIGenerator 27 | implements Generator> 28 | { 29 | private final DoubleGenerator dgen; 30 | private final VolumeIGenerator agen; 31 | private final Generator ogen; 32 | 33 | public OctTreeRaycastResultIGenerator( 34 | final Generator in_ogen) 35 | { 36 | this.dgen = new DoubleGenerator(0.0, Double.MAX_VALUE); 37 | this.agen = new VolumeIGenerator(new IntegerGenerator()); 38 | this.ogen = in_ogen; 39 | } 40 | 41 | @Override 42 | public OctTreeRaycastResultIType next() 43 | { 44 | return OctTreeRaycastResultI.of( 45 | this.dgen.next().doubleValue(), 46 | this.agen.next(), 47 | this.ogen.next()); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /com.io7m.jspatial.tests/src/main/java/com/io7m/jspatial/tests/api/octtrees/OctTreeRaycastResultLGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.tests.api.octtrees; 18 | 19 | import com.io7m.jregions.generators.VolumeLGenerator; 20 | import com.io7m.jspatial.api.octtrees.OctTreeRaycastResultL; 21 | import com.io7m.jspatial.api.octtrees.OctTreeRaycastResultLType; 22 | import net.java.quickcheck.Generator; 23 | import net.java.quickcheck.generator.support.DoubleGenerator; 24 | import net.java.quickcheck.generator.support.LongGenerator; 25 | 26 | public final class OctTreeRaycastResultLGenerator 27 | implements Generator> 28 | { 29 | private final DoubleGenerator dgen; 30 | private final VolumeLGenerator agen; 31 | private final Generator ogen; 32 | 33 | public OctTreeRaycastResultLGenerator( 34 | final Generator in_ogen) 35 | { 36 | this.dgen = new DoubleGenerator(0.0, Double.MAX_VALUE); 37 | this.agen = new VolumeLGenerator(new LongGenerator()); 38 | this.ogen = in_ogen; 39 | } 40 | 41 | @Override 42 | public OctTreeRaycastResultLType next() 43 | { 44 | return OctTreeRaycastResultL.of( 45 | this.dgen.next().doubleValue(), 46 | this.agen.next(), 47 | this.ogen.next()); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /com.io7m.jspatial.tests/src/main/java/com/io7m/jspatial/tests/api/octtrees/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | /** 18 | * Unit tests against the API octtree types. 19 | */ 20 | 21 | 22 | package com.io7m.jspatial.tests.api.octtrees; 23 | 24 | -------------------------------------------------------------------------------- /com.io7m.jspatial.tests/src/main/java/com/io7m/jspatial/tests/api/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | /** 18 | * Unit tests against the API types. 19 | */ 20 | 21 | 22 | package com.io7m.jspatial.tests.api; 23 | 24 | -------------------------------------------------------------------------------- /com.io7m.jspatial.tests/src/main/java/com/io7m/jspatial/tests/api/quadtrees/QuadTreeConfigurationDContract.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.tests.api.quadtrees; 18 | 19 | import com.io7m.jregions.core.unparameterized.areas.AreaD; 20 | import com.io7m.jspatial.api.quadtrees.QuadTreeConfigurationDType; 21 | import net.java.quickcheck.Generator; 22 | import org.junit.Assert; 23 | import org.junit.Rule; 24 | import org.junit.Test; 25 | import org.junit.rules.ExpectedException; 26 | 27 | /** 28 | * Contract for double precision tree configurations. 29 | */ 30 | 31 | public abstract class QuadTreeConfigurationDContract 32 | { 33 | /** 34 | * Expected exception. 35 | */ 36 | 37 | @Rule public final ExpectedException expected = ExpectedException.none(); 38 | 39 | protected abstract Generator generator(); 40 | 41 | protected abstract QuadTreeConfigurationDType create( 42 | final AreaD area); 43 | 44 | /** 45 | * Identities. 46 | */ 47 | 48 | @Test 49 | public final void testIdentities() 50 | { 51 | final AreaD area = AreaD.of(0.0, 100.0, 0.0, 100.0); 52 | final QuadTreeConfigurationDType c = this.create(area); 53 | 54 | Assert.assertEquals(area, c.area()); 55 | Assert.assertEquals(2.0, c.minimumQuadrantHeight(), 0.0001); 56 | Assert.assertEquals(2.0, c.minimumQuadrantWidth(), 0.0001); 57 | Assert.assertFalse(c.trimOnRemove()); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /com.io7m.jspatial.tests/src/main/java/com/io7m/jspatial/tests/api/quadtrees/QuadTreeConfigurationDGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.tests.api.quadtrees; 18 | 19 | import com.io7m.jregions.generators.AreaDGenerator; 20 | import com.io7m.jspatial.api.quadtrees.QuadTreeConfigurationD; 21 | import com.io7m.jspatial.api.quadtrees.QuadTreeConfigurationDType; 22 | import net.java.quickcheck.Generator; 23 | import net.java.quickcheck.generator.PrimitiveGenerators; 24 | import net.java.quickcheck.generator.support.DoubleGenerator; 25 | 26 | /** 27 | * Generator for tree configurations. 28 | */ 29 | 30 | public final class QuadTreeConfigurationDGenerator implements Generator 31 | { 32 | private final AreaDGenerator area; 33 | private final DoubleGenerator dgen; 34 | private final Generator bgen; 35 | 36 | public QuadTreeConfigurationDGenerator() 37 | { 38 | this.area = new AreaDGenerator(new DoubleGenerator()); 39 | this.dgen = new DoubleGenerator(0.0, Double.MAX_VALUE); 40 | this.bgen = PrimitiveGenerators.booleans(); 41 | } 42 | 43 | @Override 44 | public QuadTreeConfigurationDType next() 45 | { 46 | final QuadTreeConfigurationD.Builder q = QuadTreeConfigurationD.builder(); 47 | q.setArea(this.area.next()); 48 | q.setMinimumQuadrantHeight(this.dgen.next().doubleValue()); 49 | q.setMinimumQuadrantWidth(this.dgen.next().doubleValue()); 50 | q.setTrimOnRemove(this.bgen.next().booleanValue()); 51 | return q.build(); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /com.io7m.jspatial.tests/src/main/java/com/io7m/jspatial/tests/api/quadtrees/QuadTreeConfigurationIContract.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.tests.api.quadtrees; 18 | 19 | import com.io7m.jregions.core.unparameterized.areas.AreaI; 20 | import com.io7m.jspatial.api.quadtrees.QuadTreeConfigurationIType; 21 | import net.java.quickcheck.Generator; 22 | import org.junit.Assert; 23 | import org.junit.Rule; 24 | import org.junit.Test; 25 | import org.junit.rules.ExpectedException; 26 | 27 | /** 28 | * Contract for integer tree configurations. 29 | */ 30 | 31 | public abstract class QuadTreeConfigurationIContract 32 | { 33 | /** 34 | * Expected exception. 35 | */ 36 | 37 | @Rule public final ExpectedException expected = ExpectedException.none(); 38 | 39 | protected abstract Generator generator(); 40 | 41 | protected abstract QuadTreeConfigurationIType create( 42 | final AreaI area); 43 | 44 | /** 45 | * Identities. 46 | */ 47 | 48 | @Test 49 | public final void testIdentities() 50 | { 51 | final AreaI area = AreaI.of(0, 100, 0, 100); 52 | final QuadTreeConfigurationIType c = this.create(area); 53 | 54 | Assert.assertEquals(area, c.area()); 55 | Assert.assertEquals(2L, (long) c.minimumQuadrantHeight()); 56 | Assert.assertEquals(2L, (long) c.minimumQuadrantWidth()); 57 | Assert.assertFalse(c.trimOnRemove()); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /com.io7m.jspatial.tests/src/main/java/com/io7m/jspatial/tests/api/quadtrees/QuadTreeConfigurationIGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.tests.api.quadtrees; 18 | 19 | import com.io7m.jregions.generators.AreaIGenerator; 20 | import com.io7m.jspatial.api.quadtrees.QuadTreeConfigurationI; 21 | import com.io7m.jspatial.api.quadtrees.QuadTreeConfigurationIType; 22 | import net.java.quickcheck.Generator; 23 | import net.java.quickcheck.generator.PrimitiveGenerators; 24 | import net.java.quickcheck.generator.support.IntegerGenerator; 25 | 26 | /** 27 | * Generator for tree configurations. 28 | */ 29 | 30 | public final class QuadTreeConfigurationIGenerator 31 | implements Generator 32 | { 33 | private final AreaIGenerator area; 34 | private final IntegerGenerator igen; 35 | private final Generator bgen; 36 | 37 | public QuadTreeConfigurationIGenerator() 38 | { 39 | this.igen = new IntegerGenerator(2, Integer.MAX_VALUE); 40 | this.area = new AreaIGenerator(this.igen); 41 | this.bgen = PrimitiveGenerators.booleans(); 42 | } 43 | 44 | @Override 45 | public QuadTreeConfigurationIType next() 46 | { 47 | final QuadTreeConfigurationI.Builder q = QuadTreeConfigurationI.builder(); 48 | q.setArea(this.area.next()); 49 | q.setMinimumQuadrantHeight(this.igen.next().intValue()); 50 | q.setMinimumQuadrantWidth(this.igen.next().intValue()); 51 | q.setTrimOnRemove(this.bgen.next().booleanValue()); 52 | return q.build(); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /com.io7m.jspatial.tests/src/main/java/com/io7m/jspatial/tests/api/quadtrees/QuadTreeConfigurationLContract.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.tests.api.quadtrees; 18 | 19 | import com.io7m.jregions.core.unparameterized.areas.AreaL; 20 | import com.io7m.jspatial.api.quadtrees.QuadTreeConfigurationLType; 21 | import net.java.quickcheck.Generator; 22 | import org.junit.Assert; 23 | import org.junit.Rule; 24 | import org.junit.Test; 25 | import org.junit.rules.ExpectedException; 26 | 27 | /** 28 | * Contract for long integer tree configurations. 29 | */ 30 | 31 | public abstract class QuadTreeConfigurationLContract 32 | { 33 | /** 34 | * Expected exception. 35 | */ 36 | 37 | @Rule public final ExpectedException expected = ExpectedException.none(); 38 | 39 | protected abstract Generator generator(); 40 | 41 | protected abstract QuadTreeConfigurationLType create( 42 | final AreaL area); 43 | 44 | /** 45 | * Identities. 46 | */ 47 | 48 | @Test 49 | public final void testIdentities() 50 | { 51 | final AreaL area = AreaL.of(0L, 100L, 0L, 100L); 52 | final QuadTreeConfigurationLType c = this.create(area); 53 | 54 | Assert.assertEquals(area, c.area()); 55 | Assert.assertEquals(2L, c.minimumQuadrantHeight()); 56 | Assert.assertEquals(2L, c.minimumQuadrantWidth()); 57 | Assert.assertFalse(c.trimOnRemove()); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /com.io7m.jspatial.tests/src/main/java/com/io7m/jspatial/tests/api/quadtrees/QuadTreeConfigurationLGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.tests.api.quadtrees; 18 | 19 | import com.io7m.jregions.generators.AreaLGenerator; 20 | import com.io7m.jspatial.api.quadtrees.QuadTreeConfigurationL; 21 | import com.io7m.jspatial.api.quadtrees.QuadTreeConfigurationLType; 22 | import net.java.quickcheck.Generator; 23 | import net.java.quickcheck.generator.PrimitiveGenerators; 24 | import net.java.quickcheck.generator.support.LongGenerator; 25 | 26 | /** 27 | * Generator for tree configurations. 28 | */ 29 | 30 | public final class QuadTreeConfigurationLGenerator 31 | implements Generator 32 | { 33 | private final AreaLGenerator area; 34 | private final LongGenerator lgen; 35 | private final Generator bgen; 36 | 37 | public QuadTreeConfigurationLGenerator() 38 | { 39 | this.lgen = new LongGenerator(2L, Long.MAX_VALUE); 40 | this.area = new AreaLGenerator(this.lgen); 41 | this.bgen = PrimitiveGenerators.booleans(); 42 | } 43 | 44 | @Override 45 | public QuadTreeConfigurationLType next() 46 | { 47 | final QuadTreeConfigurationL.Builder q = QuadTreeConfigurationL.builder(); 48 | q.setArea(this.area.next()); 49 | q.setMinimumQuadrantHeight(this.lgen.next().longValue()); 50 | q.setMinimumQuadrantWidth(this.lgen.next().longValue()); 51 | q.setTrimOnRemove(this.bgen.next().booleanValue()); 52 | return q.build(); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /com.io7m.jspatial.tests/src/main/java/com/io7m/jspatial/tests/api/quadtrees/QuadTreeRaycastResultDGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.tests.api.quadtrees; 18 | 19 | import com.io7m.jregions.generators.AreaDGenerator; 20 | import com.io7m.jspatial.api.quadtrees.QuadTreeRaycastResultD; 21 | import com.io7m.jspatial.api.quadtrees.QuadTreeRaycastResultDType; 22 | import net.java.quickcheck.Generator; 23 | import net.java.quickcheck.generator.support.DoubleGenerator; 24 | 25 | public final class QuadTreeRaycastResultDGenerator 26 | implements Generator> 27 | { 28 | private final DoubleGenerator dgen; 29 | private final AreaDGenerator agen; 30 | private final Generator ogen; 31 | 32 | public QuadTreeRaycastResultDGenerator( 33 | final Generator in_ogen) 34 | { 35 | this.dgen = new DoubleGenerator(0.0, Double.MAX_VALUE); 36 | this.agen = new AreaDGenerator(new DoubleGenerator()); 37 | this.ogen = in_ogen; 38 | } 39 | 40 | @Override 41 | public QuadTreeRaycastResultDType next() 42 | { 43 | return QuadTreeRaycastResultD.of( 44 | this.dgen.next().doubleValue(), 45 | this.agen.next(), 46 | this.ogen.next()); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /com.io7m.jspatial.tests/src/main/java/com/io7m/jspatial/tests/api/quadtrees/QuadTreeRaycastResultIGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.tests.api.quadtrees; 18 | 19 | import com.io7m.jregions.generators.AreaIGenerator; 20 | import com.io7m.jspatial.api.quadtrees.QuadTreeRaycastResultI; 21 | import com.io7m.jspatial.api.quadtrees.QuadTreeRaycastResultIType; 22 | import net.java.quickcheck.Generator; 23 | import net.java.quickcheck.generator.support.DoubleGenerator; 24 | import net.java.quickcheck.generator.support.IntegerGenerator; 25 | 26 | public final class QuadTreeRaycastResultIGenerator 27 | implements Generator> 28 | { 29 | private final DoubleGenerator dgen; 30 | private final AreaIGenerator agen; 31 | private final Generator ogen; 32 | 33 | public QuadTreeRaycastResultIGenerator( 34 | final Generator in_ogen) 35 | { 36 | this.dgen = new DoubleGenerator(0.0, Double.MAX_VALUE); 37 | this.agen = new AreaIGenerator(new IntegerGenerator()); 38 | this.ogen = in_ogen; 39 | } 40 | 41 | @Override 42 | public QuadTreeRaycastResultIType next() 43 | { 44 | return QuadTreeRaycastResultI.of( 45 | this.dgen.next().doubleValue(), 46 | this.agen.next(), 47 | this.ogen.next()); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /com.io7m.jspatial.tests/src/main/java/com/io7m/jspatial/tests/api/quadtrees/QuadTreeRaycastResultLGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.tests.api.quadtrees; 18 | 19 | import com.io7m.jregions.generators.AreaLGenerator; 20 | import com.io7m.jspatial.api.quadtrees.QuadTreeRaycastResultL; 21 | import com.io7m.jspatial.api.quadtrees.QuadTreeRaycastResultLType; 22 | import net.java.quickcheck.Generator; 23 | import net.java.quickcheck.generator.support.DoubleGenerator; 24 | import net.java.quickcheck.generator.support.LongGenerator; 25 | 26 | public final class QuadTreeRaycastResultLGenerator 27 | implements Generator> 28 | { 29 | private final DoubleGenerator dgen; 30 | private final AreaLGenerator agen; 31 | private final Generator ogen; 32 | 33 | public QuadTreeRaycastResultLGenerator( 34 | final Generator in_ogen) 35 | { 36 | this.dgen = new DoubleGenerator(0.0, Double.MAX_VALUE); 37 | this.agen = new AreaLGenerator(new LongGenerator()); 38 | this.ogen = in_ogen; 39 | } 40 | 41 | @Override 42 | public QuadTreeRaycastResultLType next() 43 | { 44 | return QuadTreeRaycastResultL.of( 45 | this.dgen.next().doubleValue(), 46 | this.agen.next(), 47 | this.ogen.next()); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /com.io7m.jspatial.tests/src/main/java/com/io7m/jspatial/tests/api/quadtrees/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | /** 18 | * Unit tests against the API quadtree types. 19 | */ 20 | 21 | 22 | package com.io7m.jspatial.tests.api.quadtrees; 23 | 24 | -------------------------------------------------------------------------------- /com.io7m.jspatial.tests/src/main/java/com/io7m/jspatial/tests/implementation/OctTreeDTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.tests.implementation; 18 | 19 | import com.io7m.jspatial.api.octtrees.OctTreeConfigurationD; 20 | import com.io7m.jspatial.api.octtrees.OctTreeDType; 21 | import com.io7m.jspatial.implementation.OctTreeD; 22 | import com.io7m.jspatial.implementation.OctTreeSupplierD; 23 | import com.io7m.jspatial.tests.api.octtrees.OctTreeDContract; 24 | 25 | /** 26 | * Test for {@link OctTreeD} 27 | */ 28 | 29 | public final class OctTreeDTest extends OctTreeDContract 30 | { 31 | @Override 32 | protected OctTreeDType create(final OctTreeConfigurationD config) 33 | { 34 | return new OctTreeSupplierD().create(config); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /com.io7m.jspatial.tests/src/main/java/com/io7m/jspatial/tests/implementation/OctTreeITest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.tests.implementation; 18 | 19 | import com.io7m.jspatial.api.octtrees.OctTreeConfigurationI; 20 | import com.io7m.jspatial.api.octtrees.OctTreeIType; 21 | import com.io7m.jspatial.implementation.OctTreeI; 22 | import com.io7m.jspatial.implementation.OctTreeSupplierI; 23 | import com.io7m.jspatial.tests.api.octtrees.OctTreeIContract; 24 | 25 | /** 26 | * Test for {@link OctTreeI} 27 | */ 28 | 29 | public final class OctTreeITest extends OctTreeIContract 30 | { 31 | @Override 32 | protected OctTreeIType create(final OctTreeConfigurationI config) 33 | { 34 | return new OctTreeSupplierI().create(config); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /com.io7m.jspatial.tests/src/main/java/com/io7m/jspatial/tests/implementation/OctTreeLTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.tests.implementation; 18 | 19 | import com.io7m.jspatial.api.octtrees.OctTreeConfigurationL; 20 | import com.io7m.jspatial.api.octtrees.OctTreeLType; 21 | import com.io7m.jspatial.implementation.OctTreeL; 22 | import com.io7m.jspatial.implementation.OctTreeSupplierL; 23 | import com.io7m.jspatial.tests.api.octtrees.OctTreeLContract; 24 | 25 | /** 26 | * Test for {@link OctTreeL} 27 | */ 28 | 29 | public final class OctTreeLTest extends OctTreeLContract 30 | { 31 | @Override 32 | protected OctTreeLType create(final OctTreeConfigurationL config) 33 | { 34 | return new OctTreeSupplierL().create(config); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /com.io7m.jspatial.tests/src/main/java/com/io7m/jspatial/tests/implementation/QuadTreeDTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.tests.implementation; 18 | 19 | import com.io7m.jspatial.api.quadtrees.QuadTreeConfigurationD; 20 | import com.io7m.jspatial.api.quadtrees.QuadTreeDType; 21 | import com.io7m.jspatial.implementation.QuadTreeD; 22 | import com.io7m.jspatial.implementation.QuadTreeSupplierD; 23 | import com.io7m.jspatial.tests.api.quadtrees.QuadTreeDContract; 24 | 25 | /** 26 | * Test for {@link QuadTreeD} 27 | */ 28 | 29 | public final class QuadTreeDTest extends QuadTreeDContract 30 | { 31 | @Override 32 | protected QuadTreeDType create( 33 | final QuadTreeConfigurationD config) 34 | { 35 | return new QuadTreeSupplierD().create(config); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /com.io7m.jspatial.tests/src/main/java/com/io7m/jspatial/tests/implementation/QuadTreeITest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.tests.implementation; 18 | 19 | import com.io7m.jspatial.api.quadtrees.QuadTreeConfigurationI; 20 | import com.io7m.jspatial.api.quadtrees.QuadTreeIType; 21 | import com.io7m.jspatial.implementation.QuadTreeL; 22 | import com.io7m.jspatial.implementation.QuadTreeSupplierI; 23 | import com.io7m.jspatial.tests.api.quadtrees.QuadTreeIContract; 24 | 25 | /** 26 | * Test for {@link QuadTreeL} 27 | */ 28 | 29 | public final class QuadTreeITest extends QuadTreeIContract 30 | { 31 | @Override 32 | protected QuadTreeIType create( 33 | final QuadTreeConfigurationI config) 34 | { 35 | return new QuadTreeSupplierI().create(config); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /com.io7m.jspatial.tests/src/main/java/com/io7m/jspatial/tests/implementation/QuadTreeLTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.tests.implementation; 18 | 19 | import com.io7m.jspatial.api.quadtrees.QuadTreeConfigurationL; 20 | import com.io7m.jspatial.api.quadtrees.QuadTreeLType; 21 | import com.io7m.jspatial.implementation.QuadTreeL; 22 | import com.io7m.jspatial.implementation.QuadTreeSupplierL; 23 | import com.io7m.jspatial.tests.api.quadtrees.QuadTreeLContract; 24 | 25 | /** 26 | * Test for {@link QuadTreeL} 27 | */ 28 | 29 | public final class QuadTreeLTest extends QuadTreeLContract 30 | { 31 | @Override 32 | protected QuadTreeLType create( 33 | final QuadTreeConfigurationL config) 34 | { 35 | return new QuadTreeSupplierL().create(config); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /com.io7m.jspatial.tests/src/main/java/com/io7m/jspatial/tests/implementation/QuadrantsDTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.tests.implementation; 18 | 19 | import com.io7m.jregions.core.unparameterized.areas.AreaD; 20 | import com.io7m.jregions.core.unparameterized.areas.AreaXYSplitD; 21 | import com.io7m.jregions.core.unparameterized.areas.AreasD; 22 | import com.io7m.jregions.generators.AreaDGenerator; 23 | import com.io7m.jspatial.implementation.QuadrantsD; 24 | import com.io7m.jspatial.tests.TestUtilities; 25 | import com.io7m.jspatial.tests.rules.PercentagePassRule; 26 | import com.io7m.jspatial.tests.rules.PercentagePassing; 27 | import net.java.quickcheck.generator.support.DoubleGenerator; 28 | import org.junit.Assert; 29 | import org.junit.Rule; 30 | import org.junit.Test; 31 | 32 | public final class QuadrantsDTest 33 | { 34 | @Rule public PercentagePassRule percent = 35 | new PercentagePassRule(TestUtilities.TEST_ITERATIONS); 36 | 37 | @Test 38 | @PercentagePassing 39 | public void testExhaustive() 40 | { 41 | final AreaDGenerator generator = 42 | new AreaDGenerator(new DoubleGenerator()); 43 | 44 | final AreaD area = generator.next(); 45 | final AreaXYSplitD quads = QuadrantsD.subdivide(area); 46 | 47 | Assert.assertTrue(AreasD.contains(area, quads.x0y0())); 48 | Assert.assertTrue(AreasD.contains(area, quads.x1y0())); 49 | Assert.assertTrue(AreasD.contains(area, quads.x0y1())); 50 | Assert.assertTrue(AreasD.contains(area, quads.x1y1())); 51 | 52 | Assert.assertFalse(AreasD.overlaps(quads.x0y0(), quads.x1y0())); 53 | Assert.assertFalse(AreasD.overlaps(quads.x0y0(), quads.x0y1())); 54 | Assert.assertFalse(AreasD.overlaps(quads.x0y0(), quads.x1y1())); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /com.io7m.jspatial.tests/src/main/java/com/io7m/jspatial/tests/implementation/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | /** 18 | * Unit tests against the default implementation. 19 | */ 20 | 21 | 22 | package com.io7m.jspatial.tests.implementation; 23 | 24 | -------------------------------------------------------------------------------- /com.io7m.jspatial.tests/src/main/java/com/io7m/jspatial/tests/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | /** 18 | * Unit tests. 19 | */ 20 | 21 | 22 | package com.io7m.jspatial.tests; 23 | 24 | -------------------------------------------------------------------------------- /com.io7m.jspatial.tests/src/main/java/com/io7m/jspatial/tests/rules/PercentagePassTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.tests.rules; 18 | 19 | import org.junit.Assert; 20 | import org.junit.Rule; 21 | import org.junit.Test; 22 | 23 | public final class PercentagePassTest 24 | { 25 | @Rule public PercentagePassRule percent = new PercentagePassRule(1000); 26 | 27 | @Test 28 | @PercentagePassing(passPercent = 50.0) 29 | public void testOne() 30 | { 31 | System.out.println("Testing"); 32 | 33 | if (Math.random() > 0.8) { 34 | Assert.fail(); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /com.io7m.jspatial.tests/src/main/java/com/io7m/jspatial/tests/rules/PercentagePassing.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | package com.io7m.jspatial.tests.rules; 18 | 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | @Retention(RetentionPolicy.RUNTIME) 25 | @Target({ElementType.METHOD}) 26 | public @interface PercentagePassing 27 | { 28 | /** 29 | * @return The minimum percentage of iterations that must pass for a given 30 | * test 31 | */ 32 | 33 | double passPercent() default 98.0; 34 | } 35 | -------------------------------------------------------------------------------- /com.io7m.jspatial.tests/src/main/java/com/io7m/jspatial/tests/rules/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Mark Raynsford https://www.io7m.com 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 14 | * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | /** 18 | * JUnit rules. 19 | */ 20 | 21 | package com.io7m.jspatial.tests.rules; 22 | 23 | -------------------------------------------------------------------------------- /spotbugs-filter.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /src/site/resources/documentation.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | -------------------------------------------------------------------------------- /src/site/resources/features.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 |
    5 |
  • Quadtree implementations, including efficient area and raycast queries.
  • 6 |
  • Octtree implementations, including efficient volume and raycast queries.
  • 7 |
  • Numerous working examples, such as the octtree viewer pictured above.
  • 8 |
  • Fully documented (Javadoc).
  • 9 |
  • 97% automated unit test coverage.
  • 10 |
  • ISC license.
  • 11 |
  • OSGi-ready
  • 12 |
  • JPMS-ready
  • 13 |
  • Platform independent: Written in pure Java 11.
  • 14 |
  • Rendering system independent (the example viewers use Swing and JOGL, but neither are required to use the library).
  • 15 |
16 |
17 | -------------------------------------------------------------------------------- /src/site/resources/header.xml: -------------------------------------------------------------------------------- 1 | 2 |
3 |

io7m.com | software | jspatial

4 |
5 |
6 | -------------------------------------------------------------------------------- /src/site/resources/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/io7m-com/jspatial/5743debd0b5a5ed82f386f3fe4597d77015fe94f/src/site/resources/icon.png -------------------------------------------------------------------------------- /src/site/resources/jspatial.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/io7m-com/jspatial/5743debd0b5a5ed82f386f3fe4597d77015fe94f/src/site/resources/jspatial.jpg -------------------------------------------------------------------------------- /src/site/resources/overview.xml: -------------------------------------------------------------------------------- 1 |
2 |

3 | 4 | Build status 6 | 7 | 8 | Maven Central 10 | 11 | 12 | Codecov 14 | 15 |

16 | 17 |

18 | The jspatial package provides a set of spatial data structures. 19 |

20 | 21 |
22 | -------------------------------------------------------------------------------- /src/site/resources/quadview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/io7m-com/jspatial/5743debd0b5a5ed82f386f3fe4597d77015fe94f/src/site/resources/quadview.png -------------------------------------------------------------------------------- /src/site/resources/quadview_sm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/io7m-com/jspatial/5743debd0b5a5ed82f386f3fe4597d77015fe94f/src/site/resources/quadview_sm.png -------------------------------------------------------------------------------- /src/site/resources/site.css: -------------------------------------------------------------------------------- 1 | p.shields a { 2 | text-decoration: none; 3 | } 4 | 5 | #header { 6 | font-family: monospace; 7 | } 8 | -------------------------------------------------------------------------------- /src/site/resources/viewer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/io7m-com/jspatial/5743debd0b5a5ed82f386f3fe4597d77015fe94f/src/site/resources/viewer.png --------------------------------------------------------------------------------