elliotf / heekscad

Automatically exported from code.google.com/p/heekscad
0 stars 0 forks source link

Rotation #192

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Trying to do something as trivial as creating three copies of an object
aligned with the three axes reveals multiple bugs.   I tried this with
0.7.0 in various ways, then upgraded to the svn version.

Try to create an object and use "copy rotate" to make copies, one parallel
to X, one Y, and one Z.    I was trying to make three copies of a
simplified (no threads) hex nut, 3/8" across by 7/8" long with a 1/4"
diameter hole (i.e. a 1/4-20 threaded rod coupler).    I needed these on
three orthogonal faces (six actually) of a solid, so I was rotating.   But
you can reproduce some of the problems with a simple cylinder.

First problem, is the polygon tool doesn't take a normal vector.  Even when
you figure out how to use the cumbersome and undocumented interface.  The
program wants a center point and a one corner point.   I.E. 0,0,0 and
0.1875, 0, 0.   Actually, these produce the wrong size since the program
wants the diagonal dimension, not the dimension to the center of the flats
- which is far more likely to be what the user actually needs.   Hexnuts,
standoffs, and hex barstock are all examples where the part is measured
across the flats.   So, you should let the user enter either a
circumscribed or inscribed radius.     And most of the time, it is easier
to enter a radius/diameter and an angle than a corner point.

Second problem is that copy rotate doesn't ask for a normal vector.  It
should ask for a normal vector and an angle.    0,0,1 - rotate about Z,
0,1,0 - rotate about Y, 1,0,0 rotate about X,  x,y,z rotate about vector
specified.

Third problem is that coordinate spaces are broken.    You can't draw three
cylinders about three orthogonal axes, let alone rotate one (or a more
complicated object) about these axes.   One rotation works.  If you specify
vertical angle=90, you get more or less what you expect.   However, if you
specify horizontal angle=90, it replaces it with twist angle=90.   In 0.7.0
(Ubuntu 9.04), if you tried to specify a twist, i think it was, it crashed
the program - i.e. creating three coordinate transforms with the three
different rotations specified 90 degrees in turn, would crash the program.

And it won't let you define the vectors manually.  The two vectors for X
and Y, from a mathematical sense, should be perpendicular and of unit
length because if you are specifying two non-perpendicular vectors the
mathematical result would be a trapezoidal coordinate system.   Not that I
have a burning need for such a coordinate system (they can have some uses,
in other contexts, though, to deskew an image, and could conceivably be
used to transform coordinates measured from an image).   So, ultimately,
three vectors one for each of X,Y, and Z axes with different lengths (which
affect scaling on each axis) could have some merit.     Another mode of
entry is:
   Origin point: 0,0,0
   Plane normal vector: 0,0,1
      (normalize to unit vector so it ignores length)
   X axis rotation vector: 1,0,0   
      (Z should be zeroed to not conflict)
      (normalize to unit vector so it ignores length)
   scale vector: 1.0,1.0,1.0
This defines the normal coordinate system.

But the most common way of dealing with the transforms is a series (order
dependent) of one or more rotate, scale, and translate operations.

Coordinate systems should have a scale.   So you can do, for example,
inch/metric conversion.   And one mode should let you explicitly enter the
affine matrix.

Likewise, for a cylinder:
   Solid/Shell: Solid
   Endcaps: yes (always want these for solid, not always for shell)
   Angular endcaps: yes (relevent for shell if you change start/end)
   Outer Radius: 1
   Inner Radius: 1
   Length: 2
   Normal Vector: 0,0,1
   Start angle: 0
   End angle: 360
   End 1 normal vector: 0,0,1
   End 2 normal vector: 0,0,1
A common operation is to miter cut the ends of a part.   For example, you
might create a square toroid by miter cutting both ends of a cylinder 45
degrees, and creating 4 copies rotated about the center.  You can do this
with CSG, but you shouldn't have to.  It is a pain for the user and
opencascade has to go through all sorts of complicated math to generate the
part, the result of which may have cumulative errors and loses its
abstraction.   If you specify a second pair of radii, you can also define
partial cones.

Original issue reported on code.google.com by mark.whi...@gmail.com on 17 Aug 2009 at 3:45

GoogleCodeExporter commented 9 years ago
It looks like the angles shown are the rotations needed to achieve the required
coordinate system when rotation is in the following order:

Rotate around original Z (Horizontal Angle),
Rotate around new X     (Vertical Angle),
Rotate around new Z      (Twist Angle). 

Could other methods of redefining the system be used; plane normal 
(1.0,1.0,1.0) or
allowing the reuse of "select point on X then Select point in Y+".

Rotation and copy rotation:
I have amended the rotation method to allow a "rotate around a line" function. 
To use
this function ensure "Use 3D rotation" is selected in drawing options. The 
Rotate
function will then ask for a line to rotate about and not a point.

Original comment by bullimor...@tiscali.co.uk on 4 Sep 2009 at 12:33

GoogleCodeExporter commented 9 years ago
Polygon mode added to allow both excribed and inscribed circles to be used when
defining polygons.

The combination of polygon mode and "rotate about line" should help with the 
task
that was reported.

If there are no objections, I will close  this issue.

Original comment by bullimor...@tiscali.co.uk on 4 Sep 2009 at 5:00

GoogleCodeExporter commented 9 years ago

Original comment by jonpry@gmail.com on 25 Sep 2009 at 6:05