Zibit Posted November 26, 2009 Share Posted November 26, 2009 ok got bored soo made some scripts, soo all you school children heres something what would help u with ur homework... i didnt but all the divide and stuff their pointless... Squareroot $x = InputBox("Square", "Number", "", "", 50, 50 , 100, 100) $y = sqrt($x) MsgBox(0, "", $x & " Squareroot is " & $y) Percent calculator (May be wrong but who knows dont remember percent much) $x = InputBox("Percent calculator", "Enter the time amount in MilliSeconds.", "", "", 50, 50, 100, 100) $y = Number($x*0.01) MsgBox(0, "", " 1% of " & $x &" is " & $y) $x = InputBox("Square Equation", "nr 1 ex: x+5x-3=0 nr 1 is 5 (reduced)", "", "", 50, 50 , 100, 100) $x2 = InputBox("Square Equation", "nr 2 ex: x+5x-3=0 nr 2 is -3 (reduced)", "", "", 50, 50 , 100, 100) $t = number($x/2) $z = number($t*$t-$x2) $y = sqrt($z) $answer1 = number($x/-2+$y) $answer2 = number($x/-2-$y) $anwser = MsgBox(0, "Answer", & "X1 is " $answer1 & " and X2 is " & $answer2) Unreduced Square Equation $x = InputBox("Square Equation", "nr 1 ex: 3x+5x-3=0 nr 1 is 3 (unreduced)", "", "", 50, 50 , 100, 100) $x2 = InputBox("Square Equation", "nr 2 ex: 3x+5x-3=0 nr 2 is 5 (unreduced)", "", "", 50, 50 , 100, 100) $x3 = InputBox("Square Equation", "nr 3 ex: 3x+5x-3=0 nr 2 is -3 (unreduced)", "", "", 50, 50 , 100, 100) $t = number($x2*$x2) $z = number($t-(4*$x*$x3)) $y = sqrt($z) $answer1 = number((-$x2+$y)/(2*$x)) $answer2 = number((-$x2-$y)/(2*$x)) $anwser = MsgBox(0, "Answer", & "X1 is " $answer1 & " and X2 is " & $answer2) well some much for that didnt have time to make more... if anyone got some more then ur free to post (And pls ppl dont start bitching why i post soo pointless things... its an example and u never know when u need them) Creator Of Xtreme DevelopersPixel Pattern UDFTray GUI UDFMathssend & recive register scriptMouse Control via Webcam Link to comment Share on other sites More sharing options...
enaiman Posted November 26, 2009 Share Posted November 26, 2009 Wow - fresh post, 0 replies and already a 5 star rating - it must be really good ... SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
corgano Posted November 27, 2009 Share Posted November 27, 2009 to find intersection points of circles expandcollapse popupfunc intcircles($x0,$y0,$r1,$x1,$y1,$r2) Local $xp2, $yp2, $dx, $dy, $d Local $return[4] $dx = $x1 - $x0; $dy = $y1 - $y0; $d = sqrt(($x1 - $x0)^2 + ($y1 - $y0)^2) If ($d > ($r1 + $r2)) or ($d < ($r1 - $r2)) Then SetError(1);unsaluveable Return $return EndIf ;Determine the distance from point 0 to point 2. $a = ($r1^2 - $r2^2 + $d^2) / (2.0 * $d) ;Determine the coordinates of point 2. */ $x2 = $x0 + ($dx * $a/$d); $y2 = $y0 + ($dy * $a/$d); ;Determine the distance from point 2 to either of the intersection points. $h = sqrt(($r1*$r1) - ($a*$a)) ; Now determine the offsets of the intersection points from point 2. $rx = -$dy * ($h/$d); $ry = $dx * ($h/$d); ; Determine the absolute intersection points. ; $return[0] = ($x2 + $rx);+($d/2) $return[2] = ($x2 - $rx);+($d/2) $return[1] = ($y2 + $ry);-($d/2) $return[3] = ($y2 - $ry);-($d/2) ConsoleWrite("$a = " & $a & @crlf) ConsoleWrite("$d = " & $d & @crlf) ConsoleWrite("$dx = " & $dx & @crlf) ConsoleWrite("$dy = " & $dy & @crlf) ConsoleWrite("$return 1 = " & $return[0] & @crlf) ConsoleWrite("$return 2 = " & $return[1] & @crlf) ConsoleWrite("$return 3 = " & $return[2] & @crlf) ConsoleWrite("$return 4 = " & $return[3] & @crlf) return $return EndFunc example expandcollapse popup#include <GUIConstantsEx.au3> #include <GDIPLus.au3> #include <WinAPI.au3> #include <ScreenCapture.au3> Global $gui, $pic, $circ1x, $circ1y, $circ1r, $s4, $s5, $circ2r, $msg $gui = GUICreate("Theo test", 800, 600) $pic = GUICtrlCreatePic("", 0, 0, 600, 600) GUICtrlCreateLabel("Circle 1 x", 630, 35) $circ1x = GUICtrlCreateSlider(600, 50, 200, 50) GUICtrlSetLimit(-1, 600, 10) GUICtrlSetData(-1, 400) GUICtrlCreateLabel("Circle 1 y", 630, 135) $circ1y = GUICtrlCreateSlider(600, 150, 200, 50) GUICtrlSetLimit(-1, 600, 10) GUICtrlSetData(-1, 300) GUICtrlCreateLabel("Circle 1 radius", 630, 235) $circ1r = GUICtrlCreateSlider(600, 250, 200, 50) GUICtrlSetLimit(-1, 300, 10) GUICtrlSetData(-1, 75) GUICtrlCreateLabel("Circle 1 x", 630, 335) $circ2x = GUICtrlCreateSlider(600, 350, 200, 50) GUICtrlSetLimit(-1, 600, 10) GUICtrlSetData(-1, 300) GUICtrlCreateLabel("Circle 2 y", 630, 435) $circ2y = GUICtrlCreateSlider(600, 450, 200, 50) GUICtrlSetLimit(-1, 600, 10) GUICtrlSetData(-1, 200) GUICtrlCreateLabel("Circle 2 radius", 630, 535) $circ2r = GUICtrlCreateSlider(600, 550, 200, 50) GUICtrlSetLimit(-1, 300, 10) GUICtrlSetData(-1, 175) GUISetState() test($pic, 400, 300, 75, 300, 200, 175) While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit Case $circ1x, $circ1y, $circ1r, $circ2x, $circ2y, $circ2r refresh() EndSwitch WEnd Func refresh() consolewrite("blarb" & @crlf) Local $c1x, $c1y, $c1r, $c2x, $c2y, $c2r $c1x = GUICtrlRead($circ1x) $c1y = GUICtrlRead($circ1y) $c1r = GUICtrlRead($circ1r) $c2x = GUICtrlRead($circ2x) $c2y = GUICtrlRead($circ2y) $c2r = GUICtrlRead($circ2r) $image = test($pic, $c1x, $c1y, $c1r, $c2x, $c2y, $c2r) return $image EndFunc Func test($ctrl, $circ1x, $circ1y, $circ1r, $circ2x, $circ2y, $circ2r) Local $hBmp, $hPen, $hBitmap1, $hGraphic, $hBitmap2, $OldBmp, $one, $two $hBmp = _WinAPI_CreateBitmap(600, 600, 1, 32) _GDIPlus_Startup() $hPen = _GDIPlus_PenCreate(0xFFFFFFFF) ;~ ConsoleWrite("0x" & Hex(200 / $lines + 55,2) & "FFFFFF" & @crlf) $hBitmap1 = _GDIPlus_BitmapCreateFromHBITMAP($hBmp) $hGraphic = _GDIPlus_ImageGetGraphicsContext($hBitmap1) _GDIPlus_GraphicsSetSmoothingMode($hGraphic, 4) _GDIPlus_GraphicsDrawEllipse($hGraphic, $circ1x - ($circ1r), $circ1y - ($circ1r), $circ1r*2, $circ1r*2, $hPen) _GDIPlus_GraphicsDrawEllipse($hGraphic, $circ2x - ($circ2r), $circ2y - ($circ2r), $circ2r*2, $circ2r*2, $hPen) $var = intcircles($circ1x, $circ1y, $circ1r, $circ2x, $circ2y, $circ2r) _GDIPlus_GraphicsDrawEllipse($hGraphic,$var[0] - 5,$var[1] - 5,10,10,$hPen) _GDIPlus_GraphicsDrawEllipse($hGraphic,$var[2] - 5,$var[3] - 5,10,10,$hPen) $hBitmap2 = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap1) $oldbmp = GUICtrlSendMsg($ctrl, 0x0172, 0, $hBitmap2) If $OldBmp Then _WinAPI_DeleteObject($OldBmp) _WinAPI_DeleteObject($hBitmap2) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_BitmapDispose($hBitmap1) _GDIPlus_PenDispose($hPen) _GDIPlus_Shutdown() _WinAPI_DeleteObject($hBmp) EndFunc ;==>fracircle Func Angle($x1, $y1, $Ang, $Length, $round = 0) If $Ang >= 360 Then $Ang -= 360 Local $Return[2] $Return[0] = $x1 + ($Length * Cos($Ang / 180 * 3.14159265358979)) $Return[1] = $y1 - ($Length * Sin($Ang / 180 * 3.14159265358979)) If $round = 1 Then $Return[0] = Round($Return[0]) $Return[1] = Round($Return[1]) EndIf Return $Return EndFunc ;==>Angle func intcircles($x0,$y0,$r1,$x1,$y1,$r2) Local $xp2, $yp2, $dx, $dy, $d Local $return[4] $dx = $x1 - $x0; $dy = $y1 - $y0; $d = sqrt(($x1 - $x0)^2 + ($y1 - $y0)^2) If ($d > ($r1 + $r2)) or ($d < ($r1 - $r2)) Then SetError(1);unsaluveable Return $return EndIf ;Determine the distance from point 0 to point 2. $a = ($r1^2 - $r2^2 + $d^2) / (2.0 * $d) ;Determine the coordinates of point 2. */ $x2 = $x0 + ($dx * $a/$d); $y2 = $y0 + ($dy * $a/$d); ;Determine the distance from point 2 to either of the intersection points. $h = sqrt(($r1*$r1) - ($a*$a)) ; Now determine the offsets of the intersection points from point 2. $rx = -$dy * ($h/$d); $ry = $dx * ($h/$d); ; Determine the absolute intersection points. ; $return[0] = ($x2 + $rx);+($d/2) $return[2] = ($x2 - $rx);+($d/2) $return[1] = ($y2 + $ry);-($d/2) $return[3] = ($y2 - $ry);-($d/2) ConsoleWrite("$a = " & $a & @crlf) ConsoleWrite("$d = " & $d & @crlf) ConsoleWrite("$dx = " & $dx & @crlf) ConsoleWrite("$dy = " & $dy & @crlf) ConsoleWrite("$return 1 = " & $return[0] & @crlf) ConsoleWrite("$return 2 = " & $return[1] & @crlf) ConsoleWrite("$return 3 = " & $return[2] & @crlf) ConsoleWrite("$return 4 = " & $return[3] & @crlf) return $return EndFunc 0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e 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