-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from bretleasure/main
Updated Readme and added IntelliSense to functions
- Loading branch information
Showing
4 changed files
with
549 additions
and
137 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 |
---|---|---|
@@ -1,49 +1,84 @@ | ||
# SohCahToa | ||
|
||
[![NuGet version (iAutomateDesign.AutodeskAppStore)](https://buildstats.info/nuget/SohCahToa)](https://www.nuget.org/packages/SohCahToa) | ||
[![NuGet version (SohCahToa)](https://buildstats.info/nuget/SohCahToa)](https://www.nuget.org/packages/SohCahToa) | ||
|
||
Simplifies performing Trig calculations by providing descriptive function names. No more having to remember whether Sin, Cos, or Tan need to be used to get the value you are needing. | ||
`SohCahToa` is a powerful C# library designed to simplify trigonometric calculations, making it an essential tool for engineering, educational software, and any application dealing with geometric data. With its focus on ease of use and precision, `SohCahToa` helps developers perform complex trigonometric calculations with minimal effort. | ||
|
||
## How to Use | ||
## Features | ||
|
||
* Add a using statement for `SohCahToa` | ||
* Call static functions within the `Trig` class | ||
- **High Precision Calculations**: Utilize double precision (`Trig`) or single precision (`TrigF`) for trigonometric operations. | ||
- **Static Methods**: Direct access to trigonometric calculations without needing to instantiate classes. | ||
- **Comprehensive Coverage**: Methods for calculating side lengths, primary and complimentary angles in right triangles. | ||
- **Ease of Use**: Intuitive method naming convention for quick understanding and implementation. | ||
|
||
## Installation | ||
|
||
To integrate `SohCahToa` into your project, use the following NuGet command: | ||
|
||
```bash | ||
Install-Package SohCahToa | ||
``` | ||
|
||
## Quick Start | ||
|
||
Calculate the length of the opposite side of a right triangle given the adjacent side and the angle: | ||
|
||
```csharp | ||
var run = 10; | ||
var rise = 15; | ||
var hypotenuse = Trig.Hypotenuse_RiseRun(rise, run); | ||
double run = 5; | ||
double primaryAngle = 30; | ||
double rise = Trig.Rise_RunPrimaryAngle(run, primaryAngle); | ||
Console.WriteLine($"Rise: {rise}"); | ||
``` | ||
|
||
## API Overview | ||
|
||
### `Trig` Class | ||
|
||
- **Double Precision**: For applications requiring high accuracy. | ||
- Methods include `Rise_RunPrimaryAngle`, `PrimaryAngle_RiseRun`, `ComplimentaryAngle_PrimaryAngle`, etc. | ||
|
||
### `TrigF` Class | ||
|
||
### Triangle Side/Angle Nomenclature: | ||
- **Single Precision**: Optimized for performance and memory efficiency. | ||
- Methods mirror those of `Trig` but use `float` types, e.g., `Rise_RunPrimaryAngle(float run, float primaryAngle)`. | ||
|
||
![Triangle Labels](https://i.imgur.com/EUrjY2m.png) | ||
### Method Naming Convention | ||
|
||
* Hypotenuse = c | ||
* Run = b | ||
* Rise = a | ||
* Primary Angle = AA | ||
* Complimentary Angle = BB | ||
- **Descriptive Prefix**: The primary output or focus of the method (e.g., `Rise`, `Run`, `PrimaryAngle`). | ||
- **Underscore Separator**: Enhances readability and method parsing. | ||
- **Input Parameters**: Inputs or known quantities used for calculation. | ||
|
||
**Angles are in degrees** | ||
## Examples | ||
|
||
### Function names follow the following structure: | ||
### Calculate Side Lengths | ||
|
||
**[Value to be Calculated]_[Input 1][Input 2]** | ||
```csharp | ||
double run = 5; | ||
double primaryAngle = 30; | ||
double rise = Trig.Rise_RunPrimaryAngle(run, primaryAngle); | ||
``` | ||
|
||
For Example: | ||
### Calculate Angles | ||
|
||
The function to use for calculating the hypotenuse of a triangle using the Rise and Run values would be `Hypotenuse_RiseRun()` | ||
```csharp | ||
double rise = 3; | ||
double run = 4; | ||
double primaryAngle = Trig.PrimaryAngle_RiseRun(rise, run); | ||
``` | ||
|
||
### Short Method Naming: | ||
### Comprehensive Calculations | ||
|
||
```csharp | ||
double run = 5; | ||
double primaryAngle = 30; | ||
double rise = Trig.Rise_RunPrimaryAngle(run, primaryAngle); | ||
double complimentaryAngle = Trig.ComplimentaryAngle_PrimaryAngle(primaryAngle); | ||
``` | ||
|
||
Alternatively, there are functions that reference the values shown in the image above that could be used instead of using the descriptive names. | ||
## Contributing | ||
|
||
* Sides are named with lower case letters (a,b,c) | ||
Contributions are welcome! Please submit pull requests or open issues to discuss proposed changes or report bugs. | ||
|
||
* Angles are named with upper case double letters (AA, BB) | ||
## License | ||
|
||
The same calculated from above, calculating the hypotenuse using the Rise and Run values would be `c_ab()` | ||
`SohCahToa` is released under the MIT License. See the LICENSE file in the repository for more details. |
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
Oops, something went wrong.