cppman Posted February 11, 2006 Share Posted February 11, 2006 (edited) 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 _CircleArea($Radius) Func _SASphere($Radius) Func _VolRCC($Radius, $Height) Func _VolSphere($Radius) Func _VolCone($Radius, $Height) Func _VolCube($Length, $Width, $Height) Func _CircCircle($Radius) and then the feet, yards, miles, minutes, seconds, hours conversions are in their some where. lol. I'll get the doc out soon. expandcollapse popup;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 ;------------------------------ Func _CircleArea($Radius) $Area = 3.14 * $Radius ^ 2 Return $Area EndFunc;==>_CircleArea ;------------------------------- ;Surface Area of a Sphere ; A = 4 * 3.14 * Radius Squared ;------------------------------ Func _SASphere($Radius) $Area = 4 * 3.14 * $Radius ^ 2 Return $Area EndFunc;==>_SASphere ;------------------------------- ;Volume of a Right Circular Cylinder ; V = 3.14 * Radius Squared * height ;------------------------------ Func _VolRCC($Radius, $Height) $Volume = 3.14 * $Radius ^ 2 * $Height Return $Volume EndFunc;==>_VolRCC ;------------------------------- ;Volume of a Sphere ; V = 4/3 * 3.14 * Radius Cubed ;------------------------------ Func _VolSphere($Radius) $Volume = 4 / 3 * 3.14 * $Radius ^ 3 Return $Volume EndFunc;==>_VolSphere ;------------------------------- ;Volume of a Cone ; V = 1/3 * 3.14 * Radius Squared * Height ;------------------------------ Func _VolCone($Radius, $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 ;------------------------------ Func _CircCircle($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 February 11, 2006 by CHRIS95219 Miva OS Project Link to comment Share on other sites More sharing options...
mikeytown2 Posted February 11, 2006 Share Posted February 11, 2006 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! Email: POP3 & SMTP using SSL/TLS (OpenSSL)Email: IMAPEmail: Base64 & SMTP login & Send email direct to MX Server (thanks blindwig)Win: Hook Registry ChangesWin: Read/Write to Alternate Data Streams (ini example)Utility: GPS Distance Calculations, Vincenty and Haversine formulas; angles and elevationUtility: Dell Laser Printer (3000-5100) - Print LoggerUtility: Reset Router when Wireless Link FailsUtility: ImageMagick Batch jpg ProcessorVideo HCenc Batch FrontendVideo: *DEAD* YouTube Video Encoder (avs/avi to flv)Software On CD's I Like<<back|track3 Ultimate Boot CD for Windows SpinRite Ubuntu ophcrack Link to comment Share on other sites More sharing options...
cppman Posted February 11, 2006 Author Share Posted February 11, 2006 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.thx for the reply. Miva OS Project Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now