SohCahToa
is a C# library designed to simplify trigonometric calculations with a focus on ease of use and precision.
- 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.
To integrate SohCahToa
into your project, use the following NuGet command:
Install-Package SohCahToa
Calculate the length of the opposite side of a right triangle given the adjacent side and the angle:
double run = 5;
double primaryAngle = 30;
double rise = Trig.Rise_RunPrimaryAngle(run, primaryAngle);
Console.WriteLine($"Rise: {rise}");
- Double Precision: For applications requiring high accuracy.
- Methods include
Rise_RunPrimaryAngle
,PrimaryAngle_RiseRun
,ComplimentaryAngle_PrimaryAngle
, etc.
- Single Precision: Optimized for performance and memory efficiency.
- Methods mirror those of
Trig
but usefloat
types, e.g.,Rise_RunPrimaryAngle(float run, float primaryAngle)
.
- 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.
double run = 5;
double primaryAngle = 30;
double rise = Trig.Rise_RunPrimaryAngle(run, primaryAngle);
double rise = 3;
double run = 4;
double primaryAngle = Trig.PrimaryAngle_RiseRun(rise, run);
double run = 5;
double primaryAngle = 30;
double rise = Trig.Rise_RunPrimaryAngle(run, primaryAngle);
double complimentaryAngle = Trig.ComplimentaryAngle_PrimaryAngle(primaryAngle);
Contributions are welcome! Please submit pull requests or open issues to discuss proposed changes or report bugs.
SohCahToa
is released under the MIT License. See the LICENSE file in the repository for more details.