The Interactive Geometry Software Cinderella

Forum: Cinderella Support (E)

Forums->Cinderella Support (E)->Help with Polygons

johnrpo
3 stars
Help with Polygons


Dear all,

I am using Cinderella for kinematic modelling of mechanisms. I have a problem I cannot solve (easily).

i) I need to be able to attach a polygon to any link in a mechanism (e.g to the link in the middle in the example of the 3 bar mechanism. The polygon would rotate and translate with such link

ii) I need the user to be able to add a point to this polygon (e.g. by dropping a point on one edge of the polygon. For instance, dropping a point on a line and dragging it outside of the line would draw a triangle, dropping a point on one of the edges of the triangle would draw a 4 sided polygon, etc.

The reason for this is that we need to be able to draw links in the mechanism as polygons with any geometry (not just lines connecting two points).

I currently do this by "hand" by e.g. drawing two circles at the end of each point in the link and finding their intersection. This works fine if the polygon is a triangle, but not if is is a random polygon.

I have noticed that the edges of polygons have no identifiers, and it is difficult to find out if a point is inside a polygon. Perhaps a pointinpolygon function can be added in the future?

Anyway, if any of you can help me solve the problem of (easily) attaching a (random, not regular) polygon to a link that rotates and translates, that´d be a great help. The other behaviour is a "desired" behaviour.

Regards,

John Restrepo

P.S.
Great software, by the way!




 
on: Sun 25 of Oct, 2009 [16:26 UTC] reads: 115362

Posted messages

author message
Re: Help with Polygons
on: Thu 19 of Nov, 2009 [11:40 UTC]
Dear John,

those issues you are mentioning are exactly the reasons why Bases are "unfinished" - you can use them, but there are some issues and you might not be able to load the files again.

Also, the createpoint function does not honor the basis set by the setbasis function - it is just not supported.

Ulli


author message
Aw: Help with Polygons
on: Mon 09 of Nov, 2009 [11:21 UTC]
Dear John,

the easiest way to do this is to use a different base for the free points defining the polygon - actually, this functionality was designed exactly for this purpose. But - unfortunately this is broken; this means, while you can work with custom bases, the files that contain them may not be loadable again, and thus we disabled this feature in the standard configuration.

Now that you request it we will have to fix it - we will try to include it in the upcoming release 2.1 (see http://beta.cinderella/public ) for the quite stable beta releases.

Ulli


author message
johnrpo
3 stars
Re: Aw: Help with Polygons
on: Thu 12 of Nov, 2009 [09:53 UTC]
Dear Ulli,

Thanks for your response. I had already figured that out.
> ... unfortunately this is broken; this means, while you can work with custom bases, the files that contain them may not be loadable again, and thus we disabled this feature in the standard configuration.

I have been able to use them, so they are either not disabled or we are talking about something different.

I see now a couple of issues that are important.

- I can create a base using points B&D in the three bar example, selecting this base would make all the elements drawn after displace and rotate with the coupler in the mechanism as expected

- An element´s base cannot be redefined. The element has to be deleted and re-created with the correct base selected. I´d be easier if elements coule be mapped to bases in the same way they can be mapped to transformations. This way i´d be easier to re-definedthem in case of mistakes.

- the behaviour of an element that hs been drawn by hand (with the correct base selected) cannot be replicated in cindyscript. e.g. I´d expect the point E to move with the coupler in the three link example using this code:

gsave();
setbasis(B,D);
createpoint("E", 2,3);
grestore();

In this case, the point is not "mapped" to the basis BD. Did I get it wrong?

Regards,

John






Show posts:
 
Language