I am dealing with quarter tori as in the image below. My issue is that I need to be able to scale its major radius and minor radius separately using a scale matrix. However, when I use a regular transformation matrix like:

    scaleX, 0, 0, 0,
    0, scaleY, 0, 0,
    0, 0, scaleZ, 0,
    0, 0, 0, 1;

It scales both radiuses. Is there a way I can do this separately? I can't get my head around how this would be possible? Thank you in advance. enter image description here

  • 2
    \$\begingroup\$ No, you can't scale them separately using a transformation matrix. You have to generate new geometry. \$\endgroup\$ – Ocelot Jun 25 at 10:24
  • \$\begingroup\$ Thank you. Unfortunately i must use matrices in this scenario but it is good to know that it is not possible. \$\endgroup\$ – Ali Kanat Jun 25 at 10:57

To my knowledge, this is not possible using a transformation matrix since matrices represent linear transformations and the transformation you are asking for isn't linear. The answer in this SO question comes to the same conclusion.

However, if you are not bound to matrices, one possible way to approach this is as follows:

You calculate the normal vector from the torus center towards each vertex inside the major circle plane (2d subspace). Scaling the major radius is then just translating every vertex by the same amount into the corresponding normal vector direction. Scaling the minor radius is a little bit trickier and you can approach this in several ways. The easiest way I can think of is just picking a random vertex calculate its "major radius" and store it. Now multiply with a regular scaling matrix, which will scale the major and minor radius. Now calculate the new "major radius" of the selected vertex. Determine the difference and undo the scaling into the major radius direction as described before. If you do the minor radius scaling first, you might be able to calculate the difference to the target major radius, which would save you the "undoing step".

As I said before, without being forced to use matrices there are several ways to approach this. The one I described might not be the most elegant and maybe somebody else can show you a better one or you can come up with one yourself.

| improve this answer | |
  • \$\begingroup\$ Unfortunately i am bound to use matrices because of a library i am using. I am modeling the torus myself using circles with different rotations, so it is not an issue to scale without using matrices :( I was thinking perhaps i could open the torus ,using projection, shear with matrices, like a cylinder scale it and then project it back but i dont think it would be possible either. \$\endgroup\$ – Ali Kanat Jun 25 at 10:56
  • 1
    \$\begingroup\$ The projection to a cylinder was also my first idea, but unfortunately, this isn't a linear transformation neither. \$\endgroup\$ – wychmaster Jun 25 at 11:18
  • \$\begingroup\$ Too bad. Thanks for your answers. \$\endgroup\$ – Ali Kanat Jun 25 at 11:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.