https://github.com/nemuelw/geometry
Go package to perform operations on 2D & 3D shapes
https://github.com/nemuelw/geometry
2d 2d-geometry 3d 3d-geometry area circle cube cuboid cylinder geometry golang golang-package math perimeter sphere square triangle volume
Last synced: 9 months ago
JSON representation
Go package to perform operations on 2D & 3D shapes
- Host: GitHub
- URL: https://github.com/nemuelw/geometry
- Owner: nemuelw
- License: mit
- Created: 2023-09-15T16:04:34.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-09-25T04:29:56.000Z (over 2 years ago)
- Last Synced: 2024-08-05T21:34:10.558Z (almost 2 years ago)
- Topics: 2d, 2d-geometry, 3d, 3d-geometry, area, circle, cube, cuboid, cylinder, geometry, golang, golang-package, math, perimeter, sphere, square, triangle, volume
- Language: Go
- Homepage:
- Size: 14.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# geometry
Go Package to perform operations on 2D and 3D geometric figures
## Installation
Run this command in your project directory:
```
go get github.com/nemzyxt/geometry
```
## Testing
```
go test ./tests/...
```
## Example
```
package main
import (
"fmt"
"github.com/nemzyxt/geometry/2d" // planar : 2d shapes
"github.com/nemzyxt/geometry/3d" // spatial: 3d shapes
)
func main() {
r := planar.NewRectangle(5, 4)
c := spatial.NewCube(4)
fmt.Println(r.Area()) // 20
fmt.Println(r.Perimeter()) // 18
fmt.Println(c.Volume()) // 64
}
```
## 2D Shapes (area, perimeter)
- Circle
- Square
- Rectangle
- Triangle
## 3D Shapes (volume)
- Cube
- Cuboid
- Cylinder
- Sphere