Skip to content

Commit 145b598

Browse files
Update workspace.md
1 parent e4dba19 commit 145b598

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

documentation/workspace.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,3 +167,68 @@ public class WS_WorkspaceSettings extends PApplet {
167167

168168
}
169169
```
170+
171+
## Let's create something more complex!
172+
173+
To demonstrate the versatile capabilities of our library, let's expand on our simple cube example.
174+
By combining basic shapes and various modifiers, we can quickly create intricate geometries.
175+
176+
**The basic concept:**
177+
We start with a fundamental shape, like a cube. Then, we sequentially apply different modifiers.
178+
These modifiers perform operations such as bevel vertices, drilling holes, subdividing the mesh, or adding thickness.
179+
180+
**A concrete example:**
181+
182+
package workspace.examples;
183+
184+
import mesh.Mesh3D;
185+
import mesh.creator.primitives.CubeCreator;
186+
import mesh.modifier.BevelVerticesModifier;
187+
import mesh.modifier.HolesModifier;
188+
import mesh.modifier.SolidifyModifier;
189+
import mesh.modifier.subdivision.PlanarMidEdgeCenterModifier;
190+
import mesh.modifier.subdivision.PlanarVertexCenterModifier;
191+
import processing.core.PApplet;
192+
import workspace.Workspace;
193+
194+
public class WS_FirstMeshModification extends PApplet {
195+
196+
public static void main(String[] args) {
197+
PApplet.main(WS_FirstMeshModification.class.getName());
198+
}
199+
200+
private Mesh3D mesh;
201+
private Workspace workspace;
202+
203+
@Override
204+
public void settings() {
205+
size(1000, 1000, P3D);
206+
smooth(8);
207+
}
208+
209+
@Override
210+
public void setup() {
211+
workspace = new Workspace(this);
212+
213+
// Start with a simple cube
214+
mesh = new CubeCreator().create();
215+
216+
// Apply various modifiers
217+
mesh.apply(new BevelVerticesModifier(0.2f)); // Bevel edges
218+
mesh.apply(new PlanarMidEdgeCenterModifier()); // Subdivides the mesh
219+
mesh.apply(new PlanarVertexCenterModifier()); // Adds more subdivisions
220+
mesh.apply(new HolesModifier(0.6f)); // Punches holes
221+
mesh.apply(new SolidifyModifier(0.04f)); // Adds thickness
222+
}
223+
224+
@Override
225+
public void draw() {
226+
workspace.draw(mesh);
227+
}
228+
}
229+
230+
**What happens here:**
231+
By combining these modifiers, we transform a simple cube into a more complex shape with rounded edges, holes, and depth. This example showcases the library's flexibility and the ease of creating intricate geometries.
232+
233+
Experiment yourself!
234+
Try different combinations of modifiers and adjust the parameters to create your own unique shapes.

0 commit comments

Comments
 (0)