mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-09-19 16:46:11 -04:00
0.1.3 ellipse
This commit is contained in:
parent
f612c4451e
commit
a5482778d7
@ -2,8 +2,11 @@
|
||||
[![Arduino CI](https://github.com/RobTillaart/DS1821/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci)
|
||||
[![Arduino-lint](https://github.com/RobTillaart/DS1821/actions/workflows/arduino-lint.yml/badge.svg)](https://github.com/RobTillaart/DS1821/actions/workflows/arduino-lint.yml)
|
||||
[![JSON check](https://github.com/RobTillaart/DS1821/actions/workflows/jsoncheck.yml/badge.svg)](https://github.com/RobTillaart/DS1821/actions/workflows/jsoncheck.yml)
|
||||
[![GitHub issues](https://img.shields.io/github/issues/RobTillaart/DS1821.svg)](https://github.com/RobTillaart/DS1821/issues)
|
||||
|
||||
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/RobTillaart/DS1821/blob/master/LICENSE)
|
||||
[![GitHub release](https://img.shields.io/github/release/RobTillaart/DS1821.svg?maxAge=3600)](https://github.com/RobTillaart/DS1821/releases)
|
||||
[![PlatformIO Registry](https://badges.registry.platformio.org/packages/robtillaart/library/DS1821.svg)](https://registry.platformio.org/libraries/robtillaart/DS1821)
|
||||
|
||||
|
||||
# DS1821
|
||||
|
@ -6,6 +6,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
|
||||
## [0.1.2] - 2023-10-25
|
||||
- update readme.md
|
||||
- update keywords.txt
|
||||
|
||||
|
||||
## [0.1.2] - 2022-11-02
|
||||
- add changelog.md
|
||||
- add rp2040 to build-CI
|
||||
@ -13,7 +18,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
- refactor code
|
||||
- add getLongRadius() and getShortRadius()
|
||||
|
||||
|
||||
## [0.1.1] - 2022-07-24
|
||||
- add angle() + example
|
||||
- add isCircle(), isFlat()
|
||||
|
@ -2,8 +2,11 @@
|
||||
[![Arduino CI](https://github.com/RobTillaart/ellipse/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci)
|
||||
[![Arduino-lint](https://github.com/RobTillaart/ellipse/actions/workflows/arduino-lint.yml/badge.svg)](https://github.com/RobTillaart/ellipse/actions/workflows/arduino-lint.yml)
|
||||
[![JSON check](https://github.com/RobTillaart/ellipse/actions/workflows/jsoncheck.yml/badge.svg)](https://github.com/RobTillaart/ellipse/actions/workflows/jsoncheck.yml)
|
||||
[![GitHub issues](https://img.shields.io/github/issues/RobTillaart/ellipse.svg)](https://github.com/RobTillaart/ellipse/issues)
|
||||
|
||||
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/RobTillaart/ellipse/blob/master/LICENSE)
|
||||
[![GitHub release](https://img.shields.io/github/release/RobTillaart/ellipse.svg?maxAge=3600)](https://github.com/RobTillaart/ellipse/releases)
|
||||
[![PlatformIO Registry](https://badges.registry.platformio.org/packages/robtillaart/library/ellipse.svg)](https://registry.platformio.org/libraries/robtillaart/ellipse)
|
||||
|
||||
|
||||
# ellipse
|
||||
@ -22,6 +25,10 @@ Trigger was a video of Dr. Matt Parker.
|
||||
|
||||
## Interface
|
||||
|
||||
```cpp
|
||||
#include "ellipse.h"
|
||||
```
|
||||
|
||||
- **ellipse(float a, float b)** constructor, a >= b
|
||||
- **float area()** returns the area of the ellipse.
|
||||
- **float circumference()** good algorithm (= Ramanujan 1).
|
||||
@ -36,6 +43,8 @@ This is an indication of flatness of the ellipse. 0 is a circle 1 is flat line.
|
||||
|
||||
#### Perimeter algorithms
|
||||
|
||||
Perimeter == circumference
|
||||
|
||||
- **float perimeter_ref()** slower but best known algorithm (Ramanujan 2)
|
||||
- **float perimeter_Keppler()** good and fast algorithm for eccentricity between 1 and 2.
|
||||
- **float perimeter_Ramanujan1()** good algorithm.
|
||||
@ -44,7 +53,7 @@ This is an indication of flatness of the ellipse. 0 is a circle 1 is flat line.
|
||||
See performance example for differences in timing.
|
||||
|
||||
|
||||
#### Misc
|
||||
#### Convenience functions
|
||||
|
||||
- **bool isCircle(float epsilon = 0.0)** | a - b | < eps.
|
||||
- **bool isFlat()** true if a > 4b, where a = longest radius.
|
||||
@ -63,10 +72,30 @@ See examples.
|
||||
|
||||
## Future
|
||||
|
||||
- make constructor symmetric (a < b or a > b ==> all possible.
|
||||
- make other code symmetric.
|
||||
- additional functions
|
||||
- Bresenham to draw ellipse?
|
||||
- documentation
|
||||
#### Must
|
||||
|
||||
- improve documentation
|
||||
- refer Wikipedia.
|
||||
|
||||
#### Should
|
||||
|
||||
- make constructor symmetric (a < b or a > b ==> all possible.
|
||||
- make other code symmetric.
|
||||
|
||||
#### Could
|
||||
|
||||
- replace float by double?
|
||||
- additional functions
|
||||
- Bresenham to draw ellipse?
|
||||
|
||||
#### Wont
|
||||
|
||||
|
||||
## Support
|
||||
|
||||
If you appreciate my libraries, you can support the development and maintenance.
|
||||
Improve the quality of the libraries by providing issues and Pull Requests, or
|
||||
donate through PayPal or GitHub sponsors.
|
||||
|
||||
Thank you,
|
||||
|
||||
|
@ -2,12 +2,10 @@
|
||||
// FILE: ellipse.cpp
|
||||
// AUTHOR: Rob Tillaart
|
||||
// DATE: 2021-10-31
|
||||
// VERSION: 0.1.2
|
||||
// VERSION: 0.1.3
|
||||
// PURPOSE: Arduino library for ellipse maths
|
||||
// URL: https://github.com/RobTillaart/ellipse
|
||||
// TRIGGER: https://www.youtube.com/watch?v=5nW3nJhBHL0
|
||||
//
|
||||
// HISTORY: see changelog.md
|
||||
|
||||
|
||||
#include "ellipse.h"
|
||||
@ -153,5 +151,5 @@ float ellipse::angle()
|
||||
}
|
||||
|
||||
|
||||
// -- END OF FILE --
|
||||
// -- END OF FILE --
|
||||
|
||||
|
@ -3,15 +3,14 @@
|
||||
// FILE: ellipse.h
|
||||
// AUTHOR: Rob Tillaart
|
||||
// DATE: 2021-10-31
|
||||
// VERSION: 0.1.2
|
||||
// VERSION: 0.1.3
|
||||
// PURPOSE: Arduino library for ellipse maths
|
||||
// URL: https://github.com/RobTillaart/ellipse
|
||||
//
|
||||
|
||||
|
||||
#include "Arduino.h"
|
||||
|
||||
#define ELLIPSE_LIB_VERSION (F("0.1.2"))
|
||||
#define ELLIPSE_LIB_VERSION (F("0.1.3"))
|
||||
|
||||
|
||||
class ellipse
|
||||
@ -20,6 +19,7 @@ public:
|
||||
ellipse(float a, float b); // a >= b
|
||||
float area();
|
||||
float circumference(); // good algorithm,
|
||||
|
||||
float perimeter_ref(); // pretty slow but very good over long range
|
||||
float perimeter_Keppler();
|
||||
float perimeter_Ramanujan1();
|
||||
@ -51,6 +51,6 @@ private:
|
||||
};
|
||||
|
||||
|
||||
// -- END OF FILE --
|
||||
// -- END OF FILE --
|
||||
|
||||
|
||||
|
@ -5,25 +5,31 @@ ellipse KEYWORD1
|
||||
|
||||
|
||||
# Methods and Functions (KEYWORD2)
|
||||
perimeter KEYWORD2
|
||||
area KEYWORD2
|
||||
circumference KEYWORD2
|
||||
perimeter_ref KEYWORD2
|
||||
eccentricity KEYWORD2
|
||||
|
||||
perimeter_ref KEYWORD2
|
||||
perimeter_Keppler KEYWORD2
|
||||
perimeter_Ramanujan1 KEYWORD2
|
||||
perimeter_Ramanujan2 KEYWORD2
|
||||
|
||||
eccentricity KEYWORD2
|
||||
|
||||
isCircle KEYWORD2
|
||||
isFlat KEYWORD2
|
||||
|
||||
setA KEYWORD2
|
||||
setB KEYWORD2
|
||||
getA KEYWORD2
|
||||
getB KEYWORD2
|
||||
getC KEYWORD2
|
||||
|
||||
getLongRadius KEYWORD2
|
||||
getShortRadius KEYWORD2
|
||||
|
||||
angle KEYWORD2
|
||||
|
||||
|
||||
# Constants (LITERAL1)
|
||||
FLE_LIB_VERSION LITERAL1
|
||||
ELLIPSE_LIB_VERSION LITERAL1
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
"type": "git",
|
||||
"url": "https://github.com/RobTillaart/ellipse.git"
|
||||
},
|
||||
"version": "0.1.2",
|
||||
"version": "0.1.3",
|
||||
"license": "MIT",
|
||||
"frameworks": "*",
|
||||
"platforms": "*"
|
||||
|
@ -1,5 +1,5 @@
|
||||
name=ellipse
|
||||
version=0.1.2
|
||||
version=0.1.3
|
||||
author=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
sentence=Arduino library for ellipse class
|
||||
|
Loading…
Reference in New Issue
Block a user