Skip to content

Commit da4bad4

Browse files
Update modifiers.md
1 parent 8cd50c0 commit da4bad4

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

documentation/modifiers.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,3 +118,37 @@ from a specified center point, creating a variety of effects like bulging, inden
118118

119119
By understanding the basic principles and parameters of the Push-Pull Modifier, you can effectively use it to create a wide range of 3D shapes and effects.
120120

121+
## Translate Modifier
122+
123+
**Purpose:**
124+
125+
The Translate Modifier is a simple yet powerful tool for transforming 3D meshes. It allows you to shift all vertices of a mesh by a specified distance along the X, Y, and Z axes. This is useful for positioning meshes, aligning them with other objects, or creating more complex deformations in combination with other modifiers.
126+
127+
**How it works:**
128+
129+
1. **Translation Vector:** The `deltaX`, `deltaY`, and `deltaZ` parameters define the translation vector, which specifies the amount of shift in each axis.
130+
2. **Vertex Translation:** For each vertex in the mesh, the `deltaX`, `deltaY`, and `deltaZ` values are added to its respective X, Y, and Z coordinates.
131+
132+
**Using the Translate Modifier:**
133+
134+
1. **Create a Mesh:** Start with a basic 3D mesh, such as a plane, cube, or sphere.
135+
2. **Apply the Modifier:** Create an instance of the `TranslateModifier` class, specifying the desired translation values.
136+
3. **Modify the Mesh:** Apply the `modify` method of the `TranslateModifier` to the mesh.
137+
138+
**Example:**
139+
140+
```java
141+
Mesh3D mesh = new CubeCreator().create() // Create a cube mesh
142+
TranslateModifier translateModifier = new TranslateModifier(2, 1, -3); // Create a TranslateModifier with a translation of (2, 1, -3)
143+
mesh.apply(translateModifier); // Apply the modifier to the mesh
144+
```
145+
146+
This will shift the entire cube mesh 2 units along the X-axis, 1 unit along the Y-axis, and -3 units along the Z-axis.
147+
148+
**Additional Considerations:**
149+
150+
* **Combining with Other Modifiers:** The Translate Modifier can be combined with other modifiers like Rotate, Scale, or Bend to create more complex deformations.
151+
* **Order of Application:** The order in which modifiers are applied can affect the final result. Experiment with different sequences to achieve desired effects.
152+
153+
By understanding the basic principles and parameters of the Translate Modifier, you can effectively use it to position and manipulate 3D meshes in your projects.
154+

0 commit comments

Comments
 (0)