You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+76-31Lines changed: 76 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,25 +10,45 @@ A _JAVA_ library to construct and manipulate geometry in Three-dimensional space
10
10
11
11
## Background / Intension
12
12
13
-
This Java library began as a hobby project in 2015/2016. I started it to deepen my understanding of creating and manipulating 3D geometry. This built upon knowledge I gained from an earlier internship with product design students. During that time, I was introduced to the programming language Processing.
14
-
15
-
Processing captivated me from the start. Designed for visual learners, Processing is a great tool to get started with programming. You can learn more at processing.org. While Processing isn't strictly necessary, the library's core functionality is independent of the Processing environment. However, Processing offers a convenient way to visualize constructed meshes through its rendering pipeline, which leverages JAVA, JAVA2D, and OPENGL.
13
+
This Java library began as a hobby project in 2015/2016. I started it to
14
+
deepen my understanding of creating and manipulating 3D geometry. This built
15
+
upon knowledge I gained from an earlier internship with product design students.
16
+
During that time, I was introduced to the programming language Processing.
17
+
18
+
Processing captivated me from the start. Designed for visual learners,
19
+
Processing is a great tool to get started with programming. You can learn more
20
+
at processing.org. While Processing isn't strictly necessary, the library's
21
+
core functionality is independent of the Processing environment. However,
22
+
Processing offers a convenient way to visualize constructed meshes through its
23
+
rendering pipeline, which leverages JAVA, JAVA2D, and OPENGL.
16
24
17
25
## Status Quo
18
-
Currently, my primary focus is on refining the user documentation. As my understanding of code structure and architecture has evolved, I've been actively refactoring the codebase to maintain its cleanliness and organization. Smaller additions are made periodically.
26
+
Currently, my primary focus is on refining the user documentation. As my
27
+
understanding of code structure and architecture has evolved, I've been
28
+
actively refactoring the codebase to maintain its cleanliness and organization.
29
+
Smaller additions are made periodically.
19
30
20
-
In essence, this codebase serves as a platform for learning and working with legacy code. I've embraced the challenge of working with existing code, viewing it as an opportunity to explore new testing approaches. Constructing tests around legacy code for refactoring purposes is a fascinating and valuable endeavor, in my opinion, an essential practice.
31
+
In essence, this codebase serves as a platform for learning and working with
32
+
legacy code. I've embraced the challenge of working with existing code, viewing
33
+
it as an opportunity to explore new testing approaches. Constructing tests
34
+
around legacy code for refactoring purposes is a fascinating and valuable
35
+
endeavor, in my opinion, an essential practice.
21
36
22
37
## Future
23
38
24
-
The scope of related topics is vast, and my list of potential features is accordingly expansive. Some of these are outlined under 'Planned Features'.
39
+
The scope of related topics is vast, and my list of potential features is
40
+
accordingly expansive. Some of these are outlined under 'Planned Features'.
25
41
26
42
## Core Features
27
43
28
-
***3D Geometry Creation and Manipulation** Build a wide range of 3D shapes and modify them using various operations.
29
-
***Customizable Mesh Creation:** Create custom shapes using a variety of mesh creation tools and modifiers.
30
-
***Extensible Framework:** Easily add new features and functionalities to the library.
31
-
***OBJ File Import and Export:** Import and export 3D models in the OBJ file format.
44
+
***3D Geometry Creation and Manipulation** Build a wide range of 3D shapes and
45
+
modify them using various operations.
46
+
***Customizable Mesh Creation:** Create custom shapes using a variety of mesh
47
+
creation tools and modifiers.
48
+
***Extensible Framework:** Easily add new features and functionalities to the
49
+
library.
50
+
***OBJ File Import and Export:** Import and export 3D models in the OBJ file
51
+
format.
32
52
33
53
## Showcase
34
54
@@ -54,15 +74,20 @@ Throwing some conway operations on a cube seed.
54
74
## Coordinate System
55
75
56
76
The library is build up on a left-handed coordinate system.
57
-
The decision was justified by using the 'Processing' rendering pipeline in the first place.
58
-
But the core library is highly decoupled from the 'Processing' environment.
59
-
So the library could be used independently.
77
+
The decision was justified by using the 'Processing' rendering pipeline in the
78
+
first place. But the core library is highly decoupled from the 'Processing'
79
+
environment. So the library could be used independently.
60
80
61
81
## Mesh3D
62
82
63
-
The following example shows how to work with the base mesh class. For this purpose we want to create a simple quad. The quad has four vertices, one for each
64
-
corner. To make things a bit more explanatory we compose the quad out of two triangular faces. **Important:** This is just an example to illustrate the base concepts. The library already provides a convenient way to construct primitives and more complex shapes. But we dive into this at a later point. For now
65
-
let's keep things simple. But also keep in mind that it might be useful to construct shapes by yourself in some cases.
83
+
The following example shows how to work with the base mesh class. For this
84
+
purpose we want to create a simple quad. The quad has four vertices, one for
85
+
each corner. To make things a bit more explanatory we compose the quad out of
86
+
two triangular faces. **Important:** This is just an example to illustrate the
87
+
base concepts. The library already provides a convenient way to construct
88
+
primitives and more complex shapes. But we dive into this at a later point.
89
+
For now let's keep things simple. But also keep in mind that it might be useful
90
+
to construct shapes by yourself in some cases.
66
91
67
92
```
68
93
(-1, 0, -1) (1, 0, -1)
@@ -88,7 +113,8 @@ Mesh3D mesh = new Mesh3D();
88
113
89
114
### Vertex Coordinates
90
115
91
-
Next we determine the shape's coordinates in Three-Dimensional space. In this case the shape lies flat on the xz plane, so each y-coordinate is 0.0f.
116
+
Next we determine the shape's coordinates in Three-Dimensional space.
117
+
In this case the shape lies flat on the xz plane, so each y-coordinate is 0.0f.
92
118
93
119
```java
94
120
mesh.add(newVector3f(1, 0, -1));
@@ -122,8 +148,9 @@ The added vertices are now at an indexed position within the mesh.
122
148
21
123
149
```
124
150
125
-
Knowing the index of each vertex makes adding faces a piece of cake. We only have to take care of the winding order. Inthiscase the winding order
126
-
is counter-clockwise with all face normals pointing up towards negative y.
151
+
Knowing the index of each vertex makes adding faces a piece of cake. We only
152
+
have to take care of the winding order. Inthiscase the winding order is
153
+
counter-clockwise with all face normals pointing up towards negative y.
127
154
128
155
```java
129
156
mesh.addFace(0, 1, 3);
@@ -134,14 +161,16 @@ mesh.addFace(1, 2, 3);
134
161
135
162
### Modify the mesh
136
163
137
-
Now we have a mesh constisting of four vertices and two triangular faces. This could be retrieved by using:
164
+
Now we have a mesh constisting of four vertices and two triangular faces.
165
+
This could be retrieved by using:
138
166
139
167
```java
140
168
int vertexCount = mesh.getVertexCount();
141
169
int faceCount = mesh.getFaceCount();
142
170
```
143
171
144
-
We can modify the present mesh by using so called _Modifiers_. Each modifier derives from the root interface `IMeshModifier`.
172
+
We can modify the present mesh by using so called _Modifiers_.
173
+
Each modifier derives from the root interface `IMeshModifier`.
145
174
146
175
```java
147
176
package mesh.modifier;
@@ -168,18 +197,27 @@ modifier.modify(mesh);
168
197
169
198
Effortless Shape Creation with Mesh Creators
170
199
171
-
The library provides a variety of Mesh Creators to simplify the construction of various shapes. These creators employ the Factory Method or Builder design pattern, allowing for a flexible and streamlined approach.
200
+
The library provides a variety of Mesh Creators to simplify the construction of
201
+
various shapes. These creators employ the Factory Method or Builder design
202
+
pattern, allowing for a flexible and streamlined approach.
203
+
204
+
While similar to a classic builder, Mesh Creators offer a unique combination of
205
+
features:
172
206
173
-
While similar to a classic builder, Mesh Creators offer a unique combination of features:
207
+
* **Getters and Setters:** Access and modify the creator's internal state using
208
+
getters and setters, providing fine-grained control over the mesh creation
209
+
process.
174
210
175
-
* **Getters and Setters:** Access and modify the creator's internal state using getters and setters, providing fine-grained control over the mesh creation process.
176
211
***Chaining is not supported:**
177
212
178
-
With over 100MeshCreators categorized for easy access, you can quickly and efficiently build a wide range of 3D shapes. For a comprehensive overview, refer to our documentation: [MeshCreators](documentation/documentation.md)
213
+
With over 100MeshCreators categorized for easy access, you can quickly and
214
+
efficiently build a wide range of 3D shapes. For a comprehensive overview,
215
+
refer to our documentation: [MeshCreators](documentation/documentation.md)
179
216
180
217
Core of MeshCreators:TheIMeshCreatorInterface
181
218
182
-
EveryMeshCreator in the library adheres to the IMeshCreator interface. The following code snippet illustrates this foundational interface:
219
+
EveryMeshCreator in the library adheres to the IMeshCreator interface.
220
+
The following code snippet illustrates this foundational interface:
183
221
184
222
```java
185
223
package mesh.creator;
@@ -193,7 +231,9 @@ public interface IMeshCreator {
193
231
}
194
232
```
195
233
196
-
To get a little more specific we can plug the quad example code into a custom creator to illustrate the overall concept.
234
+
To get a little more specific we can plug the quad example code into a custom
235
+
creator to illustrate the overall concept.
236
+
197
237
Let's have a look at our example code again.
198
238
199
239
```java
@@ -209,7 +249,8 @@ mesh.addFace(0, 1, 3);
209
249
mesh.addFace(1, 2, 3);
210
250
```
211
251
212
-
First we move our example code into the factory method of a custom mesh creator class and simply return the mesh.
252
+
First we move our example code into the factory method of a custom mesh
253
+
creator class and simply return the mesh.
213
254
214
255
```java
215
256
import mesh.Mesh3D;
@@ -231,7 +272,8 @@ public class MyQuadCreator implements IMeshCreator {
231
272
}
232
273
```
233
274
234
-
Let's assume we want to generalize the code a bit further. We introduce a parameter for the vertex coordinates named _halfSize_.
275
+
Let's assume we want to generalize the code a bit further. We introduce a
276
+
parameter for the vertex coordinates named _halfSize_.
235
277
236
278
```java
237
279
import mesh.Mesh3D;
@@ -293,7 +335,9 @@ creator.setSize(4);
293
335
mesh = creator.create();
294
336
```
295
337
296
-
This explains the overall concept of mesh creators pretty well. You should now have an idea how to use existing creators and implement your own custom ones.
338
+
This explains the overall concept of mesh creators pretty well. You should now
339
+
have an idea how to use existing creators and implement your own custom ones.
340
+
297
341
See also: [MeshCreators](documentation/documentation.md)
298
342
299
343
## Planed features
@@ -304,5 +348,6 @@ See also: [Mesh Creators](documentation/documentation.md)
304
348
305
349
## Licence
306
350
307
-
[MIT](https://github.com/ArtifactForms/MeshLibCore/blob/master/LICENSE) License Copyright (c) 2022 Simon Dietz
0 commit comments