-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 837c6fb
Showing
14 changed files
with
238 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Changelog | ||
All notable changes to eggcellent will be documented in this file. | ||
|
||
## 0.1.0 - 2018-05-30 | ||
### Added | ||
- Egg shapes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
The MIT License (MIT) | ||
===================== | ||
|
||
Copyright (c) `2018` `David Pattinson` | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
the Software without restriction, including without limitation the rights to | ||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies | ||
of the Software, and to permit persons to whom the Software is furnished to do | ||
so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
include CHANGELOG.md | ||
include LICENSE.md | ||
include README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# eggcellent | ||
|
||
Make excellent egg shapes. | ||
|
||
# Install | ||
|
||
It can be installed from command - line using [pip](https: // pypi.python.org / | ||
pypi / pip): | ||
|
||
```bash | ||
pip install eggcellent | ||
``` | ||
|
||
# Usage | ||
|
||
# Use a default egg: | ||
|
||
```python | ||
from eggcellent import egg | ||
import matplotlib.pyplot as plt | ||
plt.scatter([0, 1], [0, 1], marker=None, verts=egg, s=200) | ||
``` | ||
|
||
![example1.png](eggs.png) | ||
|
||
# Make your own egg | ||
|
||
```python | ||
from eggcellent import make_egg | ||
egg = make_egg(a=2, b=3) | ||
``` | ||
|
||
The egg equation is: | ||
|
||
r = cos(2θ) + a \* cos(θ) + b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from __future__ import absolute_import as _ | ||
from .eggcellent import egg, make_egg | ||
|
||
__version__ = "0.1.0" | ||
|
||
__all__ = ["__version__", "egg", "make_egg"] |
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
# This Python file uses the following encoding: utf-8 | ||
|
||
import numpy as np | ||
|
||
|
||
def make_egg(a=-1.25, b=7): | ||
""" | ||
Return x, y points that resemble an egg. | ||
Egg equation is: | ||
r = cos(2θ) + a * cos(θ) + b | ||
@param a: Number. | ||
@param b: Number. | ||
""" | ||
theta = np.linspace(0, 2 * np.pi, 100) | ||
r = np.cos(2 * theta) + a * np.cos(theta) + b | ||
y = r * np.cos(theta) | ||
x = r * np.sin(theta) | ||
|
||
return np.array([x, y]).T.tolist() | ||
|
||
|
||
egg = [ | ||
[0.0, 6.75], | ||
[0.4277608164642811, 6.73089266415124], | ||
[0.8517146840713594, 6.673877124366278], | ||
[1.2681644622827606, 6.579862037750845], | ||
[1.673628462355278, 6.450326418856591], | ||
[2.0649379174061835, 6.287267926885777], | ||
[2.4393225772930682, 6.093133230305819], | ||
[2.7944811725590384, 5.870733087976546], | ||
[3.128634060526104, 5.623145368678695], | ||
[3.440556037305276, 5.353609693971038], | ||
[3.7295880473099507, 5.065417715244057], | ||
[3.9956273192220944, 4.761803212350504], | ||
[4.2390962748214776, 4.4458362214255445], | ||
[4.460891364414305, 4.1203252623425906], | ||
[4.662313749875888, 3.7877314463472014], | ||
[4.84498445505123, 3.4500978120501267], | ||
[5.01074720739185, 3.108996678670835], | ||
[5.1615626816104605, 2.7654971394248973], | ||
[5.299398207412243, 2.420154069422703], | ||
[5.426117205536807, 2.0730192186589242], | ||
[5.543372661361945, 1.7236741309843135], | ||
[5.652508830846259, 1.371283804757389], | ||
[5.7544751031085895, 1.0146692204931707], | ||
[5.84975552664923, 0.6523961344022516], | ||
[5.9383169566839715, 0.28287690114960184], | ||
[6.019578118724977, -0.09551843185969822], | ||
[6.092401132009199, -0.48434590324845395], | ||
[6.155106222574697, -0.8849706720396351], | ||
[6.205509509000028, -1.2984537698082879], | ||
[6.240982894631946, -1.725446950350867], | ||
[6.258534279305424, -2.1660997742508297], | ||
[6.2549055409614045, -2.619982671373978], | ||
[6.226685061045248, -3.0860291914509106], | ||
[6.170431001964125, -3.562500000000001], | ||
[6.082801111121583, -4.0469704268062685], | ||
[5.960684540380536, -4.536342553468193], | ||
[5.801331043206061, -5.026881964253244], | ||
[5.602472949499837, -5.514278411348121], | ||
[5.362435519669346, -5.993728792720692], | ||
[5.080231638313405, -6.460040038763355], | ||
[4.755637311935474, -6.907748781463952], | ||
[4.389245066973384, -7.331254063083384], | ||
[3.9824930822000946, -7.724958852530566], | ||
[3.5376687074112807, -8.083415794622441], | ||
[3.0578858895631544, -8.401472432843674], | ||
[2.5470369175561696, -8.67441112710086], | ||
[2.0097197762785504, -8.898079035441084], | ||
[1.4511432382520335, -9.06900383798851], | ||
[0.8770125876231565, -9.184491341894576], | ||
[0.2933995391748839, -9.242701701955358], | ||
[-0.2933995391748857, -9.242701701955358], | ||
[-0.8770125876231583, -9.184491341894576], | ||
[-1.4511432382520355, -9.06900383798851], | ||
[-2.0097197762785486, -8.898079035441084], | ||
[-2.547036917556172, -8.67441112710086], | ||
[-3.0578858895631527, -8.401472432843676], | ||
[-3.5376687074112825, -8.08341579462244], | ||
[-3.9824930822000932, -7.724958852530569], | ||
[-4.389245066973384, -7.331254063083382], | ||
[-4.755637311935472, -6.907748781463953], | ||
[-5.080231638313407, -6.460040038763354], | ||
[-5.362435519669347, -5.993728792720694], | ||
[-5.602472949499836, -5.514278411348119], | ||
[-5.80133104320606, -5.026881964253246], | ||
[-5.960684540380536, -4.5363425534681925], | ||
[-6.082801111121583, -4.04697042680627], | ||
[-6.1704310019641255, -3.5624999999999973], | ||
[-6.226685061045249, -3.0860291914509097], | ||
[-6.2549055409614045, -2.619982671373978], | ||
[-6.258534279305424, -2.1660997742508314], | ||
[-6.240982894631946, -1.7254469503508643], | ||
[-6.205509509000028, -1.2984537698082868], | ||
[-6.155106222574697, -0.8849706720396352], | ||
[-6.092401132009198, -0.48434590324845533], | ||
[-6.019578118724976, -0.09551843185969568], | ||
[-5.9383169566839715, 0.28287690114960307], | ||
[-5.84975552664923, 0.6523961344022503], | ||
[-5.754475103108591, 1.0146692204931682], | ||
[-5.652508830846259, 1.3712838047573903], | ||
[-5.543372661361945, 1.7236741309843135], | ||
[-5.426117205536807, 2.073019218658923], | ||
[-5.299398207412242, 2.420154069422705], | ||
[-5.16156268161046, 2.7654971394248986], | ||
[-5.01074720739185, 3.1089966786708345], | ||
[-4.844984455051231, 3.450097812050125], | ||
[-4.662313749875887, 3.7877314463472027], | ||
[-4.460891364414304, 4.120325262342591], | ||
[-4.2390962748214776, 4.4458362214255445], | ||
[-3.995627319222096, 4.761803212350503], | ||
[-3.729588047309949, 5.065417715244059], | ||
[-3.4405560373052757, 5.353609693971038], | ||
[-3.128634060526104, 5.623145368678693], | ||
[-2.79448117255904, 5.870733087976545], | ||
[-2.439322577293066, 6.09313323030582], | ||
[-2.0649379174061835, 6.287267926885778], | ||
[-1.6736284623552786, 6.450326418856591], | ||
[-1.2681644622827573, 6.579862037750846], | ||
[-0.851714684071358, 6.673877124366278], | ||
[-0.4277608164642812, 6.73089266415124], | ||
[-1.6532731788489269e-15, 6.75] | ||
] | ||
|
||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env python | ||
|
||
from eggcellent import egg | ||
import matplotlib.pyplot as plt | ||
|
||
plt.scatter([0, 1], [0, 1], marker=None, verts=egg, s=200) | ||
plt.savefig('eggs.png') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
[metadata] | ||
author = David Pattinson | ||
author_email = [email protected] | ||
classifiers = | ||
Development Status :: 4 - Beta | ||
Environment :: Console | ||
Programming Language :: Python | ||
description = Egg shapes. | ||
download_url = https://github.com/organisation/eggcellent/releases/latest | ||
keywords = keyword0, keyword1, keyword2 | ||
license = MIT | ||
long_description = file: README.md | ||
long_description_content_type = text/markdown | ||
maintainer = David Pattinson | ||
maintainer_email = [email protected] | ||
name = eggcellent | ||
platforms = | ||
Linux | ||
MacOS | ||
Windows | ||
url = https://github.com/organisation/eggcellent | ||
version = attr: eggcellent.__version__ | ||
|
||
[options] | ||
zip_safe = True | ||
include_package_data = True | ||
packages = find: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from setuptools import setup | ||
|
||
if __name__ == '__main__': | ||
setup() |