This commit is contained in:
Paul Reilly
2023-06-20 09:24:49 -05:00
parent d18c552af0
commit c68a344a39
55 changed files with 1325 additions and 188 deletions

42
Caravan/.gitignore vendored Normal file
View File

@ -0,0 +1,42 @@
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/
### IntelliJ IDEA ###
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/libraries/
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/
### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
### VS Code ###
.vscode/
### Mac OS ###
.DS_Store

19
Caravan/build.gradle Normal file
View File

@ -0,0 +1,19 @@
plugins {
id 'java'
}
group = 'io.github.simplexdev'
version = '1.0-SNAPSHOT'
repositories {
mavenCentral()
}
dependencies {
testImplementation platform('org.junit:junit-bom:5.9.1')
testImplementation 'org.junit.jupiter:junit-jupiter'
}
test {
useJUnitPlatform()
}

View File

@ -0,0 +1,5 @@
package io.github.simplexdev.caravan;
public interface CaravanAPI {
}

View File

@ -0,0 +1,4 @@
package io.github.simplexdev.caravan.api;
public interface Graph {
}

View File

@ -0,0 +1,12 @@
package io.github.simplexdev.caravan.api;
import io.github.simplexdev.caravan.api.curve.GenericCurve;
import io.github.simplexdev.caravan.spatial.Point;
import java.util.Set;
public interface Mapper {
<T extends GenericCurve> Set<Point> generateCurve(T curve);
}

View File

@ -0,0 +1,31 @@
package io.github.simplexdev.caravan.api.curve;
import io.github.simplexdev.caravan.spatial.Point;
import java.util.LinkedHashSet;
public interface GenericCurve {
LinkedHashSet<Point> linkedPoints();
default void addPoint(Point point) {
linkedPoints().add(point);
}
default void removePoint(Point point) {
linkedPoints().remove(point);
}
default void clearPoints() {
linkedPoints().clear();
}
default boolean containsPoint(Point point) {
return linkedPoints().contains(point);
}
default void addPoints(Point... points) {
for (Point point : points) {
addPoint(point);
}
}
}

View File

@ -0,0 +1,25 @@
package io.github.simplexdev.caravan.api.curve;
import io.github.simplexdev.caravan.spatial.Point;
public interface Helix extends GenericCurve {
double getRadius();
double getDistance();
default double getX(double pos) {
return getRadius() * Math.cos(pos);
}
default double getY(double pos) {
return getRadius() * Math.sin(pos);
}
default double getZ(double pos) {
return getDistance() * pos;
}
default Point toPoint(double pos) {
return new Point(getX(pos), getY(pos), getZ(pos));
}
}

View File

@ -0,0 +1,11 @@
package io.github.simplexdev.caravan.api.curve;
public interface Torus {
double getDistanceFromCenter();
double getRadius();
default double getX() {
}
}

View File

@ -0,0 +1,11 @@
package io.github.simplexdev.caravan.base;
import io.github.simplexdev.caravan.CaravanAPI;
public final class Caravan implements CaravanAPI {
private static final CaravanAPI api = new Caravan();
public static CaravanAPI getAPI() {
return api;
}
}

View File

@ -0,0 +1,65 @@
package io.github.simplexdev.caravan.spatial;
public class Point {
private final double x;
private final double y;
private final double z;
private double xOffset;
private double yOffset;
private double zOffset;
public Point(double x, double y, double z) {
this.x = x;
this.y = y;
this.z = z;
this.xOffset = 0;
this.yOffset = 0;
this.zOffset = 0;
}
public Point(double x, double y, double z, double xOffset, double yOffset, double zOffset) {
this.x = x;
this.y = y;
this.z = z;
this.xOffset = xOffset;
this.yOffset = yOffset;
this.zOffset = zOffset;
}
public double getX() {
return x;
}
public double getY() {
return y;
}
public double getZ() {
return z;
}
public double getXOffset() {
return xOffset;
}
public void setXOffset(double xOffset) {
this.xOffset = xOffset;
}
public double getYOffset() {
return yOffset;
}
public void setYOffset(double yOffset) {
this.yOffset = yOffset;
}
public double getZOffset() {
return zOffset;
}
public void setZOffset(double zOffset) {
this.zOffset = zOffset;
}
}