Zoom %

Is there any way to get current zoom in % (or any other unit, linearly depending on visible scale) from GLWidget?

Regards,
Konstantin

Hm… this is interesting but depends on 2 things.

  • First, you need to know the physical size of the monitor. I’m afraid
    the only way to get that reliably in all cases would be to ask the
    user to provide that information in a dialog.
  • Second, you need to let the user know about the angle of view,
    otherwise it’s meaningless.

Benoit

2010/3/20 Konstantin Tokarev annulen@yandex.ru:

Is there any way to get current zoom in % (or any other unit, linearly depending on visible scale) from GLWidget?

Regards,
Konstantin


Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev


Avogadro-devel mailing list
Avogadro-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/avogadro-devel

  • First, you need to know the physical size of the monitor.

No, I want only px per Angstrom

  • Second, you need to let the user know about the angle of view,
    otherwise it’s meaningless.

I’m thinking about adding scale engine to show approximate “average” scale on pictures.

Benoit
2010/3/20 Konstantin Tokarev :

Is there any way to get current zoom in % (or any other unit, linearly depending on visible scale) from GLWidget?

Regards,
Konstantin


Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev


Avogadro-devel mailing list
Avogadro-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/avogadro-devel


Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev


Avogadro-devel mailing list
Avogadro-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/avogadro-devel


Regards,
Konstantin

Яндекс.Почта. Письма есть. Спама - нет. http://mail.yandex.ru/nospam/sign

I’m thinking about adding scale engine to show approximate “average” scale on pictures.

But you don’t need to know the zoom percentage for that, right? Can’t you just make an OpenGL call in the scene with two lines 1.0Å apart, another two lines 2.0Å apart, etc.?

Alternatively, if you’re trying to do this in 2D coordinates, you want to look at the methods in the Camera class, like project() which turns a space-coordinate into a window coordinate.

Cheers,
-Geoff

23.03.10, 10:28, “Geoffrey Hutchison” geoff.hutchison@gmail.com:

I’m thinking about adding scale engine to show approximate “average” scale on pictures.
But you don’t need to know the zoom percentage for that, right? Can’t you just make an OpenGL call in the scene with two lines 1.0Å apart, another two lines 2.0Å apart, etc.?
Alternatively, if you’re trying to do this in 2D coordinates, you want to look at the methods in the Camera class, like project() which turns a space-coordinate into a window coordinate.

How do I draw 1 angstrom line (in internal coordinate system) laying in screen plane?

Cheers,
-Geoff


Regards,
Konstantin

2010/3/23 Konstantin Tokarev annulen@yandex.ru:

23.03.10, 10:28, “Geoffrey Hutchison” geoff.hutchison@gmail.com:

I’m thinking about adding scale engine to show approximate “average” scale on pictures.
But you don’t need to know the zoom percentage for that, right? Can’t you just make an OpenGL call in the scene with two lines 1.0Å apart, another two lines 2.0Å apart, etc.?
Alternatively, if you’re trying to do this in 2D coordinates, you want to look at the methods in the Camera class, like project() which turns a space-coordinate into a window coordinate.

+1

How do I draw 1 angstrom line (in internal coordinate system) laying in screen plane?

There’s no “screen plane” :slight_smile:

There is only a camera position and orientation. What Geoff is saying
is that you could just pick a certain distance from the camera, and
draw a line of length 1 angstrom in a plane that is at that distance
from the camera.

How to pick this distance value? I don’t know, there’s no preferred
choice, that’s why such a “scale” is very arbitrary and will only be
actually accurate for a small part of the molecule being rendered on
screen.

Benoit

Cheers,
-Geoff


Regards,
Konstantin


Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev


Avogadro-devel mailing list
Avogadro-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/avogadro-devel

2010/3/23 Benoit Jacob jacob.benoit.1@gmail.com:

2010/3/23 Konstantin Tokarev annulen@yandex.ru:

23.03.10, 10:28, “Geoffrey Hutchison” geoff.hutchison@gmail.com:

I’m thinking about adding scale engine to show approximate “average” scale on pictures.
But you don’t need to know the zoom percentage for that, right? Can’t you just make an OpenGL call in the scene with two lines 1.0Å apart, another two lines 2.0Å apart, etc.?
Alternatively, if you’re trying to do this in 2D coordinates, you want to look at the methods in the Camera class, like project() which turns a space-coordinate into a window coordinate.

+1

How do I draw 1 angstrom line (in internal coordinate system) laying in screen plane?

There’s no “screen plane” :slight_smile:

There is only a camera position and orientation. What Geoff is saying
is that you could just pick a certain distance from the camera, and
draw a line of length 1 angstrom in a plane that is at that distance
from the camera.

By the way, see the Camera::unProject() methods. The arbitary distance
from camera, that i’m talking about there, is equivalent to choosing
the “reference point” to pass to unProject, see the API dox.

Benoit

How to pick this distance value? I don’t know, there’s no preferred
choice, that’s why such a “scale” is very arbitrary and will only be
actually accurate for a small part of the molecule being rendered on
screen.

Benoit

Cheers,
-Geoff


Regards,
Konstantin


Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev


Avogadro-devel mailing list
Avogadro-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/avogadro-devel

23.03.10, 09:28, “Geoffrey Hutchison” geoff.hutchison@gmail.com:

I’m thinking about adding scale engine to show approximate “average” scale on pictures.

But you don’t need to know the zoom percentage for that, right? Can’t you just make an OpenGL call in the scene with two lines 1.0Å apart, another two lines 2.0Å apart, etc.?

Alternatively, if you’re trying to do this in 2D coordinates, you want to look at the methods in the Camera class, like project() which turns a space-coordinate into a window coordinate.

I tried the next function:

double Camera::scale() const
{
Eigen::Vector3d v = unProject(QPoint(0,0));
v.normalize();
return project(v).norm();
}

I think it 1) takes a point in screen coordinates; 2) transform it into 3D coordinates of model; 3) obtains unit vector in 3D coordinate, laying in screen plane and strarting in (0,0,0); 4) transforms it back into screen coordinates; 5) returns its length in pixels

But in fact it returns something strange (value over 500 on 1152x864 resolution). What I’m doing wrong?

P.S. function
double Camera::scale() const
{
return project(backTransformedYAxis()).norm();
}

returns something similar


Regards,
Konstantin

Яндекс.Почта. Письма есть. Спама - нет. http://mail.yandex.ru/nospam/sign

Hi List,

I just wanted to add one observation in this discussion. I saw in
another thread that you were also discussing orthographic projections
(in addition to the usual perspective projection). I’d like to bring
to your attention that the present “Zoom %” / “Scale engine” idea is
indissociable from that idea of adding orthographic projections:

  • in orthographic projection, both zoom% and scale engine are very
    easy and natural to implement, and make perfect sense.
  • in perspective projection, both are meaningless at the level of the
    whole scene, and only gain an approximative meaningfulness at the
    scale of a small part of the scene.

Benoit

2010/4/5 Konstantin Tokarev annulen@yandex.ru:

23.03.10, 09:28, “Geoffrey Hutchison” geoff.hutchison@gmail.com:

I’m thinking about adding scale engine to show approximate “average” scale on pictures.

But you don’t need to know the zoom percentage for that, right? Can’t you just make an OpenGL call in the scene with two lines 1.0Å apart, another two lines 2.0Å apart, etc.?

Alternatively, if you’re trying to do this in 2D coordinates, you want to look at the methods in the Camera class, like project() which turns a space-coordinate into a window coordinate.

I tried the next function:

double Camera::scale() const
{
Eigen::Vector3d v = unProject(QPoint(0,0));
v.normalize();
return project(v).norm();
}

I think it 1) takes a point in screen coordinates; 2) transform it into 3D coordinates of model; 3) obtains unit vector in 3D coordinate, laying in screen plane and strarting in (0,0,0); 4) transforms it back into screen coordinates; 5) returns its length in pixels

But in fact it returns something strange (value over 500 on 1152x864 resolution). What I’m doing wrong?

P.S. function
double Camera::scale() const
{
return project(backTransformedYAxis()).norm();
}

returns something similar


Regards,
Konstantin

Яндекс.Почта. Письма есть. Спама - нет. http://mail.yandex.ru/nospam/sign