Elevation Angle in 3D View

60 views
Skip to first unread message

Andrew Blount

unread,
Jun 27, 2022, 7:46:40 PM6/27/22
to JSXGraph
Hello,

Thank you for making a wonderful product.  I really appreciate you.

In the new 3dview, is there any way to programmatically set the Elevation Angle (el)?  I've spent a couple of days on it and am unable to figure out the syntax. When the graph opens, I would like for it to be at a 1.57 elevation.

Thank you in advance for your help.

Andrew


2022-06-27  Screenshoot of ChromiumDiamondoza at 06-41 PM.png

Alfred Wassermann

unread,
Jun 28, 2022, 11:08:28 AM6/28/22
to JSXGraph
Up to now there is a low-level access only. However, this may change in future versions.
Here is an how to change the slider values:

const board = JXG.JSXGraph.initBoard('jxgbox', {
                boundingbox: [-8, 8, 8, -8],
                keepaspectratio: false,
                axis: false
            });

    var view = board.create('view3d',
                [[-6, -3], [8, 8],             // 2D box of view
                [[-5, 5], [-5, 5], [-5, 5]]],  // 3D bounding cube
                {});
  view.D3.az_slide.setValue(2.0); // 0 .. 2*Math.PI
  view.D3.el_slide.setValue(0.1); // 0 .. Math.PI / 2
  board.update();


Best wishes,
Alfred



Cleon Teunissen

unread,
Jul 3, 2022, 3:45:00 AM7/3/22
to jsxg...@googlegroups.com
On Tue, Jun 28, 2022 at 5:08 PM Alfred Wassermann wrote:
> Up to now there is a low-level access only.

I have a follow-up question.

In 3D rendering software, by far the most common implementation of
azimuth and elevation control is that the user can click at any point
inside the viewport, and drag, and the 3D object swivels/pitches
accordingly.

Are there plans to implement an option for that kind of control in JSXGraph 3D?

I'm guessing that to implement that form of control there must be a
draggable foreground layer (that is 100% transparent). Dragging of
that foreground layer is then processed as azimuth and elevation
input. Of course, that means that nothing behind that foreground layer
would be clickable; all mouse events will fall to that foreground
layer.

To me that would be no problem; in my own graphs I provide the user
with sliders to manipulate the contents of the board, in my graphs the
objects themselves are always set to draggable:false (The controlling
slider is on a separate board, with the 'addChild' command used to
trigger update of the board with the objects.)

To me controlling azimuth and elevation with sliders is very
unsatisfactory. So it is very important for me to know whether or not
there are plans to implement an option of foreground layer dragging
for azimuth and elevation input.

Juha-Matti Huusko

unread,
Jul 4, 2022, 12:47:06 AM7/4/22
to jsxg...@googlegroups.com
Dear Cleon,

1)
> In 3D rendering software, by far the most common implementation of
azimuth and elevation control is that the user can click at any point
inside the viewport, and drag, and the 3D object swivels/pitches
accordingly.

At least it is possible to add such control. A solution with mouse events: https://jsfiddle.net/juhamattihuusko/g560wacL/
(Sorry that the 3d picture is very simple.)

If you grab an object with a mouse you can move it.
If you grab somewhere else with the mouse, you can adjust az and el.

2) Also, there should be added a way to control the z coordinate of points. Perhaps
hold Ctrl down+mouse movement?

Best wishes,
Juha-Matti


--
You received this message because you are subscribed to the Google Groups "JSXGraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jsxgraph+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jsxgraph/CAN61gCOTOTz4r4uYv7bu529rtifKe0Sewsi_9sfFne5Tu6GvtA%40mail.gmail.com.

Cleon Teunissen

unread,
Jul 5, 2022, 3:20:25 PM7/5/22
to jsxg...@googlegroups.com
> At least it is possible to add such control. A solution with mouse events: https://jsfiddle.net/juhamattihuusko/g560wacL/
> (Sorry that the 3d picture is very simple.)
>
> If you grab an object with a mouse you can move it.
> If you grab somewhere else with the mouse, you can adjust az and el.

Unfortunately that setup is unsatisfactory.

User Interface should be simple, it should not require explanation.
*All* mouse events should go to the overall azimuth and elevation
control. (The behavior of the graph in that jsfiddle is erratic.
Clicking and dragging outside the object sometimes has the object
pitching up, and sometimes pitching down. It's unpredictable.)

In terms of programming. In this context using a workaround is
unsatisfactory. I see that two sliders are defined, set to
visible:false. Later in the script mouse events are declared, and the
event handling code uses the mouse dragging to adjust the invisible
sliders. However, a proper implementation will adjust the camera
position directly, rather than indirectly.
Reply all
Reply to author
Forward
0 new messages