Re: rotation aadlport



hi

Lars Clausen wrote:
On Thu, 2006-11-16 at 18:29 +0100, Andreas Owen wrote:

Hi Lars

sorry for not writing this to the mailing-list. i'm getting desparate because time is nearly up in school. so i thought i could mail you directly because i missed the 6 oclock maillist.


The mailing list does not run on a fixed schedule, I guess you're just
getting it as a daily digest rather than as-they-come.  If you're really
in a hurry, getting mailing list mails as individual mails and then
asking there is bound to be faster.


I was wondering how i could get the method draw_in_data_port() to draw a square instead of a triangle. i've succeeded in that but the rotation doesn't work.

i allways thougt that you have to translate o object to 0/0 then rotate like in rotate_around_origin() and reverse the translation again.


If you're only trying to do 90 degrees rotation, you can avoid the
sin/cos relations entirely and just swap x/y and signs.  But I can't see
what your angles can be.  I *think* your rotation function is correct.
sounds good but that give me 2 side changes, i need 1.
for examle:
        given: a square abcd (clockwies points of square)
        after rotation: dabc
thas a counter clockwise rotation (point moves one position in square).


in the moment the port is only drawn when it's on the right side of the shape. if i change p[0] and p[1] in draw_in_data_port() i can get i running on diffrent sides of the shape:
        p[0].x = +
        p[0].y = +
        p[1].x = -
        p[1].y = -
                -> shows on left side
        p[0].x = +
        p[0].y = -
        p[1].x = -
        p[1].y = +
                -> shows on top side
        p[0].x = -
        p[0].y = +
        p[1].x = +
        p[1].y = -
                -> shows on buttom side


So... what is your question?


Oh, a tip:  Long macros are a really bad idea.  Use functions liberally.
it's a give example that contains most of the functionality i need. my c-sqills are bad :-( so i'll not try and make a new lib.

-Lars



thanks andi



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]