ball tree algorithm

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

ball tree algorithm

lhhuong
I want to create a form to draw some balls that calculated from ball-tree algorithm. i dont know how to start or implement that structure.
Help me.
Reply | Threaded
Open this post in threaded view
|

Re: ball tree algorithm

davidbuck
You'll need a custom view for that.  In the UI Painter, you'll find a
"View Holder" which you can use.  To use it, you'll need to write your
own View class.  In the "Toys" category of the Parcel Manager, you'll
find a game called Spider Solitaire.  This game uses a custom View and a
custom Controller. You can use that as an example on how to do it.

Good luck.
David Buck
Simberon Incorporated

On 2013-11-19 10:51 PM, lhhuong wrote:

> I want to create a form to draw some balls that calculated from ball-tree
> algorithm. i dont know how to start or implement that structure.
> Help me.
> <http://forum.world.st/file/n4723584/ball_tree.png>
>
>
>
> --
> View this message in context: http://forum.world.st/ball-tree-algorithm-tp4723584.html
> Sent from the VisualWorks mailing list archive at Nabble.com.
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: ball tree algorithm

Holger Kleinsorgen
In reply to this post by lhhuong
lhhuong wrote
I want to create a form to draw some balls that calculated from ball-tree algorithm. i dont know how to start or implement that structure.
Help me.
Roassal might be interesting for you:
http://objectprofile.com/#/pages/products/roassal/overview.html
Reply | Threaded
Open this post in threaded view
|

Re: ball tree algorithm

jarober
In reply to this post by davidbuck
In the examples (loadable from the parcel manager) there is also a simple custom view example that should help you see what you have to do.

On Nov 20, 2013, at 5:24 AM, David Buck <[hidden email]> wrote:

> You'll need a custom view for that.  In the UI Painter, you'll find a "View Holder" which you can use.  To use it, you'll need to write your own View class.  In the "Toys" category of the Parcel Manager, you'll find a game called Spider Solitaire.  This game uses a custom View and a custom Controller. You can use that as an example on how to do it.
>
> Good luck.
> David Buck
> Simberon Incorporated
>
> On 2013-11-19 10:51 PM, lhhuong wrote:
>> I want to create a form to draw some balls that calculated from ball-tree
>> algorithm. i dont know how to start or implement that structure.
>> Help me.
>> <http://forum.world.st/file/n4723584/ball_tree.png>
>>
>>
>>
>> --
>> View this message in context: http://forum.world.st/ball-tree-algorithm-tp4723584.html
>> Sent from the VisualWorks mailing list archive at Nabble.com.
>> _______________________________________________
>> vwnc mailing list
>> [hidden email]
>> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>>
>
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

James Robertson
http://www.jarober.com
[hidden email]




_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: ball tree algorithm

lhhuong
In reply to this post by davidbuck
Hi, I created a custom view UI and i loaded a google map into that. i have a set of points stored in gpx file(XML format) with lon-lat coordinate.
I read gpx file and store all points in to an array. how to sort that array?
Reply | Threaded
Open this post in threaded view
|

Re: ball tree algorithm

Maarten Mostert-2
There is a sorted: method higher up in the hierarchy
@+Maarten

Le 23 nov. 2013 à 08:50, lhhuong <[hidden email]> a écrit :

> Hi, I created a custom view UI and i loaded a google map into that. i have a
> set of points stored in gpx file(XML format) with lon-lat coordinate.
> I read gpx file and store all points in to an array. how to sort that array?
>
>
>
> --
> View this message in context: http://forum.world.st/ball-tree-algorithm-tp4723584p4724485.html
> Sent from the VisualWorks mailing list archive at Nabble.com.
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: ball tree algorithm

jarober
In reply to this post by lhhuong
If you look in the collection class hierarchy, you'll find your answer

On Nov 23, 2013, at 2:50 AM, lhhuong <[hidden email]> wrote:

> Hi, I created a custom view UI and i loaded a google map into that. i have a
> set of points stored in gpx file(XML format) with lon-lat coordinate.
> I read gpx file and store all points in to an array. how to sort that array?
>
>
>
> --
> View this message in context: http://forum.world.st/ball-tree-algorithm-tp4723584p4724485.html
> Sent from the VisualWorks mailing list archive at Nabble.com.
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

James Robertson
http://www.jarober.com
[hidden email]




_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: ball tree algorithm

Steven Kelly
Re: [vwnc] ball tree algorithm
You could also try looking in the manuals: 210 occurrences of that term...
 
Or then Google: Smalltalk sort array
 
You're going to need to think for yourself to decide what the correct order of an array of points is: latitude before longitude? Try the last answer here once you've decided:
 
Steve

From: [hidden email] on behalf of James Robertson
Sent: Sat 23/11/2013 17:17
To: VWNC NC
Subject: Re: [vwnc] ball tree algorithm

If you look in the collection class hierarchy, you'll find your answer

On Nov 23, 2013, at 2:50 AM, lhhuong <[hidden email]> wrote:


> Hi, I created a custom view UI and i loaded a google map into that. i have a
> set of points stored in gpx file(XML format) with lon-lat coordinate.
> I read gpx file and store all points in to an array. how to sort that array?
>
>
>
> --
> View this message in context: http://forum.world.st/ball-tree-algorithm-tp4723584p4724485.html
> Sent from the VisualWorks mailing list archive at Nabble.com.
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

James Robertson
http://www.jarober.com
[hidden email]




_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: ball tree algorithm

lhhuong
In reply to this post by lhhuong
Thank all.
I have an array store some points(x@y).
obj:= Array new:5.
col:= obj asSet asOrderedCollection.

the code as above will sort the array with y coordinate.

I want to sort array that with x coordinate or y coordinate.
What should i do?
Reply | Threaded
Open this post in threaded view
|

Re: ball tree algorithm

Holger Guhl
Let "points" be the variable holding your points. The solution is
    points asSortedCollection
This returns a SortedCollection with the default sort rule, i.e. "a < b". Since Point has the method #< (less than), the SortedCollection can compare each of your points directly. If you want to sort by y only, you should code
    points asSortedCollection: [:point1 :point2 | point1 y < point2 y]
This sorts by y ascending. The block always expresses the mathematical sort relation and the direction. If the block evaluates to true, then the first argument is sorted towards front/left end, if it evaluates to false, then it goes towards right end of the sorted collection.
Two remarks:
  1. Your first line "obj asSet asOrderedCollection" does not sort your points. If the result appears sorted, then this is by pure chance.
  2. Do you know that #asSet removes duplicates in order to meet the mathematical requirement? Example: "(Array with: 1@1 with: 1@1) asSet size = 1"
Regards
Holger

Am 26.11.2013 11:07, schrieb lhhuong:
Thank all.
I have an array store some points(x@y).
*obj:= Array new:5.
col:= obj asSet asOrderedCollection.
*
the code as above will sort the array with y coordinate.

I want to sort array that with x coordinate or y coordinate.
What should i do?




--
View this message in context: http://forum.world.st/ball-tree-algorithm-tp4723584p4725278.html
Sent from the VisualWorks mailing list archive at Nabble.com.
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: ball tree algorithm

Vincent Lesbros-2
asOrderedCollection / asSortedCollection




2013/11/26 Holger Guhl <[hidden email]>
Let "points" be the variable holding your points. The solution is
    points asSortedCollection
This returns a SortedCollection with the default sort rule, i.e. "a < b". Since Point has the method #< (less than), the SortedCollection can compare each of your points directly. If you want to sort by y only, you should code
    points asSortedCollection: [:point1 :point2 | point1 y < point2 y]
This sorts by y ascending. The block always expresses the mathematical sort relation and the direction. If the block evaluates to true, then the first argument is sorted towards front/left end, if it evaluates to false, then it goes towards right end of the sorted collection.
Two remarks:
  1. Your first line "obj asSet asOrderedCollection" does not sort your points. If the result appears sorted, then this is by pure chance.
  2. Do you know that #asSet removes duplicates in order to meet the mathematical requirement? Example: "(Array with: 1@1 with: 1@1) asSet size = 1"
Regards
Holger

Am 26.11.2013 11:07, schrieb lhhuong:
Thank all.
I have an array store some points(x@y).
*obj:= Array new:5.
col:= obj asSet asOrderedCollection.
*
the code as above will sort the array with y coordinate.

I want to sort array that with x coordinate or y coordinate.
What should i do?




--
View this message in context: http://forum.world.st/ball-tree-algorithm-tp4723584p4725278.html
Sent from the VisualWorks mailing list archive at Nabble.com.
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc



_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: ball tree algorithm

lhhuong
In reply to this post by Holger Guhl
I have an example as below:
*obj:= SortedCollection new:3.
obj add: 7@5.
obj add: 2@4.
obj add: 25@1.
obj asSortedCollection:[
        :point1 :point2 | point1 x < point2 x.
].
Transcript cr.
Transcript show: (obj ) printString.*

and the result: *SortedCollection (25 @ 1 2 @ 4 7 @ 5)*

The collection does not sort by x.



--
View this message in context: http://forum.world.st/ball-tree-algorithm-tp4723584p4725539.html
Sent from the VisualWorks mailing list archive at Nabble.com.
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: ball tree algorithm

lhhuong
In reply to this post by Vincent Lesbros-2
Thank all.
It work by using OrderedCollection sort:
Reply | Threaded
Open this post in threaded view
|

Re: ball tree algorithm

Karsten Kusche
In reply to this post by lhhuong
when you send #asSortedCollection: the result is a new sorted collection. You printed the original sorted collection and it used the default sort-block.

If you want to use a SortedCollection you can create it via SortedCollection sortBlock:[:a :b | a x < b x].
If you then add objects to it, the collection will always sort itself.
You can also start by creating some other collection and sort it later, using the #sorted: method. #sorted: will also return a new collection. If you call #sort: on a collection it’ll try to sort the collection itself (that may work on OrderedCollections and Arrays).

Personally i’ve never used a SortedCollection and just took whatever i had at hand and sent #sorted: at the end of it.

Instead of using sort-blocks i encourage you to try sort functions, they’re a lot easier to understand.
For sorting the points you can also use aCollection sorted:#x ascending. To combine sort-functions you can simply use the #, method. You can also use single-argument blocks instead of symbols like:

aCollectionOfPoints sorted:#x ascending , [:point | point y * point r] descending.

Kind Regards
Karsten

-- 
Karsten Kusche - Dipl. Inf. (FH) - [hidden email]
Georg Heeg eK - Köthen
Handelsregister: Amtsgericht Dortmund A 12812 

Am Mittwoch, 27. November 2013 um 11:11 schrieb lhhuong:

I have an example as below:
*obj:= SortedCollection new:3.
obj add: 7@5.
obj add: 2@4.
obj add: 25@1.
obj asSortedCollection:[
:point1 :point2 | point1 x < point2 x.
].
Transcript cr.
Transcript show: (obj ) printString.*

and the result: *SortedCollection (25 @ 1 2 @ 4 7 @ 5)*

The collection does not sort by x.



--
Sent from the VisualWorks mailing list archive at Nabble.com.
_______________________________________________
vwnc mailing list


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: ball tree algorithm

David Buck-2
In reply to this post by lhhuong
Use sortBlock: instead of asSortedCollection:

David Buck


Simberon Incorporated
www.simberon.com




-------- Original message --------
From: lhhuong <[hidden email]>
Date: 11-27-2013 5:11 AM (GMT-05:00)
To: [hidden email]
Subject: Re: [vwnc] ball tree algorithm


I have an example as below:
*obj:= SortedCollection new:3.
obj add: 7@5.
obj add: 2@4.
obj add: 25@1.
obj asSortedCollection:[
:point1 :point2 | point1 x < point2 x.
].
Transcript cr.
Transcript show: (obj ) printString.*

and the result: *SortedCollection (25 @ 1 2 @ 4 7 @ 5)*

The collection does not sort by x.



--
View this message in context: http://forum.world.st/ball-tree-algorithm-tp4723584p4725539.html
Sent from the VisualWorks mailing list archive at Nabble.com.
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc