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 <[email protected]> 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 via email to