Skip to content

Commit 4102e2a

Browse files
authored
Merge pull request #22 from Gaia3D/develop
mago-3d-terrainer v1.13.0-release
2 parents 3c0d8bd + 0c9dd87 commit 4102e2a

63 files changed

Lines changed: 4981 additions & 1868 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# mago-common must be reviewed by maintainer
2+
/mago-common @znkim

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,4 @@ bin/
5050
.DS_Store
5151
Cigolle2014Vector.pdf
5252
terrainer/gradle.properties
53+
/.gradle-home/

CONTRIBUTING.md

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
# CONTRIBUTING.md
2+
3+
## Overview
4+
5+
Thank you for contributing!
6+
This project is maintained with a focus on consistency across multiple related repositories.
7+
8+
---
9+
10+
## Branch Strategy
11+
12+
* `main` and `develop` branches are managed directly by maintainers
13+
* Contributors should NOT push directly to `main` or `develop`
14+
* All changes must be submitted via Pull Request
15+
16+
### Release
17+
18+
* Releases are managed via Git tags
19+
* No separate release branches are used
20+
21+
---
22+
23+
## Pull Request Guidelines
24+
25+
* All changes must go through Pull Request
26+
* Keep PRs small and focused (one logical change per PR)
27+
* Avoid mixing unrelated changes
28+
29+
### PR Description must include:
30+
31+
* What was changed
32+
* Why it was changed
33+
* How it was tested (or verified)
34+
35+
---
36+
37+
## Commit Message Convention
38+
39+
Use the following prefixes:
40+
41+
* `feat` - for new features or enhancements
42+
* `fix` - for bug fixes
43+
* `chore` - for maintenance tasks (e.g., updating dependencies, formatting)
44+
* `test` - for adding or updating tests
45+
* `build` - for build-related changes (e.g., CI configuration)
46+
* `refactor` - for code restructuring without changing functionality
47+
48+
### Rules
49+
50+
* Messages must be written in **sentence form**
51+
* `feat` messages must start with an **imperative verb**
52+
53+
### Examples
54+
55+
```
56+
feat: Add terrain sampling option
57+
fix: Resolve bounding box overflow issue
58+
refactor: Simplify voxel processing logic
59+
chore: Update dependency versions
60+
```
61+
62+
---
63+
64+
## Common Module Policy (mago-common)
65+
66+
`mago-common` is a shared module used across multiple projects such as:
67+
68+
* mago-3d-tiler
69+
* mago-3d-terrainer
70+
71+
### Rules
72+
73+
* Only implement **general-purpose and reusable logic**
74+
* Avoid project-specific code inside `mago-common`
75+
* Keep the structure simple and broadly applicable
76+
77+
### IMPORTANT
78+
79+
* All modifications must be **carefully reviewed before merging**
80+
* Changes in common logic may affect multiple projects
81+
82+
---
83+
84+
## Subtree Sync Policy
85+
86+
This repository uses `git subtree` for synchronization.
87+
88+
### Rules
89+
90+
* Do NOT run `git subtree push`
91+
* Use `git subtree pull` only when syncing
92+
* Shared logic must be updated at the source before syncing
93+
94+
---
95+
96+
## Review Criteria
97+
98+
Pull Requests will be reviewed based on:
99+
100+
* Reusability (no project-specific logic in common modules)
101+
* Code clarity and simplicity
102+
* Avoidance of duplicated logic
103+
* Minimal and focused changes
104+
105+
---
106+
107+
## Testing
108+
109+
* Add tests when applicable
110+
* If tests are not included, clearly describe how the change was verified
111+
112+
---
113+
114+
## Notes
115+
116+
If your change affects shared logic or has wide impact,
117+
please discuss it before implementation.
118+
119+
When unsure, open an issue first.

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
subprojects {
22
group "com.gaia3d"
3-
version '1.12.0-release'
3+
version '1.13.0-release'
44
apply plugin: 'java'
55
project.ext.lwjglVersion = "3.3.6"
66

@@ -115,4 +115,4 @@ tasks.register('javadocs', Javadoc) {
115115
options.encoding = 'UTF-8'
116116
options.memberLevel = JavadocMemberLevel.PUBLIC
117117
options.addStringOption('Xdoclint:none', '-quiet')
118-
}
118+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#Mon Mar 23 09:30:30 KST 2026
2+
distributionBase=GRADLE_USER_HOME
3+
distributionPath=wrapper/dists
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-bin.zip
5+
zipStoreBase=GRADLE_USER_HOME
6+
zipStorePath=wrapper/dists

mago-common/src/main/java/com/gaia3d/basic/geometry/entities/GaiaPlane.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
@Slf4j
99
@Getter
1010
@Setter
11-
1211
public class GaiaPlane {
1312
private final double a;
1413
private final double b;
@@ -36,6 +35,14 @@ public GaiaPlane(Vector3d position, Vector3d normal) {
3635
this.d = -position.dot(normal);
3736
}
3837

38+
public static GaiaPlane setPlaneFromPositionAndNormal(Vector3d position, Vector3d normal) {
39+
double a = normal.x;
40+
double b = normal.y;
41+
double c = normal.z;
42+
double d = -position.dot(normal);
43+
return new GaiaPlane(a, b, c, d);
44+
}
45+
3946
public double distanceToPoint(Vector3d point) {
4047
return a * point.x + b * point.y + c * point.z + d;
4148
}

mago-common/src/main/java/com/gaia3d/basic/geometry/entities/GaiaTriangle.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.gaia3d.basic.geometry.entities;
22

33
import com.gaia3d.basic.geometry.GaiaBoundingBox;
4+
import com.gaia3d.basic.model.GaiaVertex;
45
import lombok.Getter;
56
import lombok.Setter;
67
import lombok.extern.slf4j.Slf4j;
@@ -80,4 +81,12 @@ public Vector3d getBarycenter() {
8081
(point1.z + point2.z + point3.z) / 3
8182
);
8283
}
84+
85+
public double area() {
86+
Vector3d edge1 = new Vector3d(point2).sub(point1);
87+
Vector3d edge2 = new Vector3d(point3).sub(point1);
88+
Vector3d crossProduct = new Vector3d();
89+
edge1.cross(edge2, crossProduct);
90+
return 0.5 * crossProduct.length();
91+
}
8392
}
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
package com.gaia3d.basic.geometry.modifier;
2+
3+
import com.gaia3d.basic.halfedge.*;
4+
import lombok.extern.slf4j.Slf4j;
5+
import org.joml.Matrix4d;
6+
7+
import java.util.List;
8+
9+
@Slf4j
10+
abstract public class HalfEdgeModifier {
11+
12+
public void apply(HalfEdgeScene scene) {
13+
List<HalfEdgeNode> rootNodes = scene.getNodes();
14+
for (HalfEdgeNode node : rootNodes) {
15+
applyNode(new Matrix4d(), node);
16+
}
17+
}
18+
19+
public void applyNode(Matrix4d parentTransformMatrix, HalfEdgeNode node) {
20+
Matrix4d localTransformMatrix = node.getTransformMatrix();
21+
Matrix4d productTransformMatrix = new Matrix4d(parentTransformMatrix);
22+
productTransformMatrix.mul(localTransformMatrix);
23+
List<HalfEdgeNode> children = node.getChildren();
24+
if (children != null && !children.isEmpty()) {
25+
for (HalfEdgeNode child : children) {
26+
applyNode(productTransformMatrix, child);
27+
}
28+
}
29+
30+
List<HalfEdgeMesh> meshes = node.getMeshes();
31+
for (HalfEdgeMesh mesh : meshes) {
32+
applyMesh(productTransformMatrix, mesh);
33+
}
34+
}
35+
36+
public void applyMesh(Matrix4d productTransformMatrix, HalfEdgeMesh mesh) {
37+
List<HalfEdgePrimitive> primitives = mesh.getPrimitives();
38+
for (HalfEdgePrimitive primitive : primitives) {
39+
applyPrimitive(productTransformMatrix, primitive);
40+
}
41+
}
42+
43+
public void applyPrimitive(Matrix4d productTransformMatrix, HalfEdgePrimitive primitive) {
44+
List<HalfEdgeVertex> vertices = primitive.getVertices();
45+
for (HalfEdgeVertex vertex : vertices) {
46+
applyVertex(productTransformMatrix, vertex);
47+
}
48+
49+
List<HalfEdgeSurface> surfaces = primitive.getSurfaces();
50+
for (HalfEdgeSurface surface : surfaces) {
51+
// Note: In HalfEdgeScene, the vertices are managed by surfaces, no by primitives
52+
List<HalfEdgeVertex> surfaceVertices = surface.getVertices();
53+
applySurface(productTransformMatrix, surfaceVertices, surface);
54+
}
55+
}
56+
57+
public void applyVertex(Matrix4d productTransformMatrix, HalfEdgeVertex vertex) {
58+
59+
}
60+
61+
public void applySurface(Matrix4d productTransformMatrix, List<HalfEdgeVertex> vertices, HalfEdgeSurface surface) {
62+
List<HalfEdgeFace> faces = surface.getFaces();
63+
for (HalfEdgeFace face : faces) {
64+
applyFace(productTransformMatrix, vertices, face);
65+
}
66+
}
67+
68+
public void applyFace(Matrix4d productTransformMatrix, List<HalfEdgeVertex> vertices, HalfEdgeFace face) {
69+
70+
}
71+
}

0 commit comments

Comments
 (0)