Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Readme contribution #66

Closed
wants to merge 30 commits into from
Closed
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
e3c0d63
regular polygons
joanita-51 Oct 9, 2023
e0dea2a
The square polygon
joanita-51 Oct 9, 2023
1c2044a
The pentagon polygon
joanita-51 Oct 9, 2023
49f3dd5
The hexagon polygon
joanita-51 Oct 9, 2023
d123473
pentagon points
joanita-51 Oct 14, 2023
daa9ed7
Adding points
joanita-51 Oct 14, 2023
7339e3b
adding points
joanita-51 Oct 14, 2023
cd85dd5
same file
joanita-51 Oct 14, 2023
8002e25
adding the programs
joanita-51 Oct 14, 2023
e4b3f3f
Merge remote-tracking branch 'origin/main' into regular-polygons
joanita-51 Oct 18, 2023
a46703a
Format the source code
joanita-51 Oct 18, 2023
a1cce27
non-exhaustive pattern
joanita-51 Oct 20, 2023
a76b19d
resolving merge conflicts
joanita-51 Oct 20, 2023
95abe11
Automatic formatting
joanita-51 Oct 20, 2023
042d8eb
Adding the rotate transformation for lines
joanita-51 Oct 24, 2023
d216a03
resolving merge conflicts
joanita-51 Oct 24, 2023
d87930e
Added information to the readMe file
joanita-51 Oct 24, 2023
77eb225
Adding the table of contents to the file
joanita-51 Oct 24, 2023
a3a987b
Editing the title
joanita-51 Oct 24, 2023
351b160
Update README.md
joanita-51 Oct 26, 2023
c4902ea
Removing some shapes
joanita-51 Oct 26, 2023
e941317
short description
joanita-51 Oct 26, 2023
b443e81
Merge branch 'Sudha247:main' into readme-contribution
joanita-51 Oct 27, 2023
3a0975c
Create a dedicated CONTRIBUTING.md file for contribution and installa…
joanita-51 Oct 27, 2023
d74fdb4
Merge remote-tracking branch 'origin/main' into readme-contribution
joanita-51 Oct 27, 2023
297180c
Merge remote-tracking branch 'origin/readme-contribution' into readme…
joanita-51 Oct 27, 2023
7986211
modifying the readme
joanita-51 Oct 27, 2023
73c5e62
modifying the readme
joanita-51 Oct 27, 2023
c6d77de
resolved a merge conflict
joanita-51 Oct 27, 2023
f781c84
Add 'Getting Help' section to the documentation
joanita-51 Oct 27, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
131 changes: 130 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,134 @@
# Joy in OCaml

More information coming soon.
## Table of Contents
- [Project Overview](#project-overview)
- [Project Benefits](#project-benefits)
- [Installation](#installation)
- [Getting Help](#getting-help)
- [Other wonderful Shapes](#other-wonderful-shapes)
- [Contribution](#contribution)
- [Acknowlegments](#acknowlegments)

## Project Overview
This library is like a toolbox for creating cool shapes and patterns using OCaml. It takes inspiration from [joy](https://github.com/fossunited/joy). Whether you're an artist or a coder, you can use it to make interesting art with code.

## Project Benefits

Here's how this project can make your life easier and more creative:

1. **Get Creative with Geometry:** This project simplifies geometric creative coding in OCaml, helping you explore the exciting world where programming meets art.

2. **User-Friendly Tools:** We provide an easy-to-use API, so whether you're a newbie or a pro, you can dive into creative coding without confusion.

3. **Basic Shapes at Your Fingertips:** Use simple shapes as your creative building blocks, making it a breeze to start your artistic coding journey.

4. **Mix and Match with Ease:** Combine, transform, and build complex shapes effortlessly.


## Installation
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is quite useful, especially considering this library is aimed to be easy to use for non-OCaml programmers. However, I'd prefer the Installation instructions and the contribution section moved to a separate file, HACKING.md or CONTRIBUTING.md. The new file can be referenced in the README.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @Sudha247! I'll start working on the changes right away.


Follow these simple steps to begin working with ocaml-joy :

### 1. Install OCaml

Start by installing OCaml by following the official installation tutorial at [https://ocaml.org/docs/installing-ocaml](https://ocaml.org/docs/installing-ocaml).

### 2. Install Opam

After successfully installing OCaml, proceed to install Opam, the OCaml package manager. It provides a convenient way to install, manage, and share OCaml libraries and tools.

For Windows, Opam can be installed on Windows using Windows Subsystem for Linux (WSL) or other virtualization methods, as OCaml development is primarily done on Unix-like systems. You can set up WSL and then follow the Linux installation instructions.

For Linux, If you're using Debian or Ubuntu, you can install Opam via the system package manager. Open a terminal and run the following commands:

`sudo apt update
sudo apt install opam
`

### 3. Update Opam
Once Opam is installed, make sure to update and upgrade it to the latest version of packages by running the following commands:

`opam update && opam upgrade`

### 4. Install dune
Dune is a build system we are using for our OCaml project. It is to help us to simplify and automate the build process. Run the following command for it to be installed.

`opam install dune`

### 5. Installing Graphics Library:
To install the necessary Graphics library, execute the following command inside the directory where your OCaml code is located:

`opam install graphics`

The Graphics library is a simple graphics module in OCaml that provides functions for creating graphical windows, drawing shapes, and handling user input events.

### 6. Building and Running Examples:
To build and execute examples, navigate to the directory where your OCaml code is located (e.g., ocaml-joy)

`cd ocaml-joy # Change to your project directory`

Then, build the examples using Dune

`dune build examples/`

Run your preferred file for example to display the file in the examples directory named circle.ml we use the command

`dune exec -- examples/circle.exe`

To verify the success of this installation, you will see the following output:

![circle Image](https://github.com/joanita-51/ocaml-joy/assets/82649346/87bf01ad-836f-4491-97c2-8724b8047429)

## Getting Help
At any point, please don't hesitate to ask questions. You can contact the mentors either here in the issue tracker or in the #outreachy channel in [OCaml discord](https://discord.com/invite/cCYQbqN).

## Shape Examples

These shapes have been crafted with the aid of this library.

![axes image](https://github.com/joanita-51/ocaml-joy/assets/82649346/0b8b402e-65ee-45a8-b568-cf0434a10f5e)
![circle graph image](https://github.com/joanita-51/ocaml-joy/assets/82649346/1ac34bd9-553b-45e2-90cf-240c73b63256)
![rectangle image](https://github.com/joanita-51/ocaml-joy/assets/82649346/c00e5df4-83bd-4cf7-a864-6f26da0d1fac)
![circle grid image](https://github.com/joanita-51/ocaml-joy/assets/82649346/20176f2d-cf96-4ec1-93ed-e5eaf1682600)
![star image](https://github.com/joanita-51/ocaml-joy/assets/82649346/5a8cd0ea-f00b-46b0-b34d-406d76561a2d)
![high order transformation image](https://github.com/joanita-51/ocaml-joy/assets/82649346/eeb2d2fc-86c5-4159-b559-4e280232798f)
<!-- ![star image](https://github.com/joanita-51/ocaml-joy/assets/82649346/5a8cd0ea-f00b-46b0-b34d-406d76561a2d)
![circle rectangle image](https://github.com/joanita-51/ocaml-joy/assets/82649346/d53af149-83e3-40ac-b34d-d83c69eede3b)
![circle row joy image](https://github.com/joanita-51/ocaml-joy/assets/82649346/6a67187a-ef85-4549-9920-a674740731a7)
![triangle image](https://github.com/joanita-51/ocaml-joy/assets/82649346/de6f1384-94cd-4d78-8380-74d0c38b9331)
![concentric circles image](https://github.com/joanita-51/ocaml-joy/assets/82649346/8085d796-4672-413f-904e-01d843e076a1)
![Line image](https://github.com/joanita-51/ocaml-joy/assets/82649346/3b53a1b1-4192-4039-a78d-452116cf683b)
![translate circle image](https://github.com/joanita-51/ocaml-joy/assets/82649346/f4b570ef-cc66-46a8-9360-8796e1fb7361)
![translate rectangle image](https://github.com/joanita-51/ocaml-joy/assets/82649346/aedfaeb4-4ddc-4d82-a77f-a2dfdd071b3d)
![polygon image](https://github.com/joanita-51/ocaml-joy/assets/82649346/1201e352-ef3f-433c-82cc-c834b3d52daf)
![high order transformation image](https://github.com/joanita-51/ocaml-joy/assets/82649346/eeb2d2fc-86c5-4159-b559-4e280232798f)
![translate eclipse image](https://github.com/joanita-51/ocaml-joy/assets/82649346/70026da8-92a3-4c3f-a90a-6827b87e1b8a)
![circle grid image](https://github.com/joanita-51/ocaml-joy/assets/82649346/2d24f4a5-2d06-4091-806a-1c7b412a3ef7) -->


## Contribution

We warmly welcome contributions from the community. If you'd like to contribute to Ocaml-Joy after setting it up on your machine, follow these steps to get started:

1. **Select a Good-First Issue:** Begin your contribution journey by checking our issue tracker for issues tagged as 'good-first-issue.' These are typically beginner-friendly tasks designed to help new contributors get acquainted with the project.

2. **Fork the Repository:** Once you've chosen an issue to work on, fork the Ocaml-Joy repository to create your own copy.

3. **Create a Branch:** Before making any changes, create a new branch for your work. This helps keep your changes isolated and organized.

4. **Make Your Changes:** Dive into the code and make the necessary modifications to address the chosen issue. Ensure that you follow our coding guidelines and best practices.

5. **Test Your Changes:** After implementing your modifications, thoroughly test your code to ensure it functions as expected and doesn't introduce new issues.

6. **Submit a Pull Request:** When you're confident that your changes are ready, submit a pull request (PR) to the main repository. Provide a clear description of your changes and reference the issue you've resolved.

7. **Engage in Discussion:** Engage in discussions and reviews on your PR. Our team and the community will provide feedback and guidance to ensure your contribution aligns with the project's goals.

8. **Get Your Contribution Merged:** Once your PR is approved and passes all checks, it will be merged into the main project. Congratulations on your successful contribution!

By following these steps, you'll be actively contributing to Ocaml-Joy and helping improve the project. We appreciate your consideration of joining our community!


## Acknowlegments

*This library is inspired by [joy](https://github.com/fossunited/joy). Thanks to the creators!*
3 changes: 2 additions & 1 deletion lib/shape.ml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ let rotate degrees shape =
}
| Ellipse ellipse ->
Ellipse { c = rot ellipse.c degrees; rx = ellipse.rx; ry = ellipse.ry }
| Line _line -> failwith "Not Implemented"
| Line line ->
Line { a= rot line.a degrees; b = rot line.b degrees }


let compose f g x = g (f x)
Expand Down
4 changes: 3 additions & 1 deletion test/test_scale_shape.ml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@ let run () =
let e1 = ellipse 30 50 |> translate 500 500 in
let e2 = scale 2. e1 in
let e3 = scale 0.7 e1 in
show [ c1; c2; c3; r1; r2; r3; e1; e2; e3 ];
let line1 = line 100 100 in
let rotatedLine = rotate 45 line1 in
show [ c1; c2; c3; r1; r2; r3; e1; e2; e3; rotatedLine ];
close ()
Loading