English
Forum

maths: Angle calculation

 
- Page 1 -


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.
CompileMarkSeparation
CLS

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

 
12/05/06  
 



 
- Page 5 -



Hubert
Binnewies
[quote:1f06939008=iF]means twice so quick How my Result is about the I me vorstellte

goes these function similar umzustellen?
CompileMarkSeparation
proc GETCIRCP

    PARAMETERS XP!,YP!,R!,W!
    COS_OUTPX!=((((R!*SIN(((-1*(((-1+W!)*3.1415926535897932384626433832795)+3.1415926535897932384626433832795))/180))))*-1)+XP!)
    COS_OUTPY!=((((R!*COS(((-1*(((-1+W!)*3.1415926535897932384626433832795)+3.1415926535897932384626433832795))/180))))*-1)+YP!)

endp
>
[/quote:1f06939008]
comment me time rather with worten what You there To to charge attempt or accurate one listing where I it see...
 
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/06/06  
 



clear - one commit X and Y and a radius and a Winkel and sustain The new XY Koords.
 
12/06/06  
 



@Frank: can You yet the iTüpfelchen draufsetzen and these Proc to ASM portieren? (deference - must Floats his!)
CompileMarkSeparation
proc WNK2

    PARAMETERS X!,Y!,XX!,YY!
    var DX!=XX!-X!
    var DY!=YY!-Y!

    IF DX!>0

        IF DY!>0

            RETURN (90*(DY!))/SQRT((DX!)^2 + (DY!)^2)

        ELSEIF DY!<0

            RETURN 180-((90*((DY!)*-1))/SQRT((DX!)^2 + ((DY!)*-1)^2))+180

        ELSE

            RETURN 0

        ENDIF

    ELSEIF DX!<0

        IF DY!>0

            RETURN 90-((90*(DY!))/SQRT(((DX!)*-1)^2 + (DY!)^2))+90

        ELSEIF DY!<0

            RETURN 180+((90*((DY!)*-1))/SQRT(((DX!)*-1)^2 + ((DY!)*-1)^2))

        ELSE

            RETURN 180

        ENDIF

    ELSE

        IF DY!>0

            RETURN 90

        ELSEIF DY!<0

            RETURN 270

        ELSE

            RETURN 0

        ENDIF

    ENDIF

    RETURN T!

/../Function-References/XProfan/endproc/'>endproc

 
12/06/06  
 



so your see what it eigendlich goes:

Kollision against walls - alike whether slanting or grade - something like everything working already.

it go The XML-Maps processing The the MapEditor ausspuckt.

65 kB
Hochgeladen:12/06/06
Downloadcounter36
Download
 
12/06/06  
 




Frank
Abbing
[quote:141851c2a4]@Frank: can You yet the iTüpfelchen draufsetzen and these Proc to ASM portieren? [/quote:141851c2a4]
Have unfortunately little Time and patience moreover. if I moreover come, lasts But.
 
12/07/06  
 




Hubert
Binnewies
[quote:60edca93c6=iF]clear - one commit X and Y and a radius and a Winkel and sustain The new XY Koords.[/quote:60edca93c6]
can I,may I the so understand:
X and Y are a point in the expanse ausgehend from the lenken oberen corner.
The radius is the distance of X,Y To XX,Y.
then comes the Winkel moreover from the itself then the new XX,YY point errechnet the then with the origin ( X,Y ) to a line joined and is here The distance radius own?

then have I already ne Idea How....
(again plainer How You it umgesetzt have)

Hubert

Nachtrag: is the Ursprungslinie a Wagerechte, Senkrechte or irgendeine line?
 
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/07/06  
 



look time Perhaps this Source to explanation:
CompileMarkSeparation
const myPI=3.1415926535897932384626433832795
cls
float cos_outpx,cos_outpy

whileloop 0,359

    getcircp(100,100,50,loop)
    setpixel cos_outpx,cos_outpy,0
    getcircp(300,100,loop/10,loop*3)
    setpixel cos_outpx,cos_outpy,0

wend

waitkey
end

proc getcircp(float xp,yp,r,w)

    cos_outpx:=((((r*sin(((-1*(((-1+w)*myPI)+myPI))/180))))*-1)+xp)
    cos_outpy:=((((r*cos(((-1*(((-1+w)*myPI)+myPI))/180))))*-1)+yp)

endproc


CompileMarkSeparation
CLS
var COS_OUTPX!=0
var COS_OUTPY!=0

WHILELOOP 0,359

    GETCIRCP(100,100,50,&LOOP)
    SETPIXEL COS_OUTPX!,COS_OUTPY!,0
    GETCIRCP(300,100,&LOOP/10,&LOOP*3)
    SETPIXEL COS_OUTPX!,COS_OUTPY!,0

ENDWHILE

WAITKEY
END

proc GETCIRCP

    PARAMETERS XP!,YP!,R!,W!
    COS_OUTPX!=((((R!*SIN(((-1*(((-1+W!)*3.1415926535897932384626433832795)+3.1415926535897932384626433832795))/180))))*-1)+XP!)
    COS_OUTPY!=((((R!*COS(((-1*(((-1+W!)*3.1415926535897932384626433832795)+3.1415926535897932384626433832795))/180))))*-1)+YP!)

endproc

 
12/07/06  
 




Hubert
Binnewies
PFFFFFFFFFFF.......
Schwerer Tobak.....

the can itself in the principle To 90 strain too over one rechtwinkliges Dreieck solve...
plainer would one gleichschenkliges, but then there are problems in determining the Endpunktes.

MOM......

One gleichschenkliges Dreieck in the hc accounts becomes, with which one one rechtwinkliges sustain over the one whom Endpunkt to determine can.....

I consider me time ne Gleichung...
can but what last...
Is one Hirnwindungsverknoter....

Hubert

Nachtrag: I faith but not the it then speedy goes, because in your routine counts it only a Sinus and a Cosinus To supplant, for I will but at least 2 time root drinhaben....what about me have no idea whether the The routine speed....
 
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/07/06  
 



Hey is still OK! If DU already say it rewards not... then bleibts what's it like!
 
12/07/06  
 




Hubert
Binnewies
but I find denoch: One attempt is it worth....
 
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/07/06  
 



 
12/07/06  
 




Hubert
Binnewies
i'm yet dran.....
I faith I come with of/ one root and otherwise Grundrechenarten there....
so might my Formel faster his as Sinus and Cosinus....
More tommorrow....
there have I with safety a Formel and probably a routine The IF with safety tierisch well optimiert.... (I faith I ought to it The listings of my Proggis give... it power tappt im dunkeln faster and rather...)

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/07/06  
 




Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

5.013 Views

Untitledvor 0 min.
Michael W.12/23/16
Julian Schmidt11/25/13
holmol9305/10/13
Andreas Koch11/07/12
More...

Themeninformationen



Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie