Guru3D.com Forums

Go Back   Guru3D.com Forums > General > Programming/Html
Programming/Html C++,Visual Basic,HTML,Flash,OpenGL,Modelling,Java.


Reply
 
Thread Tools Display Modes
Old
  (#1)
Kennung Eins
Maha Guru
 
Kennung Eins's Avatar
 
Videocard: 9600GT
Processor: Pentium-M 2.27Ghz
Mainboard: AOpen i915GMm-HFS
Memory: 2x1GB GeiL DDR2
Soundcard: integrated RTL HDA
PSU: AcBel Api4Pc01
Default 04-26-2002, 21:31 | posts: 1,619 | Location: C000-CFFF

Ok,<br>
I just need an idea, QUICK...<br>
<br>
Do you know binary search trees?<br>
Do you have an idea how to realize a 2-dimensional binary search tree?<br>
<br>
Normally binary search trees do only compare ONE property, but I need to compare & sort TWO of them...DAMN...<br>
<br>
The reason: imagine a coordinate system.<br>
I have the values (x,y) of different fields within the coordinate system.<br>
Now I need to compare several fields with their (x,y) coordinates.<br>
<br>
I want to use the binary search tree to localize at first (x) and then (y).<br>
<br>
Any idea?<br>
I know, it's difficult...<br>
<br>
BTW: you're helping me with my semester work! <IMG SRC="smileys/smile.gif"><br>
It needs to be finished in 4 days <IMG SRC="smileys/frown.gif"><br><br><i>This message was edited by Kennung Eins on 26 Apr 2002 01:34 PM</i>
   
Reply With Quote
 
Old
  (#2)
Abdul Alhazred
Ancient Guru
 
Abdul Alhazred's Avatar
 
Videocard: TerraTec 5800 Ultra
Processor: Athlon XP 2000+ @ 1.95 GHz
Mainboard: Abit NF7-S
Memory: 1 GB Samsung DDR
Soundcard: SoundBlaster Audigy Platinum EX
PSU:
Default 04-26-2002, 22:17 | posts: 2,726 | Location: kTbc10, Andromeda

I don't know exactly what you're talking about (way above my level of math) and this might sound stupid, but couldn't you first compare the x coordinate and then have another search for the y coordinate, the x now being fixed? That's how I adjust objects in 2D and 3D space. Dunno. <IMG SRC="smileys/confused.gif">
   
Reply With Quote
Old
  (#3)
Kennung Eins
Maha Guru
 
Kennung Eins's Avatar
 
Videocard: 9600GT
Processor: Pentium-M 2.27Ghz
Mainboard: AOpen i915GMm-HFS
Memory: 2x1GB GeiL DDR2
Soundcard: integrated RTL HDA
PSU: AcBel Api4Pc01
Default 04-26-2002, 22:36 | posts: 1,619 | Location: C000-CFFF

Hmm yeah I just thought of this several minutes ago, and now I'm doing it exactly this way.<br>
<br>
When I'd get the other way (if I could get it to work) working then I could definately show-off in front of my professor ;-)
   
Reply With Quote
Old
  (#4)
-ARP-the_anti_christ
 
Videocard:
Processor:
Mainboard:
Memory:
Soundcard:
PSU:
Default 05-02-2002, 09:10 | posts: n/a

hmm.. seems i am late nw, but u tried to get the intersection ??<br>
or what do u mean with vcompare? if their the same? what else could u compare in a 2d area?<br>
are it recs?<br>
anyway tpo late now..<br>
<br>
so how was it? finnished? got it to work?
   
Reply With Quote
 
Old
  (#5)
David
Guru3D PC Buyers Guides
 
Videocard: MSI GeForce GTX 670 OC Ed
Processor: Intel Core i5 3570K
Mainboard: Asus Maximus V Gene
Memory: 16 GB DDR3 1600
Soundcard: X-Fi Titanium HD + HD 595
PSU: Silverstone ST50F-P
Default 05-04-2002, 00:51 | posts: 3,395 | Location: Kansas

If you're using Java, make a Node object which stores the x, y coordinates and then use a seperate key to sort through them.<br>
<br>
1.6 GHz AMD Athlon XP 1900+ @ 1.71 GHz<br>
OCZ Goliath W/ Delta 50 CFM HSF<br>
Epox 8HKA+ Motherboard<br>
512 MB OCZ PC2700 DDR<br>
IBM Deskstar 60GXP 60 GB HD<br>
Gainward GeForce4 Ti4400 @ 300/650<br>
Hercules Game Theater XP<br>
Enermax 451P-VE 431 Watt PS<br>
Antec 1030B Case Modded w/ Dual 120mm blowholes<br>
<br>
Windows XP Pro, Det. 28.80<br>
3DMark2001 Score: 10635<br> <A HREF="http://service.madonion.com/compare?2k1=3242988" TARGET=_blank>http://service.madonion.com/compare?2k1=3242988</A>


One builder to rule them all.
   
Reply With Quote
Old
  (#6)
Kennung Eins
Maha Guru
 
Kennung Eins's Avatar
 
Videocard: 9600GT
Processor: Pentium-M 2.27Ghz
Mainboard: AOpen i915GMm-HFS
Memory: 2x1GB GeiL DDR2
Soundcard: integrated RTL HDA
PSU: AcBel Api4Pc01
Default 05-12-2002, 14:46 | posts: 1,619 | Location: C000-CFFF

<BLOCKQUOTE>quote:<HR>Originally posted by -ARP-the_anti_christ:<br>
<b>hmm.. seems i am late nw, but u tried to get the intersection ??<br>
or what do u mean with vcompare? if their the same? what else could u compare in a 2d area?<br>
are it recs?<br>
anyway tpo late now..<br>
so how was it? finnished? got it to work?</b><HR></BLOCKQUOTE><br>
I wanted to do it the following way:<br>
<br>
I have an object which has coordinates (int x,int y) included.<br>
You know how a search Tree works?<br>
Let's say you have the numbers 8,5,4,9,6<br>
it does it this way:<br>

<br>
-At 1st it takes the 8, puts it into the root.<br>
-Then it takes the 5, puts it left of the 8, becasuse it's smaller than the 8.<br>
-Takes the 4, puts it left of the 8, left of the 5, because it's smaller than 8 and 5.<br>
-takes the 9, puts it right of the 8 because its bigger than 8<br>
-takes the 6, puts it left of the 8, right of the five because it's smaller then 8 but bigger than 5<br>
<br>
But now I wanted to have a tree that does not save entries with only one dimension, but two.<br>
Now tell me: How can I use a binary search tree to compare these elements (just some examples):<br>
(8,2),(12,33),(1,1),(8,9),(5,11)<br>
Is this possible?<br>
<br>
Or should I need 2 search trees, one for the (x)-Element and one for the (y) element, while each (x)-Element has an own tree of the (y) elements?<br><br><i>This message was edited by Kennung Eins on 12 May 2002 06:47 AM</i>

Last edited by Kennung Eins; 04-26-2010 at 20:11.
   
Reply With Quote
Old
  (#7)
Kennung Eins
Maha Guru
 
Kennung Eins's Avatar
 
Videocard: 9600GT
Processor: Pentium-M 2.27Ghz
Mainboard: AOpen i915GMm-HFS
Memory: 2x1GB GeiL DDR2
Soundcard: integrated RTL HDA
PSU: AcBel Api4Pc01
Default 05-12-2002, 14:51 | posts: 1,619 | Location: C000-CFFF

<BLOCKQUOTE>quote:<HR>Originally posted by DarkWeasel:<br>
<b>If you're using Java, make a Node object which stores the x, y coordinates and then use a seperate key to sort through them.</b><HR></BLOCKQUOTE>I noticed I could do it much easier than with a search tree.<br>
I just used a simple double linked list to store all the elements and then just searched for the element I wanted to find. If it was not included then this was enough for me to know.<br>
   
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com
Copyright (c) 1995-2012, All Rights Reserved. The Guru of 3D, the Hardware Guru, and 3D Guru are trademarks owned by Hilbert Hagedoorn.