iShape

main

iShape is a compact and efficient library specifically designed for representing 2D data structures using FixVec
iShape-Swift/iShape

iShape

iShape is a compact and efficient library specifically designed for representing 2D data structures using FixVec.

Data

  • `FixPath` - A sequence of points defining a path.
  • `FixPaths` - A list of paths.
  • `FixShape` - A polygon that can include holes.
  • `FixShapes` - A collection of shapes.

Installation

Installing iShape is simple and easy using Swift Package Manager. Just follow these steps:

  • Open your Xcode project.
  • Select your project and open tab Package Dependencies.
  • Click on the "+" button.
  • In search bar enter https://github.com/iShape-Swift/iShape
  • Click the "Add" button.
  • Wait for the package to be imported.
  • In your Swift code, add the following using statement to access the library:
import iFixFloat
import iShape

Usage

Here's an example of how you can create a square with a hole using iShape:

// Square with a hole
let shape = FixShape(
    contour: [
        FixVec(-FixFloat.unit * 4, -FixFloat.unit * 4),
        FixVec(-FixFloat.unit * 4,  FixFloat.unit * 4),
        FixVec( FixFloat.unit * 4,  FixFloat.unit * 4),
        FixVec( FixFloat.unit * 4, -FixFloat.unit * 4)
    ], holes: [
        FixVec(-FixFloat.unit * 2, -FixFloat.unit * 2),
        FixVec(-FixFloat.unit * 2,  FixFloat.unit * 2),
        FixVec( FixFloat.unit * 2,  FixFloat.unit * 2),
        FixVec( FixFloat.unit * 2, -FixFloat.unit * 2)
    ]
)

Contributing

Feel free to contribute to iShape by submitting issues, providing feedback, or making pull requests.

Licenseå

This project is licensed under the MIT License. See the LICENSE file for more details.

Description

  • Swift Tools 5.7.0
View More Packages from this Author

Dependencies

Last updated: Wed May 01 2024 10:02:04 GMT-0900 (Hawaii-Aleutian Daylight Time)