DarwinNE/FidoCadJ

Rotating objects

Closed this issue · 3 comments

JoopN commented

When you drag an object from the lib to your drawing area you can rotate it with 90 degrees increments. Is it possible to enhance this feature within the standard to more positions like 45 degrees steps or like with text you have to fill in a number between 0 and 360. I had several lib items which had to be in 45 degree angle and it turned out that this is not easy to do.

The problem for this is that the coordinate system is not precise enough to rotate objects by an arbitrary angle. I'd like to increase the precision of the coordinates, but that would be a huge work that I do not have the courage to start. A big deal would be to maintain backward compatibility!

JoopN commented

Okay, by an arbitrary angle is for me everything. Would it be easier if you took angles by 15 degrees. So 0, 15, 30, 45, 60, 75, 90, 105, 120, 135, 150, 165, 180 and so on up to 360? So the rotating angle is the same 15 degrees, and you can multiply that.
Backward compatibility is already build in with in the settings "Strict FidoCAD compatibility", so I don't see any problems for moving on within the philosophy of FidoCad.

Hello,
the problem remains difficult to solve as the coordinate system is based on integer numbers.
Rotation involves calculation of sines and cosines and they yield irrational numbers for many common angles. If the coordinates are rounded off, the shape of the components will be deformed. This will be visible for small components such as those in the library for schematic.
Basically a rotation by an arbitrary angle would become possible only if the whole coordinate system is based on floating point (or fixed point) numbers. This requires to take some decisions so that the output files will remain compact in most situation where the additional precision is not required.

As a partial workaround, it is possible to draw manually and define symbols that are rotated and use those. For instance the EY library contains a diode drawn with an axis oriented 45° with respect to the horizontal:

[FIDOCAD]
MC 45 25 0 0 ey_libraries.didid1