| |
|
|
 | Hey could me Please of/ one the explicit More mathematically formed XProfan on The Sprünge help ? I see whom woods to Bäumen not any more 
everything I wants is a speedy function from the way xy,xxyy me whom winkel (360°!) returns.
my code functions already - naja almost. CompileMarkSeparationCLS
WHILE 1
CLS
PRINT WNK(100,100,%MOUSEX,%MOUSEY)
SLEEP 100
ENDWHILE
WAITKEY
proc WNK
PARAMETERS X&,Y&,XX&,YY&
var T!=0
IF XX&<X&
RETURN WNK(XX&,Y&,X&,YY&)
ENDIF
IF YY&<Y&
RETURN WNK(X&,YY&,XX&,Y&)
ENDIF
LINE X&,Y& - XX&,YY&
var DX!=XX&-X&
var DY!=YY&-Y&
T!=(SQRT(DX!*DX!+DY!*DY!))
IF YY&<XX&
T!=RAD2DEG(SINH(DY!/T!))
ELSE
T!=45+(45-RAD2DEG(SINH(DX!/T!)))
ENDIF
RETURN T!
endproc
proc RAD2DEG
PARAMETERS ANGLE!
RETURN (180 / @PI()) * ANGLE!
endproc
proc SINH
PARAMETERS ANGLE!
RETURN (@EXP(ANGLE!) - @EXP(-ANGLE!)) / 2
./../function-references/XProfan/endproc/'>endproc
|
|
|
| |
|
|
|
 Hubert Binnewies | Hello IF
means...in maths be I well on it...but in the understand your Codes not so well...
ought to the the Sinussatz his???
power me still time ne Gleichung or Formel on what about me Denk me what from..oki??
Hubert.. |
|
|
| WinXP Prof, XProfan 9.1 Newbie
Ein kluger Kopf sagte mal: "Nach dem derzeitigen Stand der Technik ist es unmöglich Programme zu schreiben, die fehlerfrei laufen!" | 12/05/06 ▲ |
|
|
|
|
 Carlo Keil | Hello iF, if I the right understand, seek You whom Winkel between of/ one way or. its extra time and the x-axis. the ought to with only of/ one Winkelfunktion weg: (for want of Profan and Testmöglichkeit only one Pseudocode)
Winkel in the Bogenmaß = Arcustangens(abs((y2 - y1) / (x2 - x1)))
Üblicherweise are The Winkelfunktionen not übermäßig quick. If it to you on performance ankommt see I only two Opportunities: Assembler or startup a Own Arcustangenstabelle initialisieren, The You then without Berechnung directly abgreifst (its Size depends naturally from the desired accuracy ex ).
HTH Carlo |
|
|
| |
|
|
|
 | @Hubert: It's all right me hold therefore a each line whom Winkel detect to. I do me heavy what The Umsprünge concerns if z.B. xx&<x& is etc.
@Carlo: tables, clear, Have here already such posted - but the accuracy should already be high - tables entrapments here from.
on Winkel in the Bogenmaß = Arcustangens(abs((y2 - y1) / (x2 - x1))) can I me too remind - the have I supra Yes apply.
If I obiges but walk let there zw. 160° and 200° a problem - and I am betriebsblind.
naturally werd ichs performance due to ASM transfer. |
|
|
| |
|
|
|
 | Hm means me gives none such a Proc wa?  |
|
|
| |
|
|
|
 Jac de Lad | I I allow myself to the mathematical formed Personen here in the Forum To count... 
but i see The Fragestellung not. Kannste the again perform? too from the code I will not schlau... |
|
|
| Profan² 2.6 bis XProfan 11.1+XPSE+XPIA+XPRR (und irgendwann XIDE) Core2Duo E8500/T2250, 8192/1024 MB, Radeon HD4850/Radeon XPress 1250, Vista64/XP | 12/05/06 ▲ |
|
|
|
|
 | OK clear!
I male a line of 100,100 to mousex,mousey
everything I would like is whom Winkel the line!
----> 0°
<--- 180°
^ | 270°
hold a Proc The me simply always whom right Winkel gives after I your x,y - xx,yy transfer have. |
|
|
| |
|
|
|
 Jac de Lad | Aso, no trouble, kriegst soon ne response! must now but strain what other make... |
|
|
| Profan² 2.6 bis XProfan 11.1+XPSE+XPIA+XPRR (und irgendwann XIDE) Core2Duo E8500/T2250, 8192/1024 MB, Radeon HD4850/Radeon XPress 1250, Vista64/XP | 12/05/06 ▲ |
|
|
|
|
 | |
|
| |
|
|
|
 | alas lol I sucker - I habs. Hey but Perhaps is Deins faster? I poste mine same time... |
|
|
| |
|
|
|
 | CompileMarkSeparation {$cleq}
const myPi=3.1415926535897932384626433832795
cls
while 1
cls
print int(wnk(100,100,mousex,mousey,false)),"° "
sleep 50
wend
waitkey
proc wnk(float x1,y1,x2,y2,int mode)
float x= sub ( x2! , x1! )
float y= sub ( y2! , y1! )
line x1,y1 - x2,y2
case (x<0) and (y<0) : return wnk(x2,y2,x1,y1,3)
case x<0 : return wnk(x2,y1,x1,y2,1)
case y<0 : return wnk(x1,y2,x2,y1,2)
casenot x : x=0.0000001
casenot y : y=0.0000001
float w=arctan(y/x)*180/myPi
if (mode==1)
w:=90+(90-w)
elseif (mode==2)
w:=360-w
elseif (mode==3)
w:=180+w
endif
return w
endproc
CompileMarkSeparationCLS
WHILE 1
CLS
PRINT INT(WNK(100,100,%MOUSEX,%MOUSEY,0)),"° "
SLEEP 50
ENDWHILE
WAITKEY
proc WNK
PARAMETERS X1!,Y1!,X2!,Y2!,MODE%
var X!=SUB ( X2! , X1! )
var Y!=SUB ( Y2! , Y1! )
LINE X1!,Y1! - X2!,Y2!
IF (X!<0) AND (Y!<0)
RETURN WNK(X2!,Y2!,X1!,Y1!,3)
ENDIF
IF X!<0
RETURN WNK(X2!,Y1!,X1!,Y2!,1)
ENDIF
IF Y!<0
RETURN WNK(X1!,Y2!,X2!,Y1!,2)
ENDIF
IFNOT X!
X!=0.0000001
ENDIF
IFNOT Y!
Y!=0.0000001
ENDIF
var W!=ARCTAN(Y!/X!)*180/3.1415926535897932384626433832795
IF (MODE%=1)
W!=90+(90-W!)
ELSEIF (MODE%=2)
W!=360-W!
ELSEIF (MODE%=3)
W!=180+W!
ENDIF
RETURN W!
endproc
|
|
|
| |
|
|
|
 Jac de Lad | Probier time the: CompileMarkSeparation
proc Winkel
Parameters x1!,y1!,x2!,y2!
declare dx!,dy!
dx!=x2!-x1!
dy!=y1!-y2!
if Abs(dx!)<Abs(dy!)
Return Pi()/2-ArcTan(dx!/dy!)+If((dx!<0) | (dy!<0),Pi(),0)
else
Return ArcTan(dy!/dx!)+If((dx!<0) | (dy!<0),Pi(),0)
endif
Profan² 2.6 bis XProfan 11.1+XPSE+XPIA+XPRR (und irgendwann XIDE) Core2Duo E8500/T2250, 8192/1024 MB, Radeon HD4850/Radeon XPress 1250, Vista64/XP | 12/05/06 ▲ | |
|
|
|