# Simple Math Extension Function Library

## Recommended Posts

Hey, i wrote a math library that includes Time Conversions, Distance Conversions and a little bit of geometry. Im working on a documentation for it, but just wanted to see what you guys thought of it. its pretty basic though. I think it is kind of difficult for you to find the functions in their. Im not really sure what you will want to do with these(maybe use them for your games) but the basic functions are:

Func _TriArea(\$iBase, \$iHeight)

Func _VolCube(\$Length, \$Width, \$Height)

and then the feet, yards, miles, minutes, seconds, hours conversions are in their some where. lol. I'll get the doc out soon.

```;Extended Math Functions - Geometry, Distances and Time.
;include math
;Created by Chris C. <chris95219>
#include <math.au3>
;------------------------------------------------------------
;                  Geometry
;-------------------------------
;Area of a Triangle
; A = 1/2BH
;------------------------------
Func _TriArea(\$iBase, \$iHeight)
\$Area = .5 * \$iBase * \$iHeight
Return \$Area
EndFunc;==>_TriArea
;-------------------------------
;Area of a Circle
; A = 3.14 * Radius Squared
;------------------------------
\$Area = 3.14 * \$Radius ^ 2
Return \$Area
EndFunc;==>_CircleArea
;-------------------------------
;Surface Area of a Sphere
; A = 4 * 3.14 * Radius Squared
;------------------------------
\$Area = 4 * 3.14 * \$Radius ^ 2
Return \$Area
EndFunc;==>_SASphere
;-------------------------------
;Volume of a Right Circular Cylinder
; V = 3.14 * Radius Squared * height
;------------------------------
\$Volume = 3.14 * \$Radius ^ 2 * \$Height
Return \$Volume
EndFunc;==>_VolRCC
;-------------------------------
;Volume of a Sphere
; V = 4/3 * 3.14 * Radius Cubed
;------------------------------
\$Volume = 4 / 3 * 3.14 * \$Radius ^ 3
Return \$Volume
EndFunc;==>_VolSphere
;-------------------------------
;Volume of a Cone
; V = 1/3 * 3.14 * Radius Squared * Height
;------------------------------
\$Volume = 1 / 3 * 3.14 * \$Radius ^ 2 * \$Height
Return \$Volume
EndFunc;==>_VolCone
;-------------------------------
;Volume of a Cube
; V = length * width * height
;------------------------------
Func _VolCube(\$Length, \$Width, \$Height)
\$Volume = \$Length * \$Width * \$Height
Return \$Volume
EndFunc;==>_VolCube
;-------------------------------
;Circumference of a Circle
;C = 2 * 3.14 * Radius
;------------------------------
\$Circumference = 2 * 3.14 * \$Radius
Return \$Circumference
EndFunc;==>_CircCircle
;---------------------------------------------------
;Distances
;---------------------------------------------------
;Inches to Feet
Func _InFeet(\$iInches)
\$Feet = \$iInches / 12
Return \$Feet
EndFunc;==>_InFeet
;Feet to Inches
Func _FeetIn(\$iFeet)
\$Inches = \$iFeet * 12
Return \$Inches
EndFunc;==>_FeetIn
;Inches to Yards
Func _InYards(\$iInches)
\$aYards = \$iInches / 12
\$Yards = \$aYards / 3
Return \$Yards
EndFunc;==>_InYards
;Yards to Inches
Func _YardsIn(\$iYards)
\$aInches = \$iYards * 3
\$Inches = \$aInches * 12
Return \$Inches
EndFunc;==>_YardsIn
;Feet to Yards
Func _FeetYards(\$iFeet)
\$Yards = \$iFeet / 3
Return \$Yards
EndFunc;==>_FeetYards
;Yards to Feet
Func _YardsFeet(\$iYards)
\$Feet = \$iYards * 3
Return \$Feet
EndFunc;==>_YardsFeet
; Yards to Miles
; s --> b
Func _YardsMiles(\$iYards)
\$Miles = \$iYards / 1760
Return \$Miles
EndFunc;==>_YardsMiles
;Miles to Yards
Func _MilesYards(\$iMiles)
\$Yards = \$Miles * 1760
Return \$Yards
EndFunc;==>_MilesYards
;Feet to Miles
Func _FeetMiles(\$iFeet)
\$Miles = \$Feet / 5280
Return \$Miles
EndFunc;==>_FeetMiles
;Miles to Feet
Func _MilesFeet(\$iMiles)
\$Feet = \$iMiles * 5280
Return \$Feet
EndFunc;==>_MilesFeet
;Inches to Miles
; s ---> b
Func _InMiles(\$iInches)
\$aMiles = \$iInches / 12
\$Miles = \$aMiles / 5280
Return \$Miles
EndFunc;==>_InMiles
;Miles to Inches
Func _MilesIn(\$iMiles)
\$aInches = \$iMiles * 12
\$Inches = \$aInches * 5280
Return \$Inches
EndFunc;==>_MilesIn
;---------------------------------------------------
;Time
;---------------------------------------------------
;second => 1000 milleseconds
;minute => 60 seconds
;hour => 60 minutes
;Seconds to Milleseconds
Func _SecMil(\$iSeconds)
\$Mille = \$iSeconds * 1000
Return \$Mille
EndFunc;==>_SecMil
;Milleseconds to Seconds
Func _MilSec(\$iMilleseconds)
\$Seconds = \$iMilleseconds / 1000
Return \$Seconds
EndFunc;==>_MilSec
;Minute to Second
Func _MinSec(\$iMinutes)
\$Seconds = \$iMinutes * 60
Return \$Seconds
EndFunc;==>_MinSec
;Seconds to Minutes
Func _SecMin(\$iSeconds)
\$Minutes = \$iSeconds / 60
Return \$Minutes
EndFunc;==>_SecMin
;Milleseconds to Minutes
Func _MilMin(\$iMilleseconds)
\$Minutes = \$iMilleseconds / 60
Return \$Minutes
EndFunc;==>_MilMin
;Minutes to Milleseconds
Func _MinMil(\$iMinutes)
\$Mill = \$iMinutes * 60 * 1000
Return \$Mill
EndFunc;==>_MinMil
;Minutes to Hours
Func _MinHour(\$iMinutes)
\$Hours = \$iMinutes / 60
Return \$Hours
EndFunc;==>_MinHour
;Hours to Minutes
Func _HourMin(\$iHours)
\$Minutes = \$iHours * 60
Return \$Minutes
EndFunc;==>_HourMin
;Hours to Seconds
Func _HourSec(\$iHours)
\$Seconds = \$iHours * 60 * 60
Return \$Seconds
EndFunc;==>_HourSec
;Hours to Milleseconds
Func _HourMillSec(\$iHours)
\$Milleseconds = \$iHours * 60 * 60 * 1000
Return \$Milleseconds
EndFunc;==>_HourMillSec
; Seconds to Hours
Func _SecHour(\$iSeconds)
\$Hours = \$iSeconds / 60 / 60
Return \$Hours
EndFunc;==>_SecHour
;Milleseconds to Hours
Func _MilHour(\$iMilleseconds)
\$Hours = \$iMilleseconds / 1000 / 60 / 60
Return \$Hours
EndFunc;==>_MilHour
;End of Functions```
Edited by CHRIS95219

##### Share on other sites

Hey if i where you, i would put PI (3.14) as a variable... that way it would be easy to change the length of it. As for your time ones do these overlap the _now and _date functions? i dont think they do but if you havent looked into them, you should. Also what about adding support for finding the sides and angles of a triangles/polynominals if your missing some information. like Side Side Angle to find the other 2 Angles and Side. Cool Script!

##### Share on other sites

Hey if i where you, i would put PI (3.14) as a variable... that way it would be easy to change the length of it. As for your time ones do these overlap the _now and _date functions? i dont think they do but if you havent looked into them, you should. Also what about adding support for finding the sides and angles of a triangles/polynominals if your missing some information. like Side Side Angle to find the other 2 Angles and Side. Cool Script!

yeah, thx.

Their is still lots more functions im gonna add into here, im probably going to put them in it, once i get the entire documentation complete.

## Create an account

Register a new account