Autor Beitrag
christian87
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 45



BeitragVerfasst: Do 15.02.07 21:12 
Hi,

ich wollte fragen, wenn ich Abstände zweier images berechnen will, geht Delphi da vom Mittelpunkt des images aus oder vom Rand?
jakobwenzel
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1889
Erhaltene Danke: 1

XP home, ubuntu
BDS 2006 Prof
BeitragVerfasst: Do 15.02.07 21:13 
Immer vom Rand aus.

BTW: Wieso probierstes eigentlich nich einfach aus?

_________________
I thought what I'd do was, I'd pretend I was one of those deaf-mutes.
Benjie
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 55

Win 98 SE / Win XP / xubuntu Linux / Mac OS 9.2
D6 Enterprise
BeitragVerfasst: Sa 17.02.07 13:45 
Um den Abstand zweier Bilder zu berechnen, egal wo sich diese befinden nimmste einfach den x-Mittelpunkt des einen Bildes (image1.left+image1.width div 2) und den des anderen (image2.left+image2.width div 2) und subtrahierst beides. Das ist der Horizontale Abstand. Für den vertikalen Abstand nimmste die y-Mittelpunkte (image1.top+image1.height div 2),(image2.top+image2.height div 2) und subtrahierst sie ebenfalls. Dann nach Pythagoras: c^2 = a^2+b^2.

Abstand:=(sqrt(sqr(Abstand_x)+sqr(abstand_y)));

Abstand ist dann eine Real-Variable.

Hoffentlich hilft dir das!