-
Notifications
You must be signed in to change notification settings - Fork 294
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
42 additions
and
0 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
Geometric Transformation Algorithm/Shear Transformation/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# README for 2D Shear Transformation | ||
|
||
This project contains a 2D Shear Transformation program in C, which allows users to shear a set of points along both the X-axis and Y-axis based on user-specified shear factors. | ||
|
||
## Process | ||
|
||
### User Input: | ||
1. The user inputs the number of points. | ||
2. They enter the coordinates for each point as **(x, y)**. | ||
3. They specify the shear factors: **shearX** for the X-axis and **shearY** for the Y-axis. | ||
|
||
### Shear Calculation: | ||
The coordinates are transformed using the following equations: | ||
newX = x[i] + shearX * y[i] | ||
newY = y[i] + shearY * x[i] | ||
Each point is updated independently based on the given shear factors. | ||
|
||
### Output: | ||
The program prints the new coordinates after applying the shear transformation. | ||
|
||
## Example Run | ||
|
||
**Input:** | ||
Enter the number of points: 2 | ||
Enter the coordinates of the points (x y): 1 2 3 4 | ||
Enter the shear factors (shearX shearY): 1.0 0.5 | ||
|
||
**Output:** | ||
Sheared Coordinates: (1, 2) -> (3, 2) (3, 4) -> (5, 5) | ||
|
||
## Complexity Analysis | ||
|
||
### Time Complexity: | ||
- **O(n)**, where **n** is the number of points. Each point is processed once. | ||
|
||
### Space Complexity: | ||
- **O(1)**, as the program only uses input arrays and basic variables. | ||
|
||
## Assumptions | ||
- The shear factors are real numbers (floating-point values). | ||
- The program does not validate whether the shear factors result in visually meaningful transformations. | ||
- Input coordinates are assumed to be integers. |