update lab1

This commit is contained in:
2026-01-27 10:06:30 -05:00
parent 4316bc80a9
commit ba73476389
6 changed files with 9 additions and 3 deletions

3
.gitignore vendored
View File

@@ -21,3 +21,6 @@ venv/
# OS generated files # OS generated files
.DS_Store .DS_Store
Thumbs.db Thumbs.db
# Other files
controlpts.txt

View File

@@ -10,6 +10,8 @@ I use `uv` to create a virtual environment for this project. You can synchronize
uv sync uv sync
``` ```
`uv` is not the only option, you can run this program in any Python environment with the required dependencies installed. The main dependencies are listed in `pyproject.toml`.
## Run the Code ## Run the Code
To run the interactive Bezier curve editor, execute the following command in your terminal: To run the interactive Bezier curve editor, execute the following command in your terminal:
@@ -25,6 +27,7 @@ For example, to create a new Bezier curve with 5 control points, run:
```bash ```bash
uv run ibezier.py 5 uv run ibezier.py 5
``` ```
To load control points from a file named `control_points.txt`, run: To load control points from a file named `control_points.txt`, run:
```bash ```bash
@@ -33,4 +36,4 @@ uv run ibezier.py control_points.txt
## Statement of AI Usage ## Statement of AI Usage
I use Github Copilot's Auto Completion feature to help me write code and README faster. I ask Gemini to help me to debug GUI issues. I use `Github Copilot`'s Auto Completion feature to help me complete code lines and README faster. I ask `Gemini` to help me to debug GUI issues.

BIN
lab1/bezier_circle.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 KiB

BIN
lab1/bezier_figure8.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 KiB

View File

@@ -21,7 +21,7 @@ def ibezier(inputA):
global num_sample global num_sample
global curve_degree, is_subdivided # add for bezier global curve_degree, is_subdivided # add for bezier
# Compute a point on the Bezier curve at parameter t using de Casteljau's algorithm. # de Casteljau's algorithm.
# points: list of tuples/lists [(x0,y0), (x1,y1), ...] # points: list of tuples/lists [(x0,y0), (x1,y1), ...]
# Returns: (x, y) coordinates on the curve # Returns: (x, y) coordinates on the curve
def deCasteljau(points, t): def deCasteljau(points, t):