Java-based geometry and processing engine for parametric 2D shape manufacturing workflows.
It validates incoming shape definitions, resolves parametric data, and generates Java outputs used by downstream preview and execution systems.
GSAP Geometry Core acts as the processing backend between editor-created shape JSON and manufacturing-ready generated artifacts.
Primary responsibilities:
- Parse and normalize shape JSON (legacy and parametric formats)
- Validate geometric correctness with tolerance-aware rules
- Execute shape-processing pipeline logic
- Generate dual Java output classes per shape (
ShapeTransformer+ShapePreview) - Run as a Redis + MySQL worker in integrated environments
Shape JSON (from editor / DB)
|
v
ShapeLoader
|
v
Domain Model (Point, Edge, Shape, ...)
|
v
GeometryValidator
|
v
Shape Pipeline + Generators
|
v
Generated Java output artifacts
For deeper architecture details, see Documentation/ARCHITECTURE.md.
- Immutable primitives and edge types (
LineEdge,ArcEdge) - Epsilon-aware comparisons for numerical stability
- Utility methods for perimeter and geometry calculations
- Supports legacy
v1.0shape definitions - Supports
v2.0parametric definitions with expression-based points - DTO-based parsing boundary to keep domain model safe and strict
- Enforces minimum topology requirements
- Checks closure and edge connectivity
- Flags invalid or degenerate geometry
- Returns aggregated validation errors instead of failing fast on first issue
- Produces two Java outputs for each processed shape:
ShapeTransformerfor execution logicShapePreviewfor visualization metadata
See PARAMETRIC_FORMAT.md and DUAL_OUTPUT.md for full contracts.
GSAP Geometry Core/
|- src/main/java/com/company/gsap/
| |- model/ # Domain types (edges, points, shape)
| |- loader/ # JSON parsing + DTOs
| |- validation/ # Geometry validation rules
| |- pipeline/ # Shape processing orchestration
| |- generator/ # Java output generation
| |- engine/ # Geometry engine, SVG, measurements (adjacent to pipeline)
| `- worker/ # Redis/MySQL worker runtime
|- src/test/ # Unit and integration-style tests
|- shapes/ # Input/output working directories
|- Documentation/ # Format specs, architecture, quick reference
|- pom.xml # Maven build configuration
`- README.md
- Java 17+
- Maven 3.6+
- MySQL (for worker/database integration mode)
- Redis (for queue consumption mode)
mvn clean testUseful commands:
mvn compile- compile source onlymvn test- run testsmvn -q exec:java- run worker entrypoint (WorkerApplication)mvn -q -DskipTests package- build fat jar via shade plugin
Generated jar:
target/gsap-geometry-worker.jar
Run jar directly:
java -jar target/gsap-geometry-worker.jarMain class: com.company.gsap.worker.WorkerApplication
The worker:
- Reads jobs from Redis list key
- Fetches and updates shape state in MySQL
- Runs pipeline/generation
- Writes output to configured output directory
The worker reads these env vars:
JDBC_URL(optional ifMYSQL_*provided)MYSQL_HOST(defaultlocalhost)MYSQL_PORT(default3306)MYSQL_DATABASE(defaultgsap_editor)MYSQL_USER(defaultroot)MYSQL_PASSWORDREDIS_HOST(default127.0.0.1)REDIS_PORT(default6379)REDIS_PASSWORD(optional)SHAPE_JOB_LIST_KEY(defaultgsap:shape-processing:jobs)OUTPUT_DIR(defaultshapes/output)
Example (PowerShell):
$env:MYSQL_HOST="localhost"
$env:MYSQL_PORT="3306"
$env:MYSQL_DATABASE="gsap_editor"
$env:MYSQL_USER="root"
$env:MYSQL_PASSWORD="your_password"
$env:REDIS_HOST="127.0.0.1"
$env:REDIS_PORT="6379"
$env:SHAPE_JOB_LIST_KEY="gsap:shape-processing:jobs"
$env:OUTPUT_DIR="shapes/output"
mvn -q exec:javaTypical local flow:
- Place shape payloads in
shapes/input/(if running file-based pipeline tooling) - Generated Java outputs are written to
shapes/output/ - Processed/failed input routing depends on pipeline mode and configuration
ShapeLoader loader = new ShapeLoader();
Shape shape = loader.load("path/to/shape.json");
GeometryValidator validator = new GeometryValidator();
ValidationResult result = validator.validate(shape);
if (result.isValid()) {
System.out.println("Shape valid: " + shape.getName());
} else {
result.getErrors().forEach(System.err::println);
}This is a personal/Research project. Not currently accepting contributions, but feel free to fork and experiment.
- Import the project as a Maven project (File → Open → project root or
pom.xml). - Open the Maven tool window (View → Tool Windows → Maven).
- Build and test: Lifecycle →
clean, thentestorinstall. - Run the worker: Plugins →
exec→exec:java(this startsWorkerApplication; ensure Redis and MySQL are available and env vars are set — see Running Worker Mode).
mvn clean test
mvn -q exec:javaexec:java runs the Redis + MySQL worker, not a standalone “watch input folder” CLI. To exercise the JSON pipeline locally, use unit/integration tests or embed ShapePipeline in your own code.
When using file-based tooling or tests, inputs and outputs often live under shapes/input/ and shapes/output/; the worker uses OUTPUT_DIR (default shapes/output) for generated artifacts.
- Documentation/DOCUMENTATION_INDEX.md — navigation
- Documentation/ARCHITECTURE.md — pipeline architecture
- Documentation/PARAMETRIC_FORMAT.md — v2.0 JSON schema
- Documentation/DUAL_OUTPUT.md — generated Java outputs
- Documentation/QUICK_REFERENCE.md — commands and APIs
Open the project via File → Open → pom.xml → “Open as Project”, then wait for Maven indexing.
Resolved in code by using Paths.get(resource.toURI()) instead of URL.getPath() on Windows.
pom.xml sets <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>.
- MySQL connection errors: verify
MYSQL_*/JDBC_URLand database availability. - Redis connection errors: verify
REDIS_HOST/REDIS_PORTand server state. - No generated files: ensure
OUTPUT_DIRexists or is creatable; check worker logs. - Test path issues on Windows: avoid raw URL paths for classpath resources; prefer URI-based resolution.
Project: GSAP Geometry Core
Started: February 2026
Author: Damitha Samarakoon
MIT