I understand the 3D graphics Delphi GLScene. I am trying to turn the cube around my face.

The rotation around its axis is realized simply

GlCube1.Pitch(deltatime*10); GlCube1.Turn(deltatime*10); GlCube1.Roll(deltatime*10); 

Rummaged in the functions: presumably this can be done using

 procedure TGLBaseSceneObject.RotateAbsolute(const axis: TAffineVector; angle: Single); 

Could not figure it out. Am I on the right path? Or are there other ways?

  • Can anyone explain to me what it means to "turn around the edge"? - Igor
  • @Igor I understood this as "the axis of rotation belongs to the face of a cube." - Viktor Tomilov
  • @ViktorTomilov so good. How, then, is this different from turning around any other arbitrary axis? - Igor
  • 2
    @Igor To rotate around any arbitrary axis, we cannot use these three simple methods that the author referred to. In fact, we have to do a coordinate system shift. In order not to suffer from recalculations (and in the rotation functions cylindrical and spherical models are used rather than Cartesian), it is easier to use the DummyCube, which will shift the coordinate system to the desired value, and then simply apply Pitch, Turn or Roll, but to it, and not to our GlCube1. - Viktor Tomilov

1 answer 1

Unfortunately, it’s impossible to install GLScene on my machines now. I am writing from memory.
In this case, the declaration of the DummyCube object to the position you need is used - for example, to coordinates (0,0,0). DummyCube is transparent, but the same rotation operations can be performed with it. In it, you already place your own opaque cube GlCube1 so that the face around which you are going to rotate it lies on one of the standard rotation axes of DummyCube . Everything, now, rotating DummyCube , you rotate your cube as you need.

DummyCube objects are just used for grouping, for easier rotation.

  • Thanks, cool solution - RodGers