Autor Beitrag
masteroffinalfantasy
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 82

Win XP
Delphi 2005 Architect
BeitragVerfasst: So 05.08.07 13:10 
Glück auf!

Ich hab wahrscheinlich mathematisches Problem^^

Ich versuche gerade krampfhaft, mit einer Funktion einen Pixel zu finden...

Also ich habe einen Mittelpunkt M(962,106) und den Radius r=8 (werte in pixeln^^)

Jetzt such ich den Punkt P wo Col=161 ist...

Schaut selbst:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
SetCapture(Button1.Handle);



  DC:=CreateDC('Display',nil,nil,nil);
     try

     for k:=0 to 360 do begin
      testx:=cos(k)*8;
      testy:=sin(k)*8;
      SetCursorPos(strtoint(floattostr(962+roundto(testx,0))),strtoint(floattostr(106+roundto(testy,0))));
       Col:=GetPixel(DC,strtoint(floattostr(962+roundto(testx,0))),strtoint(floattostr(106+roundto(testy,0))));

     if Col=161 then showmessage('Spitze gefunden');
     end;
     finally
     DeleteDC(DC);
     end;
     ReleaseCapture;


Aber irgendwie findet er das net :gruebel:

Wäre für jede Hilfe dankbar :)
arj
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 378

Win XP/Vista, Debian, (K)Ubuntu
Delphi 5 Prof, Delphi 7 Prof, C# (#Develop, VS 2005), Java (Eclipse), C++, QT, PHP, Python
BeitragVerfasst: So 05.08.07 13:37 
Cosinus/Sinus erwarten Werte im Bogenmaß!

Der Punkt liegt nur auf der Kreislinie? Dann sollte es so funktionieren.
masteroffinalfantasy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 82

Win XP
Delphi 2005 Architect
BeitragVerfasst: So 05.08.07 13:43 
user profile iconarj hat folgendes geschrieben:
Cosinus/Sinus erwarten Werte im Bogenmaß!

Der Punkt liegt nur auf der Kreislinie? Dann sollte es so funktionieren.


So ist es... die Farben werden doch als Cardinalwert ausgegeben, indem er die RGB Werte einfach aneinanderschreibt, oder?

Das heißt 255 ist der Wert für rot
F34r0fTh3D4rk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5284
Erhaltene Danke: 27

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: So 05.08.07 14:13 
Tcolor ist so aufgebaut: $BBGGRR, jeweils von 0-F afaik, mit Suche in: Delphi-Forum, Delphi-Library GETRVALUE, Suche in: Delphi-Forum, Delphi-Library GETGVALUE und Suche in: Delphi-Forum, Delphi-Library GETBVALUE bekommst du die byte Werte der jeweiligen Farbe 0..255.


mfg
masteroffinalfantasy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 82

Win XP
Delphi 2005 Architect
BeitragVerfasst: So 05.08.07 14:26 
Danke euch beiden, der Farbwert wahr einfach falsch