Combining translation and rotation into correct matrices. CAD package

Post questions, comments and feedback to our 3Dconnexion Windows Development Team.

Moderator: Moderators

ngomes
Moderator
Moderator
Posts: 2116
Joined: Mon Nov 27, 2006 7:22 am
Contact:

Re: Combining translation and rotation into correct matrices. CAD package

Post by ngomes » Wed Apr 08, 2020 3:06 am

formware wrote:
Wed Apr 08, 2020 2:17 am
It's unclear to me which gets/sets do i need at a minimum for my application?
All. There's no minimum.
formware wrote:
Wed Apr 08, 2020 2:17 am
Another thing that is unclear is what navigation mode this V4.0 operates in? Or how can that be steered?
Ideally you would want to give your user the option: camera target mode vs object mode. Most CAD packages seem to work in either of these 2.
That's the thing: it's up to the user. By implementing the "property" handlers, the application will under control of the driver. This includes the higher-level navigation mode and rotation point calculation.

The navigation modes can be selected in the "Advanced Settings" panel of the "3Dconnexion Properties" driver UI program.

formware
Posts: 12
Joined: Wed Mar 04, 2020 7:44 am

Re: Combining translation and rotation into correct matrices. CAD package

Post by formware » Wed Apr 08, 2020 4:15 am

Ok that clears some questions up ;)

In response to your earlier question about an OpenTK project. I think that makes sense.
I have setup a bare minimum VS project with just a 3dview, axis and a colored cube using the OpenTK lib.
It has my V3.4 integration up to this point integrated.

Can I email this to you?

ngomes
Moderator
Moderator
Posts: 2116
Joined: Mon Nov 27, 2006 7:22 am
Contact:

Re: Combining translation and rotation into correct matrices. CAD package

Post by ngomes » Wed Apr 08, 2020 4:38 am

formware wrote:
Wed Apr 08, 2020 4:15 am
I have setup a bare minimum VS project with just a 3dview, axis and a colored cube using the OpenTK lib.
It has my V3.4 integration up to this point integrated.
Excellent but wouldn't it be better if we started off from no integration? I'd think we'd want to try version 4 of the SDK.

formware
Posts: 12
Joined: Wed Mar 04, 2020 7:44 am

Re: Combining translation and rotation into correct matrices. CAD package

Post by formware » Wed Apr 08, 2020 9:06 am

I will try adding V4.0 as well so i can check if my own integration/math is correct and view any difference.
My own integration is very small. (it's just 3-4 methods).

My goal is to make a similar small integration for V4.0 with just the bare minimum so it's easy to debug and understand for others.
(It's just a personal opinion; but the more classes, interfaces the longer it takes for a third person to figure out all naming conventions and control flow)

I've emailed the V3.4 version to JWick in case you have time to take a look.
Will report back when V4.0 is integrated or I get stuck with that.

ngomes
Moderator
Moderator
Posts: 2116
Joined: Mon Nov 27, 2006 7:22 am
Contact:

Re: Combining translation and rotation into correct matrices. CAD package

Post by ngomes » Wed Apr 08, 2020 10:50 am

formware wrote:
Wed Apr 08, 2020 9:06 am
I've emailed the V3.4 version to JWick in case you have time to take a look.
Right. We have it. Thank you for making it available.

formware
Posts: 12
Joined: Wed Mar 04, 2020 7:44 am

Re: Combining translation and rotation into correct matrices. CAD package

Post by formware » Wed Apr 15, 2020 11:42 pm

I managed to get the 3d view completely working with 3.4.
Will email the updated sample once done.

Next things that come up that I don't understand are the buttons in 3.4.
I have the simplest space mouse possible with 2 buttons.
When i click them I get the circular menu's from the driver. So that all seems to work nicely.

Questions:
1. When i check the events I only get the SI_BUTTON_EVENT event(s). These all have a button number. Where is a list of these numbers and functions? I can't seem to find it in the documentation, SiApp.cs class or anything.
I do see a method SiGetButtonName but this only returns me empty strings.

2. SI_CMD_EVENT (with the long list of defined commands in the SDK) doesn't seem to fire. Correct?

jwick
Moderator
Moderator
Posts: 2742
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Re: Combining translation and rotation into correct matrices. CAD package

Post by jwick » Thu Apr 16, 2020 12:29 am

As we introduce more, varied devices, our strategy on button events has changed over the years to get farther away from the specific hardware events. We now recommend using our generic Virtual 3D Commands. These are independent of the hardware that generates them. The driver has to be told what sort of button events you want to receive. By default it sends button events that are for older applications.

There are two ways to tell it.

1) Create a cfg file for your application. While this gives you complete control, it is difficult.

2) Tell the driver you want it to use a specific default file (different from the one for older applications).

You do this by sending it a hint (code from the TestSiApp C# demo code):

Code: Select all

      // Tell the driver we want to receive V3DCMDs instead of V3DKeys
      SiApp.SiOpenWinAddHintBoolEnum(openData, SiApp.SiHintEnum.SI_HINT_USESV3DCMDS, 1);
With this Hint, it will send the application SI_CMD_EVENTS:

Code: Select all

      SiApp.SiSpwEvent spwEvent = new SiApp.SiSpwEvent();
      SiApp.SpwRetVal val = SiApp.SiGetEvent(devHdl, SiApp.SI_AVERAGE_EVENTS, eventData, spwEvent);

      if (val == SiApp.SpwRetVal.SI_IS_EVENT)
      {
        switch (spwEvent.type)
        {
        ...
          case SiApp.SiEventType.SI_CMD_EVENT:
            Log("SI_CMD_EVENT: ", string.Format("V3DCMD = {0}, pressed = {1}", spwEvent.cmdEventData.functionNumber, spwEvent.cmdEventData.pressed > 0));
            Print("V3DCMD event: V3DCMD = {0}, pressed = {1}", spwEvent.cmdEventData.functionNumber, spwEvent.cmdEventData.pressed > 0);
            break;
            ...

An additional step is to export a list (tree) of your application commands to the driver so users can see them in our GUI and assign them to the device buttons (and radial menus). In general, there are some events, such as reset view, Top View, Back View, that will be handled via V3DCMDs (SI_CMD_EVENTs) and application functions that are handled via SI_APP_EVENTs.

With SDK v4 you don't need to handle those viewing commands. The lib takes care of all viewing operations.

formware
Posts: 12
Joined: Wed Mar 04, 2020 7:44 am

Re: Combining translation and rotation into correct matrices. CAD package

Post by formware » Thu Apr 16, 2020 1:24 am

Thanks. that explains a lot.

I'm missing all 'hints' dll bindings and enums in my version of the SiApp.cs
(took this from the 3.4 SDK)

Is there another version of this that includes these?

jwick
Moderator
Moderator
Posts: 2742
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Re: Combining translation and rotation into correct matrices. CAD package

Post by jwick » Thu Apr 16, 2020 1:41 am

I'll email you the latest.

formware
Posts: 12
Joined: Wed Mar 04, 2020 7:44 am

Re: Combining translation and rotation into correct matrices. CAD package

Post by formware » Thu Apr 16, 2020 8:56 am

It works. SDK 3.4 is now working smooth (3d/2d views and cmd buttons for toggling view).

I'm currently trying sdk4.0 but run into some uncertainty with what should be provided as values.
Seems to me as some of the C# namings are not consistent with the C++ quick quide and the other document.
So that would be a first thing. Make everything consistent in naming.

Currently it's not throwing any exceptions; but it's also not moving the view. So probably i need to update the view. But where.
So questions; is there some overview of regular 3d view movement:
1. which gets/sets are the absolute minimum? I see in the sample some of them have not been implemented.

2. which calls are called when the mouse is moved? -> and should then trigger my view redraw?

ngomes
Moderator
Moderator
Posts: 2116
Joined: Mon Nov 27, 2006 7:22 am
Contact:

Re: Combining translation and rotation into correct matrices. CAD package

Post by ngomes » Thu Apr 16, 2020 9:49 am

Hi formware ,
formware wrote:
Thu Apr 16, 2020 8:56 am
So that would be a first thing. Make everything consistent in naming.
Can you indicate examples of what these are?
formware wrote:
Thu Apr 16, 2020 8:56 am
1. which gets/sets are the absolute minimum? I see in the sample some of them have not been implemented.
As stated before, all are required. That's all we can say.
formware wrote:
Thu Apr 16, 2020 8:56 am
2. which calls are called when the mouse is moved? -> and should then trigger my view redraw?
Depends how you set up the animation source. If you set the "frame_timing_source_k" property to one, it will be the application that triggers the redraw (as in an animation loop). Otherwise, the view can be redrawn when the driver set the "transaction_k" to zero (all properties are set and the frame can be drawn).

Post Reply