Roassal question

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

Roassal question

wernerk
Hi,
i have a little problem, where i think roassal could perhaps be
helpfull, but i have to admit this is the very first time i looked into
roassal, hence i have a stupid question:
i have a collection of something like rectangles, lets say:
coll:=Array with: (Rectangle origin: 500@500 corner: 510@520) with:
(Rectangle origin: 505@504 corner: 511@522).
now i want to produce a graph that shows these rectangles together with
the x & y axis that show their positions (in a sensible way). any simple
hints how i could go about this task?
werner

Reply | Threaded
Open this post in threaded view
|

Re: Roassal question

Pierre Chanson
Hi Werner,

With this I get my two Rectangles shapes in a view with their positions printed in popup.

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
view := RTView new.

coll:=Array with: (Rectangle origin: 500@500 corner: 510@520) with: (Rectangle origin: 505@504 corner: 511@522).

"Some colors"
n := RTMultiLinearColorForIdentity new objects: (coll).

"Integrating elements to the view"
coll do: [ :r | view add: ((RTBox new color: [ :value | n rtValue: r]; width: r width; height: r height) elementOn: r )].

"Moving elements to their position and add a popup to show the position"
view elements do: [ :e | e translateTo: e model center; @ (RTPopup text: [:el | el center])].

view inspect
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

But about the axis, the idea would be to have axis from 0@0 or axis that are placed near your elements ?
Using RTGrapher you can integrate axis easily that are placed for your datas, but if we want particular axis to go in this view we will have to use RTAxisConfiguration and RTAxisRenderer.


Pierre

2015-02-14 11:15 GMT-03:00 Werner Kassens <[hidden email]>:
Hi,
i have a little problem, where i think roassal could perhaps be helpfull, but i have to admit this is the very first time i looked into roassal, hence i have a stupid question:
i have a collection of something like rectangles, lets say:
coll:=Array with: (Rectangle origin: 500@500 corner: 510@520) with: (Rectangle origin: 505@504 corner: 511@522).
now i want to produce a graph that shows these rectangles together with the x & y axis that show their positions (in a sensible way). any simple hints how i could go about this task?
werner


Reply | Threaded
Open this post in threaded view
|

Re: Roassal question

wernerk
On 02/16/2015 05:18 PM, Pierre CHANSON wrote:
> But about the axis, the idea would be to have axis from 0@0 or axis that
> are placed near your elements ?
> Using RTGrapher you can integrate axis easily that are placed for your
> datas, but if we want particular axis to go in this view we will have to
> use RTAxisConfiguration and RTAxisRenderer.

Thank you Pierre.
yes, the axis' should be placed near the elements eg at 500@500. i
thought i could use one of the builders - like eg in the scatter plot
examples, so that everything would be scaled automatically; but if this
is not possible, may i ask, whether you have some hints how to use
RTAxisConfiguration and RTAxisRenderer? it seems i have to delve further
into roassal than i initially thought <g>.
werner

Reply | Threaded
Open this post in threaded view
|

Re: Roassal question

Pierre Chanson

2015-02-16 14:05 GMT-03:00 Werner Kassens <[hidden email]>:
everything would be scaled automatically


Yes I see now what you would like, the idea would be to place an X and Y axis around a collection of RTElements in a view.
So I integrated a RTAxisAdaptedBuilder in the last version of Roassal2 for that.

The RTAxisAdaptedBuilderExample>>example2 would correspond to your rectangles problem. I just changed for now the size of the rectangles because my axis don't yet adapt to small rectangle size (and it does not look nice).

There is still some work to do on this Builder to make it efficient, like to choose wher to place the axis, the numbers of thicks or labels that I did not made yet.

But like this you can easily browse the code to see how I used RTAxisConfiguration and Renderer (not yet very well use I have to admit), and we can discuss of how could we make it work as you want.

Pierre



RTAxisAdaptedBuilder.png (10K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Roassal question

wernerk
Hi Pierre,
wow, you see me really impressed! yes, that is <g> what i was looking
for, i see in your picture that it is possible to use floats, not only
integers, exactly what i would need. i suppose i can also use rectangles
that are not quadratic? i will go on vacation tomorrow and will be back
in a week, hence trying out everything will have to wait for a moment,
but i'd guess this is exactly what i need.
> So I integrated a RTAxisAdaptedBuilder in the last version of Roassal2
> for that.
>
> The RTAxisAdaptedBuilderExample>>example2 would correspond to your
> rectangles problem. I just changed for now the size of the rectangles
> because my axis don't yet adapt to small rectangle size (and it does not
> look nice).
i do have some extremely small rectangles (iow i have to check how these
things are displayed) mixed with bigger ones, but they are dispersed
over a bigger region or hull, iow this would generally not be a problem
for the axis scale.
Thank you very much, i am sincerely impressed
werner

Reply | Threaded
Open this post in threaded view
|

Re: Roassal question

Pierre Chanson
Thank you very much Werner ! :) actually it's not complicated at all, based on some other builders.

But I realized how it can be useful as I really sometime need to see where some elements of my view are (and not in a relative position to one origin. Even if the position is relative to the canvas at least ^^). Having a quick look without placing popups or having to inspect elements.
Maybe it can be used just during the elaboration of a layout for some or all the elements.

I guess it's is working with any shapes,
but it's ok if you go on holidays so I can take some time to improve it.
The size of the thicks and the axis width can be set by default in proportion of the bigger element maybe, and it would be interesting to really have the shape and position of axis or number of them you want to, easily definable.

Have a good vacations,

Pierre



> On 16 févr. 2015, at 7:36 PM, Werner Kassens <[hidden email]> wrote:
>
> Hi Pierre,
> wow, you see me really impressed! yes, that is <g> what i was looking for, i see in your picture that it is possible to use floats, not only integers, exactly what i would need. i suppose i can also use rectangles that are not quadratic? i will go on vacation tomorrow and will be back in a week, hence trying out everything will have to wait for a moment, but i'd guess this is exactly what i need.
>> So I integrated a RTAxisAdaptedBuilder in the last version of Roassal2
>> for that.
>>
>> The RTAxisAdaptedBuilderExample>>example2 would correspond to your
>> rectangles problem. I just changed for now the size of the rectangles
>> because my axis don't yet adapt to small rectangle size (and it does not
>> look nice).
> i do have some extremely small rectangles (iow i have to check how these things are displayed) mixed with bigger ones, but they are dispersed over a bigger region or hull, iow this would generally not be a problem for the axis scale.
> Thank you very much, i am sincerely impressed
> werner
>

Reply | Threaded
Open this post in threaded view
|

Re: Roassal question

wernerk
Hi Pierre,
i still have a problem since i can't place my RTBoxes at the position i
need them to be. obviously they dont understand #translate: or
#translateTo: like the things in TRCanvas. is there a way around this
restriction?
werner


Reply | Threaded
Open this post in threaded view
|

Re: Roassal question

wernerk
Hi Pierre,
perhaps i should show what i intend to do, i attached a screenshot and i
would like to have the axis' on the picture to the right.

On 02/23/2015 04:38 PM, Werner Kassens wrote:
> Hi Pierre,
> i still have a problem since i can't place my RTBoxes at the position i
> need them to be. obviously they dont understand #translate: or
> #translateTo: like the things in TRCanvas. is there a way around this
> restriction?
> werner
>
>
>

PharoScreenshot.png (165K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Roassal question

Pierre Chanson
Hi Werner,

yes the builder is not made to work for Tracher canvas and Trachel shapes because in a builder we use methods that can be understood by an RTView and RTShape etc.

Why don't you use an RTView and RTBox ? so you can use directly the builder with view elements as objects ?

I am not sure to understand your problem because to me you can always create any desired boxes using  RTBox new width:y; height:x then place them with #translateTo: or #translateBy:

It would be much more interesting as you can then treat your objects elements in the view with their model contents and not only shapes in an TRCanvas.

Pierre



2015-02-23 16:04 GMT-03:00 Werner Kassens <[hidden email]>:
Hi Pierre,
perhaps i should show what i intend to do, i attached a screenshot and i would like to have the axis' on the picture to the right.


On 02/23/2015 04:38 PM, Werner Kassens wrote:
Hi Pierre,
i still have a problem since i can't place my RTBoxes at the position i
need them to be. obviously they dont understand #translate: or
#translateTo: like the things in TRCanvas. is there a way around this
restriction?
werner




Reply | Threaded
Open this post in threaded view
|

Re: Roassal question

wernerk
On 02/23/2015 09:01 PM, Pierre CHANSON wrote:
> Why don't you use an RTView and RTBox ? so you can use directly the
> builder with view elements as objects ?
>
> I am not sure to understand your problem because to me you can always
> create any desired boxes using  RTBox new width:y; height:x then place
> them with #translateTo: or #translateBy:

Hi Pierre,
that is exactly the problem i have <embarrassed grin>, RTBox does not
understand  #translateTo: or #translateBy:
a:=RTBox new .
a translateTo: 1@2.-->Error:MessageNotUnderstood
iow at which point exactly do i apply #translateTo: ?
werner

Reply | Threaded
Open this post in threaded view
|

Re: Roassal question

Peter Uhnak

that is exactly the problem i have <embarrassed grin>, RTBox does not understand  #translateTo: or #translateBy:
a:=RTBox new .
a translateTo: 1@2.-->Error:MessageNotUnderstood
iow at which point exactly do i apply #translateTo: ?
 
That's because RTBox is just a shape, and shape doesn't have position. You need to apply it to an element (RTElement).
 

Reply | Threaded
Open this post in threaded view
|

Re: Roassal question

wernerk
ahh, yes understood, now things work as i want them to work!
thank you,
werner

On 02/23/2015 11:02 PM, Peter Uhnák wrote:

>
>     that is exactly the problem i have <embarrassed grin>, RTBox does
>     not understand  #translateTo: or #translateBy:
>     a:=RTBox new .
>     a translateTo: 1@2.-->Error:__MessageNotUnderstood
>     iow at which point exactly do i apply #translateTo: ?
>
> That's because RTBox is just a shape, and shape doesn't have position.
> You need to apply it to an element (RTElement).
>

Reply | Threaded
Open this post in threaded view
|

Re: Roassal question

Pierre Chanson
Ah yes exactly, I was not explaining it correctly as I am so used to it, sorry

But it is good now, by the way I am interested in how you did this Werner, actually if it would be an easy and simple algorithm to fill a defined circle for example like a mesher.

Cheers,

Pierre



> On 23 févr. 2015, at 7:35 PM, Werner Kassens <[hidden email]> wrote:
>
> ahh, yes understood, now things work as i want them to work!
> thank you,
> werner
>
>> On 02/23/2015 11:02 PM, Peter Uhnák wrote:
>>
>>    that is exactly the problem i have <embarrassed grin>, RTBox does
>>    not understand  #translateTo: or #translateBy:
>>    a:=RTBox new .
>>    a translateTo: 1@2.-->Error:__MessageNotUnderstood
>>    iow at which point exactly do i apply #translateTo: ?
>>
>> That's because RTBox is just a shape, and shape doesn't have position.
>> You need to apply it to an element (RTElement).
>

Reply | Threaded
Open this post in threaded view
|

Re: Roassal question

wernerk
On 02/24/2015 01:51 AM, Pierre Chanson wrote:
> by the way I am interested in how you did this Werner,
> actually if it would be an easy and simple algorithm to fill a defined circle for example like a mesher.

Hi Pierre,
it is just a not-yet-ready half-baked implementation of
interval-arithmetic, i intend to use for some constrained optimization
problems; essentially only a proof of concept thing as it does not take
floating point errors into account, iow it does not guarantee that the
true result is included in the interval. i dont know what a mesher is,
but if you want to fill a circle or so with something like eg pixels,
there exist far more efficient solutions than using such an extremely
stupid general algo. while i need multidimensional algos - the
two-dimensional case is just a simple test-example -, for
two-dimensional geometric problems of any kind there practically always
exist simpler faster solutions than for the multidimensional version.
werner

Reply | Threaded
Open this post in threaded view
|

Re: Roassal question

abergel
In reply to this post by wernerk
Cool picture :-)

Alexandre


> On Feb 23, 2015, at 4:04 PM, Werner Kassens <[hidden email]> wrote:
>
> Hi Pierre,
> perhaps i should show what i intend to do, i attached a screenshot and i would like to have the axis' on the picture to the right.
>
> On 02/23/2015 04:38 PM, Werner Kassens wrote:
>> Hi Pierre,
>> i still have a problem since i can't place my RTBoxes at the position i
>> need them to be. obviously they dont understand #translate: or
>> #translateTo: like the things in TRCanvas. is there a way around this
>> restriction?
>> werner
>>
>>
>>
> <PharoScreenshot.png>

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.




Reply | Threaded
Open this post in threaded view
|

Re: Roassal question

Pierre Chanson
Alright thank you for the explanations yes it looks nice :)

2015-02-24 12:27 GMT-03:00 Alexandre Bergel <[hidden email]>:
Cool picture :-)

Alexandre


> On Feb 23, 2015, at 4:04 PM, Werner Kassens <[hidden email]> wrote:
>
> Hi Pierre,
> perhaps i should show what i intend to do, i attached a screenshot and i would like to have the axis' on the picture to the right.
>
> On 02/23/2015 04:38 PM, Werner Kassens wrote:
>> Hi Pierre,
>> i still have a problem since i can't place my RTBoxes at the position i
>> need them to be. obviously they dont understand #translate: or
>> #translateTo: like the things in TRCanvas. is there a way around this
>> restriction?
>> werner
>>
>>
>>
> <PharoScreenshot.png>

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.