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

gEDA-user: Rotations, rotations, rotations.



No! it's not implemented yet.

This is what I have started to implement. Let me know what you think.

Basicly, make everything lug around a vector. This way no rounding errors occur from repeated castings to <int> from PointType.  On rotates, the existing PointType(s) get updated, as they are now, so we don't need to modify anything other then the rotate routines (I think).  All the existing mumbo-jumbo about X1<X2 and all that stuff have no bearing on the vector, so that can be left alone and all the code that depends on that condition can be happy.

Something like this. (Still preliminary)
typedef struct          /* vector for objects and such */
{
        PointType X;
        PointType Y;
        PointType x0;
        PointType y0;
        float angle; /* Radians NOT degrees (math.h reasons)*/
        double lenght;
} vector_t, *vector_t;

the x0,y0 are the origin, and X,Y are the 'normal' X,Y that is delt with everywhere.

==
Elements make a good thought example:
Make everything in the element relative to MarkX,MarkY.

Rotate?  modified rotate routines will calculate new (X,Y)'s relative to MarkX,Y
	Each point in the element is a vector child of MarkX,Y.
	Only need to update MarkX,Y relative to the cursor position. Whenever an element is rotated, all that you need to do is add that rotation angle to all the 'children' of the element and redraw relative to MarkX,Y.

Move it?  the move routines can be left as is.  It will update all X,Y's for all it's parts Including the ever-so-important MarkX,Y. Vectors don't change so Move can use it's existing code with no effect on rotates.
==

Remember, the vectors are parallel to the existing PointType. So everything should work the way it has in the past, But with arbitrary angles :)

Oh Yeah, I need some help on the GUI stuff for it. I was thinking of adding an other button for 'arbitrary' rotations.  Click -> Move mouse = active redraw = -> release.
Or just a :rotateAbitrary(angle in deg).

How'd I do for my first day of looking at the code...
-Lares

Attachment: pgp85hkbUNea9.pgp
Description: PGP signature


_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user