discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Unexpected $vpr behavior

B
bmihuraca
Tue, Dec 8, 2020 6:53 PM

The "viewport rotation" special variable doesn't behave like I expect. I
expect the view to rotate around whichever axis is changed, therefore it
should stay still on my computer screen.

Take this code for example:

$vpr = [55, 0, 25];
text("Hello");

When I change the z-axis by 20 degrees, it does not move on my computer
screen.

But when I change the x- or y-axes by 20 degrees, they move substantially.

Is this a bug or am I not understanding something?

--
Sent from: http://forum.openscad.org/

The "viewport rotation" special variable doesn't behave like I expect. I expect the view to rotate around whichever axis is changed, therefore it should stay still on my computer screen. Take this code for example: $vpr = [55, 0, 25]; text("Hello"); When I change the z-axis by 20 degrees, it does not move on my computer screen. But when I change the x- or y-axes by 20 degrees, they move substantially. Is this a bug or am I not understanding something? -- Sent from: http://forum.openscad.org/
D
David
Tue, Dec 8, 2020 7:00 PM

Isn't text handled differently in OpenSCAD?  It's not handled as most
graphics primitives except sometimes.  Of course, I could be wrong.

On 12/8/20 12:53 PM, bmihuraca via Discuss wrote:

The "viewport rotation" special variable doesn't behave like I expect. I
expect the view to rotate around whichever axis is changed, therefore it
should stay still on my computer screen.

Take this code for example:

$vpr = [55, 0, 25];
text("Hello");

When I change the z-axis by 20 degrees, it does not move on my computer
screen.

But when I change the x- or y-axes by 20 degrees, they move substantially.

Is this a bug or am I not understanding something?

--
Sent from: http://forum.openscad.org/


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

Isn't text handled differently in OpenSCAD?  It's not handled as most graphics primitives except sometimes.  Of course, I could be wrong. On 12/8/20 12:53 PM, bmihuraca via Discuss wrote: > The "viewport rotation" special variable doesn't behave like I expect. I > expect the view to rotate around whichever axis is changed, therefore it > should stay still on my computer screen. > > Take this code for example: > > $vpr = [55, 0, 25]; > text("Hello"); > > When I change the z-axis by 20 degrees, it does not move on my computer > screen. > > But when I change the x- or y-axes by 20 degrees, they move substantially. > > Is this a bug or am I not understanding something? > > > > > -- > Sent from: http://forum.openscad.org/ > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
B
bmihuraca
Tue, Dec 8, 2020 7:23 PM

This issue is not related to the text, just the axes. I should've left that
text line out.

--
Sent from: http://forum.openscad.org/

This issue is not related to the text, just the axes. I should've left that text line out. -- Sent from: http://forum.openscad.org/
NH
nop head
Tue, Dec 8, 2020 7:30 PM

Not sure what you mean. If I change the z rotation to 45 and do F5 the text
does rotate substantially.

[image: image.png]

On Tue, 8 Dec 2020 at 19:24, bmihuraca via Discuss <
discuss@lists.openscad.org> wrote:

This issue is not related to the text, just the axes. I should've left that
text line out.

--
Sent from: http://forum.openscad.org/


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

Not sure what you mean. If I change the z rotation to 45 and do F5 the text does rotate substantially. [image: image.png] On Tue, 8 Dec 2020 at 19:24, bmihuraca via Discuss < discuss@lists.openscad.org> wrote: > This issue is not related to the text, just the axes. I should've left that > text line out. > > > > -- > Sent from: http://forum.openscad.org/ > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
JB
Jordan Brown
Tue, Dec 8, 2020 7:37 PM

On 12/8/2020 11:00 AM, David wrote:

Isn't text handled differently in OpenSCAD?  It's not handled as most
graphics primitives except sometimes.

Text is a 2D object.  For display purposes it, like other 2D objects,
has a bit of height, but they're all still 2D.

On 12/8/20 12:53 PM, bmihuraca via Discuss wrote:

The "viewport rotation" special variable doesn't behave like I expect. I
expect the view to rotate around whichever axis is changed, therefore it
should stay still on my computer screen.

Take this code for example:

$vpr = [55, 0, 25];
text("Hello");

When I change the z-axis by 20 degrees, it does not move on my computer
screen.

But when I change the x- or y-axes by 20 degrees, they move
substantially.

Is this a bug or am I not understanding something?

I have trouble visualizing it myself, but I think what you're seeing is
one of three things:

  • When you rotate in two axes, there's a related rotation in the third.
  • Like other OpenSCAD rotations, the Z rotation is done last.
  • View rotation is around the center of the window.  If the origin
    isn't at the center of the window, rotating around Z causes the Z
    axis to move too.

Try playing with one axis at a time, keeping the other two set to zero.

Set this animation going, then pan with your mouse and manually change
the numbers for the rotation of the two non-animated axes:

$vpr = [0,0, $t*360];
text("Hello"); 

(If you're not familiar with animation:  View/Animate to get the
controls to appear, then put (say) 10 in the FPS box and 90 in the Steps
box.)

Of course, you can move the $t*360 to whichever axis you like.

You might also set

$vpt=[0,0,0];

to force the origin to the center.

Caution:  animated rotation of more than one axis a can make you dizzy!

On 12/8/2020 11:00 AM, David wrote: > Isn't text handled differently in OpenSCAD?  It's not handled as most > graphics primitives except sometimes. Text is a 2D object.  For display purposes it, like other 2D objects, has a bit of height, but they're all still 2D. > On 12/8/20 12:53 PM, bmihuraca via Discuss wrote: >> The "viewport rotation" special variable doesn't behave like I expect. I >> expect the view to rotate around whichever axis is changed, therefore it >> should stay still on my computer screen. >> >> Take this code for example: >> >> $vpr = [55, 0, 25]; >> text("Hello"); >> >> When I change the z-axis by 20 degrees, it does not move on my computer >> screen. >> >> But when I change the x- or y-axes by 20 degrees, they move >> substantially. >> >> Is this a bug or am I not understanding something? I have trouble visualizing it myself, but I think what you're seeing is one of three things: * When you rotate in two axes, there's a related rotation in the third. * Like other OpenSCAD rotations, the Z rotation is done last. * View rotation is around the center of the window.  If the origin isn't at the center of the window, rotating around Z causes the Z axis to move too. Try playing with one axis at a time, keeping the other two set to zero. Set this animation going, then pan with your mouse and manually change the numbers for the rotation of the two non-animated axes: $vpr = [0,0, $t*360]; text("Hello"); (If you're not familiar with animation:  View/Animate to get the controls to appear, then put (say) 10 in the FPS box and 90 in the Steps box.) Of course, you can move the $t*360 to whichever axis you like. You might also set $vpt=[0,0,0]; to force the origin to the center. Caution:  animated rotation of more than one axis a can make you dizzy!
B
bmihuraca
Tue, Dec 8, 2020 7:58 PM

Ack, everybody is focused on the text! I am only concerned about the axes.

Next month I'll post the same question without the line of text.

--
Sent from: http://forum.openscad.org/

Ack, everybody is focused on the text! I am only concerned about the axes. Next month I'll post the same question without the line of text. -- Sent from: http://forum.openscad.org/
NH
nop head
Tue, Dec 8, 2020 8:27 PM

I still don't understand what you mean. The text is always aligned with X
and Y axes. The view angles changes according to the GUI or the $vpr
setting that initially sets the GUI value but the mouse can change it until
F5 is hit again.

On Tue, 8 Dec 2020 at 19:58, bmihuraca via Discuss <
discuss@lists.openscad.org> wrote:

Ack, everybody is focused on the text! I am only concerned about the axes.

Next month I'll post the same question without the line of text.

--
Sent from: http://forum.openscad.org/


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

I still don't understand what you mean. The text is always aligned with X and Y axes. The view angles changes according to the GUI or the $vpr setting that initially sets the GUI value but the mouse can change it until F5 is hit again. On Tue, 8 Dec 2020 at 19:58, bmihuraca via Discuss < discuss@lists.openscad.org> wrote: > Ack, everybody is focused on the text! I am only concerned about the axes. > > Next month I'll post the same question without the line of text. > > > > -- > Sent from: http://forum.openscad.org/ > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
JB
Jordan Brown
Tue, Dec 8, 2020 8:53 PM

On 12/8/2020 11:58 AM, bmihuraca via Discuss wrote:

Ack, everybody is focused on the text! I am only concerned about the axes.

No, sorry, I got what you meant.  I responded to the other guy's text
comment, and then to yours; perhaps I erred in combining the two and you
missed the response to your question.

Here it is again.  I've retained the text() invocation from your
original.  It's not necessary for the demonstration, but it can help
keep track of which axis is which as you spin the world around.


I have trouble visualizing it myself, but I think what you're seeing is
one of three things:

  • When you rotate in two axes, there's a related rotation in the third.
  • Like other OpenSCAD rotations, the Z rotation is done last.
  • View rotation is around the center of the window.  If the origin
    isn't at the center of the window, rotating around Z causes the Z
    axis to move too.

Try playing with one axis at a time, keeping the other two set to zero.

Set this animation going, then pan with your mouse and manually change
the numbers for the rotation of the two non-animated axes:

$vpr = [0,0, $t*360];
text("Hello"); 

(If you're not familiar with animation:  View/Animate to get the
controls to appear, then put (say) 10 in the FPS box and 90 in the Steps
box.)

Of course, you can move the $t*360 to whichever axis you like.

You might also set

$vpt=[0,0,0];

to force the origin to the center.

Caution:  animated rotation of more than one axis a can make you dizzy!

On 12/8/2020 11:58 AM, bmihuraca via Discuss wrote: > Ack, everybody is focused on the text! I am only concerned about the axes. > No, sorry, I got what you meant.  I responded to the other guy's text comment, and then to yours; perhaps I erred in combining the two and you missed the response to your question. Here it is again.  I've retained the text() invocation from your original.  It's not necessary for the demonstration, but it can help keep track of which axis is which as you spin the world around. --- I have trouble visualizing it myself, but I think what you're seeing is one of three things: * When you rotate in two axes, there's a related rotation in the third. * Like other OpenSCAD rotations, the Z rotation is done last. * View rotation is around the center of the window.  If the origin isn't at the center of the window, rotating around Z causes the Z axis to move too. Try playing with one axis at a time, keeping the other two set to zero. Set this animation going, then pan with your mouse and manually change the numbers for the rotation of the two non-animated axes: $vpr = [0,0, $t*360]; text("Hello"); (If you're not familiar with animation:  View/Animate to get the controls to appear, then put (say) 10 in the FPS box and 90 in the Steps box.) Of course, you can move the $t*360 to whichever axis you like. You might also set $vpt=[0,0,0]; to force the origin to the center. Caution:  animated rotation of more than one axis a can make you dizzy!
JB
Jordan Brown
Tue, Dec 8, 2020 9:20 PM

Another note:

Again, I have some trouble visualizing what's really going on and why,
but note that OpenSCAD's viewer normally constrains rotation.  I'm not
quite sure what the constraint is or what it deeply means, but as long
as you're centered on the origin ($vpt=[0,0,0]; look at the bottom of
the window) you can't get the Z axis to appear off vertical.  (It can
tilt towards you or away from you, but never left or right.)

Another way to look at it is that if you're looking at a model of a
globe (ignoring axial tilt), you can't get the north pole to be on the
left or right side.

Probably strongly related is that the ordinary mouse controls never
change the Y axis rotation - it's always zero.  (Watch the rotation
numbers at the bottom of the screen.)

I suspect that the X and Z axis rotations map to altitude and azimuth,
or in spherical coordinates theta θ and phi φ.

When you set $vpr, you can set the Y rotation and so you can move the Z
axis off vertical.  For instance, [0,90,0] has the north pole pointed left.

(And forcing the Y rotation non-zero using $vpr then yields strange
effects in the mouse-based rotation.)

Another note: Again, I have some trouble visualizing what's really going on and why, but note that OpenSCAD's viewer normally constrains rotation.  I'm not quite sure what the constraint is or what it deeply means, but as long as you're centered on the origin ($vpt=[0,0,0]; look at the bottom of the window) you can't get the Z axis to appear off vertical.  (It can tilt towards you or away from you, but never left or right.) Another way to look at it is that if you're looking at a model of a globe (ignoring axial tilt), you can't get the north pole to be on the left or right side. Probably strongly related is that the ordinary mouse controls never change the Y axis rotation - it's always zero.  (Watch the rotation numbers at the bottom of the screen.) I suspect that the X and Z axis rotations map to altitude and azimuth, or in spherical coordinates theta θ and phi φ. When you set $vpr, you can set the Y rotation and so you can move the Z axis off vertical.  For instance, [0,90,0] has the north pole pointed left. (And forcing the Y rotation non-zero using $vpr then yields strange effects in the mouse-based rotation.)
B
bmihuraca
Tue, Dec 8, 2020 9:59 PM

I didn't explain it well enough to begin with; here's a picture (hopefully),
and I would expect the x-axis to have the same angle:

http://forum.openscad.org/file/t3042/OpenSCAD_%24vpr_issue.png

--
Sent from: http://forum.openscad.org/

I didn't explain it well enough to begin with; here's a picture (hopefully), and I would expect the x-axis to have the same angle: <http://forum.openscad.org/file/t3042/OpenSCAD_%24vpr_issue.png> -- Sent from: http://forum.openscad.org/