a small project - triangle with draggable points on a screen

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

a small project - triangle with draggable points on a screen

Sanjay Minni
This post was updated on .
Hi

I have a small project (a real requirement) and I want a little guidance to do it (myself) -
pl. assume I am new to pharo though I can navigate the IDE & have a background in O-O development.

1. Draw a triangle with draggable handles on points
2. The sides length and angles will be displayed (in editable fields)
3. We can lock any of the sides / angles
4. If the side / angle is edited then an action can be initiated to recomplete the triangle by redrawing the side clicked next

Thanks
Sanjay
cheers,
Sanjay
Reply | Threaded
Open this post in threaded view
|

Re: new (learning) project - tiangle with draggable points on a screen

hilaire
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: new (learning) project - tiangle with draggable points on a screen

Ben Coman
In reply to this post by Sanjay Minni
sminni wrote:

> Hi
>
> I have a small project (a real requirement) and I want a little guidance to
> do it (myself) -
> pl. assume I am new to pharo though I can navigate the IDE & have a
> background in O-O development.
>
> 1. Draw a triangle with draggable handles on points
> 2. The sides length and angles will be displayed (in editable fields)
> 3. We can lock any of the sides / angles
> 4. If the side / angle is edited then an action can be initiated to
> recomplete the triangle by redrawing the side clicked next
>
> Thanks
> Sanjay
>
>
>
> -----
> ---
> Regards, Sanjay
> --
> View this message in context: http://forum.world.st/new-learning-project-tiangle-with-draggable-points-on-a-screen-tp4677486.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>
>
>  
Have you read the morph chapter of Pharo By Example ?

Reply | Threaded
Open this post in threaded view
|

Re: new (learning) project - tiangle with draggable points on a screen

stephane ducasse
In reply to this post by Sanjay Minni
Look at PolygonMorph.

Stef

On Mar 20, 2013, at 11:03 AM, sminni <[hidden email]> wrote:

> Hi
>
> I have a small project (a real requirement) and I want a little guidance to
> do it (myself) -
> pl. assume I am new to pharo though I can navigate the IDE & have a
> background in O-O development.
>
> 1. Draw a triangle with draggable handles on points
> 2. The sides length and angles will be displayed (in editable fields)
> 3. We can lock any of the sides / angles
> 4. If the side / angle is edited then an action can be initiated to
> recomplete the triangle by redrawing the side clicked next
>
> Thanks
> Sanjay
>
>
>
> -----
> ---
> Regards, Sanjay
> --
> View this message in context: http://forum.world.st/new-learning-project-tiangle-with-draggable-points-on-a-screen-tp4677486.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>


Reply | Threaded
Open this post in threaded view
|

Re: new (learning) project - tiangle with draggable points on a screen

Sanjay Minni
thanks all for the pinters ... will go thru and start, then continue this thread as may be reqd
Rgds Sanjay
cheers,
Sanjay
Reply | Threaded
Open this post in threaded view
|

Re: new (learning) project - tiangle with draggable points on a screen

S Krish
In reply to this post by Sanjay Minni
There are two ways to approach this problem:

* Spatial

* Vector

Spatial:

  As per the pharo by example pdf, you can create a custom TriangleMorph ( they have a cross ). Add the behavior that you mention to the TriangleMorphWithAttributes that holds the plain triangle morph. So on change to the attributes it will modify the triangle.

  There are challenges to using angle / other geometric approaches in the above, but simple and probably a day's effort. Good for Kid's / early school graphics

  I am not sure but many other contributions, half way done are there which do have some works in this line of thought including one on Kinesthetics with balls that have a gravity like pull etc.. which are quite good enough.

Vector:

 CAD/ Dr. Geo approach: Use a line that makes a Triangle. Perhaps may need to add a surface for color fill also. Typical in CAD is to create a polyline that makes an arbitrary line collection with several points as input. If its closed you can treat it as an arbitrary polygon with recognition of the bounded surface for color fill.

 You will then need to do something similar to above to have custom change shape on attribute changes.

 The offside here is it will be time consuming and will need to use standard vector formulae's for accuracy with sin / cos transformation as you deal with angles.

 If you want this, better be sure about the whole requirement, you might reinvent the Dr. Geo work.. better to study works done in say VW for .dxf reading / display / CAD package completely once before embarking on this route.



On Wed, Mar 20, 2013 at 3:33 PM, sminni <[hidden email]> wrote:
Hi

I have a small project (a real requirement) and I want a little guidance to
do it (myself) -
pl. assume I am new to pharo though I can navigate the IDE & have a
background in O-O development.

1. Draw a triangle with draggable handles on points
2. The sides length and angles will be displayed (in editable fields)
3. We can lock any of the sides / angles
4. If the side / angle is edited then an action can be initiated to
recomplete the triangle by redrawing the side clicked next

Thanks
Sanjay



-----
---
Regards, Sanjay
--
View this message in context: http://forum.world.st/new-learning-project-tiangle-with-draggable-points-on-a-screen-tp4677486.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.


Reply | Threaded
Open this post in threaded view
|

Re: new (learning) project - tiangle with draggable points on a screen

Alain Busser
MathsOntologie may help a bit, too: There is a "TrianglePlein" object which properties are linked to each other by setters; for example, if you change the length of one side, the area will change at the same time.

I found many useful methods of the "point" object, for example the area of a triangle is one of these methods...

Alain

On Thu, Mar 21, 2013 at 9:09 AM, S Krish <[hidden email]> wrote:
There are two ways to approach this problem:

* Spatial

* Vector

Spatial:

  As per the pharo by example pdf, you can create a custom TriangleMorph ( they have a cross ). Add the behavior that you mention to the TriangleMorphWithAttributes that holds the plain triangle morph. So on change to the attributes it will modify the triangle.

  There are challenges to using angle / other geometric approaches in the above, but simple and probably a day's effort. Good for Kid's / early school graphics

  I am not sure but many other contributions, half way done are there which do have some works in this line of thought including one on Kinesthetics with balls that have a gravity like pull etc.. which are quite good enough.

Vector:

 CAD/ Dr. Geo approach: Use a line that makes a Triangle. Perhaps may need to add a surface for color fill also. Typical in CAD is to create a polyline that makes an arbitrary line collection with several points as input. If its closed you can treat it as an arbitrary polygon with recognition of the bounded surface for color fill.

 You will then need to do something similar to above to have custom change shape on attribute changes.

 The offside here is it will be time consuming and will need to use standard vector formulae's for accuracy with sin / cos transformation as you deal with angles.

 If you want this, better be sure about the whole requirement, you might reinvent the Dr. Geo work.. better to study works done in say VW for .dxf reading / display / CAD package completely once before embarking on this route.




On Wed, Mar 20, 2013 at 3:33 PM, sminni <[hidden email]> wrote:
Hi

I have a small project (a real requirement) and I want a little guidance to
do it (myself) -
pl. assume I am new to pharo though I can navigate the IDE & have a
background in O-O development.

1. Draw a triangle with draggable handles on points
2. The sides length and angles will be displayed (in editable fields)
3. We can lock any of the sides / angles
4. If the side / angle is edited then an action can be initiated to
recomplete the triangle by redrawing the side clicked next

Thanks
Sanjay



-----
---
Regards, Sanjay
--
View this message in context: http://forum.world.st/new-learning-project-tiangle-with-draggable-points-on-a-screen-tp4677486.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.