0% found this document useful (0 votes)
3 views

numerical programming - - ap3

Uploaded by

nani chkhenkeli
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

numerical programming - - ap3

Uploaded by

nani chkhenkeli
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

AP—4

I fulfilled the task with two approaches.


(lagrange.py)

Another case is by using Bizear curve that is more detailed. (bizear.py)

The PieceOutLine class's methods use Bezier curves to create intricate shapes, depending on
whether they are for the right, left, top, or bottom portions of a piece. The PieceInfo class
arranges the pieces in a grid and determines their types. Then, the polygonCropImage
function is used to crop out the piece shapes from an image.
The result is a set of interconnected pieces that could be used in a puzzle, board game, or
similar application where custom-shaped pieces need to fit together based on their borders.

- code uses cubic Bezier curves to generate smooth curves between points. This is done through
the computeBezierPoint and computerBezier functions, where computeBezierPoint computes
a specific point on the curve, and computerBezier computes the entire curve by iterating
through a range of t values.
- The PieceOutLine class is responsible for generating the outline of a single piece. The outline
consists of a series of points that describe the boundary of the piece, which is created using
combinations of arc segments and connections.
- The PieceInfo class is used to manage the grid of pieces. Given a size, number of rows, and
columns, it calculates the boundaries and type of each individual piece.
- The polygonCropImage function crops an image by creating a mask from a polygon
(presumably the shape of the piece) and using that mask to cut out the corresponding part of
the image.
- PieceOutLine generates the specific shape for each piece, based on parameters like width,
height, arc ratio, and connection ratio.
PieceInfo provides grid-level information about how pieces should be arranged, such as
determining whether a piece is male or female and managing connections between pieces.

Implementation for: python bizear.py D:/numerical-Python/AP4/photo.png 4 4

You might also like