[Fixed] 0.19pre, Bottom command uses wrong direction

A forum for research and development of the user interface of FreeCAD
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
fc_tofu
Posts: 653
Joined: Sun Jan 05, 2020 4:56 pm

[Fixed] 0.19pre, Bottom command uses wrong direction

Post by fc_tofu »

version: FreeCAD_0.19.20052-Win-Conda_vc14.x-x86_64.7z
os: win10 x64
(same as FC 0.18.4)

Summary:
Menu command "View >Standard Views >Bottom", shows "Bottom" face of NaviCube upside-down. Which is inconsistent with other method.
While, below methods show "Bottom" face of NaviCube upside-up.
1. Left mouse click "Bottom" face of NaviCube,
2. New Sketch, choose orientation as "XY-Plane Reverse",
These means inconsistent Bottom behavior with different methods.

Analysis:
Bottom command uses direction of "rotation=180, X=0, Y=1, Z=0" from top view.
While other 2 methods use direction of "rotation=180, X=1, Y=0, Z=0" from top view.
fsc_2020-03-26_025534.jpg
fsc_2020-03-26_025534.jpg (139.94 KiB) Viewed 1650 times
fsc_2020-03-26_025650.jpg
fsc_2020-03-26_025650.jpg (20.19 KiB) Viewed 1836 times
fsc_2020-03-26_025712.jpg
fsc_2020-03-26_025712.jpg (190.99 KiB) Viewed 1836 times
Last edited by fc_tofu on Thu May 14, 2020 2:13 pm, edited 9 times in total.
fc_tofu
Posts: 653
Joined: Sun Jan 05, 2020 4:56 pm

Re: [Inconsistent] 0.19pre, Bottom command uses wrong direction

Post by fc_tofu »

I thought this issue is quite obvious, but haven't been confirmed so long.
User avatar
adrianinsaval
Veteran
Posts: 5553
Joined: Thu Apr 05, 2018 5:15 pm

Re: [Inconsistent] 0.19pre, Bottom command uses wrong direction

Post by adrianinsaval »

Is there a ticket in the bugtracker?
fc_tofu wrote: Wed Mar 25, 2020 7:26 pm Analysis:
Bottom command uses direction of "rotation=180, X=0, Y=1, Z=0" from top view.
While other 2 methods use direction of "rotation=180, X=1, Y=0, Z=0" from top view.
Did you get this from the source code? If so, why not make a PR or indicate where this is .
This is inconsistent but something to discuss is which of these should be really used, I think the one from the NaviCube makes more sense.
fc_tofu
Posts: 653
Joined: Sun Jan 05, 2020 4:56 pm

Re: [Inconsistent] 0.19pre, Bottom command uses wrong direction

Post by fc_tofu »

adrianinsaval wrote: Sun Apr 19, 2020 5:59 am Did you get this from the source code?
From my observation, not from source code. I donnot know coding.
Before bug report, we need confirmation in forum, we need to exclude it from designed behavior first.
No one confirmed this so long.
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: [Inconsistent] 0.19pre, Bottom command uses wrong direction

Post by triplus »

I guess they don't have to be consistent, but likely we can assume on how one can expect them to be. Therefore the first question i guess is what is the preferred choice. For me it looks like the NaviCube does the expected thing, and not the commad?
User avatar
adrianinsaval
Veteran
Posts: 5553
Joined: Thu Apr 05, 2018 5:15 pm

Re: [Inconsistent] 0.19pre, Bottom command uses wrong direction

Post by adrianinsaval »

I think navicube's behavior is better and should be used in bottom view command. It would be this behavior:
Image
I think that is reasonable to expect from the bottom view command. It currently works like this:
Sin título.png
Sin título.png (13.65 KiB) Viewed 1528 times
I don't see any reason to keep that.
fc_tofu
Posts: 653
Joined: Sun Jan 05, 2020 4:56 pm

Re: [Inconsistent] 0.19pre, Bottom command uses wrong direction

Post by fc_tofu »

adrianinsaval wrote: Sat Apr 25, 2020 8:01 pm I don't see any reason to keep that.
Your image just remide me that there is a "Bottom" view in TechDraw "Insert Projection Group" command.
By test, I find "Bottom" view in TechDraw "Insert Projection Group" (when using Front view as initial) is also consistent with NaviCube "Bottom".
fsc_2020-04-30_194745.jpg
fsc_2020-04-30_194745.jpg (24.7 KiB) Viewed 1474 times
fsc_2020-04-30_194752.jpg
fsc_2020-04-30_194752.jpg (18.87 KiB) Viewed 1474 times
fc_tofu
Posts: 653
Joined: Sun Jan 05, 2020 4:56 pm

Re: [Inconsistent] 0.19pre, Bottom command uses wrong direction

Post by fc_tofu »

triplus wrote: Sat Apr 25, 2020 12:18 pm I guess they don't have to be consistent, but likely we can assume on how one can expect them to be. Therefore the first question i guess is what is the preferred choice. For me it looks like the NaviCube does the expected thing, and not the commad?
At least, we can get better understanding of geometries from consistent veiw operations within FreeCAD.
I checked Blender and Rhino3D, which view operations same as FC's NaviCube command.
Also in online doc, MicroStation's ortho views same as FC's NaviCube.
https://docs.bentley.com/LiveContent/we ... 8C344.html

Code: Select all

3D Orthogonal Views

In 3D, since you can rotate views about three axes, rather than just one, there are six orthogonal orientations, each of which corresponds to a standard orthogonal view: Top, Bottom, Left, Right, Front, or Back. The name of the view describes also the position from which the model is viewed.


The faces of this cube correspond to the 3D orthogonal views. The cube is displayed here in an Isometric view.

A Top view displays the model from the top:

    the xy plane is parallel to your screen (as in a 2D model).
    x is positive from left to right (horizontally).
    y is positive from bottom to top (vertically).
    z is positive toward you, perpendicular to the screen.

While, for a Bottom view:

    y is positive from top to bottom (vertically).
    z is positive away from you, perpendicular to the screen.

A Front view displays the model from the front:

    the xz plane is parallel to your screen.
    x is positive from left to right (horizontally).
    z is positive from bottom to top (vertically).
    y is positive away from you, perpendicular to the screen.

While, for a Back view:

    x is positive from right to left (horizontally).
    y is positive towards you, perpendicular to the screen.

A Right view, displays the model from the right:

    the yz plane is parallel to your screen.
    y is positive from left to right (horizontally).
    z is positive from bottom to top (vertically).
    x is positive toward you, perpendicular to the screen.

While, for a Left view:

    y is positive from right to left (horizontally).
    x is positive away from you, perpendicular to the screen.
So, it seems there's a common practice to decide "standard" view operations in CG/CAD industries.
User avatar
adrianinsaval
Veteran
Posts: 5553
Joined: Thu Apr 05, 2018 5:15 pm

Re: [Inconsistent] 0.19pre, Bottom command uses wrong direction

Post by adrianinsaval »

NaviCube does it this way:

Code: Select all

void NaviCubeImplementation::setView(float rotZ,float rotX) {
	SbRotation rz, rx, t;
	rz.setValue(SbVec3f(0, 0, 1), rotZ * M_PI / 180);
	rx.setValue(SbVec3f(1, 0, 0), rotX * M_PI / 180);
	m_View3DInventorViewer->setCameraOrientation(rx * rz);
}

Code: Select all

case TEX_BOTTOM:
			setView(0,180);
https://github.com/FreeCAD/FreeCAD/blob ... .cpp#L1229

While Std Bottom seems to be doing:

Code: Select all

    else if(strcmp("ViewBottom",pMsg) == 0 ) {
        _viewer->setCameraOrientation(Camera::rotation(Camera::Bottom));
        _viewer->viewAll();
        return true;
https://github.com/FreeCAD/FreeCAD/blob ... r.cpp#L605
or maybe:

Code: Select all

else if (strcmp("ViewBottom",pMsg) == 0) {
        SbRotation rot(Camera::rotation(Camera::Bottom));
        for (std::vector<View3DInventorViewer*>::iterator it = _viewer.begin(); it != _viewer.end(); ++it) {
            SoCamera* cam = (*it)->getSoRenderManager()->getCamera();
            cam->orientation.setValue(rot);
            (*it)->viewAll();
        }
        return true;
    }
https://github.com/FreeCAD/FreeCAD/blob ... r.cpp#L314
I don't understand quite well which is used when...
Can some dev weight in? Would it be acceptable to change these to (0,180) as NaviCube?
User avatar
adrianinsaval
Veteran
Posts: 5553
Joined: Thu Apr 05, 2018 5:15 pm

Re: [Inconsistent] 0.19pre, Bottom command uses wrong direction

Post by adrianinsaval »

So I tried i out in python:

Code: Select all

from pivy import coin
cam = Gui.ActiveDocument.ActiveView.getCameraNode()
rot = coin.SbRotation(1,0,0,0)
cam.orientation.setValue(rot)
gives the view we want. I edited the files I mentioned earlier: https://github.com/adrianinsaval/FreeCA ... 72cfbebfa7
I will try to compile and test later so I can make a PR, anyone else who wants to try would be welcomed :)
Post Reply