Skip to content

Commit 594c2b5

Browse files
Update modifiers.md
1 parent f8fbb9a commit 594c2b5

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
@@ -231,3 +231,37 @@ This will shift the entire cube mesh 2 units along the X-axis, 1 unit along the
231231

232232
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.
233233

234+
## RotateXModifier
235+
236+
**Purpose:**
237+
238+
The `RotateXModifier` is a mesh modification tool designed to rotate a 3D mesh around the X-axis by a specified angle. This is useful for various transformations and manipulations, such as aligning objects, creating rotations, or simulating object movement.
239+
240+
**How it Works:**
241+
242+
1. **Rotation Angle:** The `angle` parameter defines the angle of rotation in radians.
243+
2. **Rotation Matrix:** A 3x3 rotation matrix is created using the specified angle.
244+
3. **Vertex Rotation:** Each vertex of the mesh is multiplied by the rotation matrix to apply the rotation.
245+
246+
**Using the RotateXModifier:**
247+
248+
1. **Create a Mesh:** Start with a basic 3D mesh, such as a plane, cube, or sphere.
249+
2. **Create a Rotator:** Instantiate a `RotateXModifier` object, specifying the desired rotation angle in radians.
250+
3. **Apply the Modifier:** Apply the `modify` method of the `RotateXModifier` to the mesh.
251+
252+
**Example:**
253+
254+
```java
255+
Mesh3D mesh = new CubeCreator().create(); // Create a cube mesh
256+
RotateXModifier rotator = new RotateXModifier(Mathf.QUATER_PI); // Rotate 45 degrees
257+
mesh.apply(rotator); // Apply the modifier to the mesh
258+
```
259+
260+
This will rotate the cube 45 degrees around the X-axis.
261+
262+
**Additional Considerations:**
263+
264+
* **Combining with Other Modifiers:** The RotateXModifier can be combined with other modifiers like Translate, Scale, or Bend to create more complex deformations.
265+
* **Order of Application:** The order in which modifiers are applied can affect the final result. Experiment with different sequences to achieve desired effects.
266+
267+
By understanding the basic principles and parameters of the RotateXModifier, you can effectively use it to rotate 3D meshes around the X-axis in your projects.

0 commit comments

Comments
 (0)