From e8d7959d593ece0bd9fca00204f208748688790f Mon Sep 17 00:00:00 2001 From: ch-sa Date: Thu, 22 Jul 2021 20:34:07 +0200 Subject: [PATCH] Change clipping space and add to config.ini - increase OpenGL clipping space (0.1 - 300) - add near and far plane to config - add ignore rules to flake --- .github/workflows/unit-tests.yml | 2 +- config.ini | 4 +++- docs/documentation.md | 4 +++- labelCloud/ressources/default_config.ini | 4 +++- labelCloud/view/viewer.py | 5 ++++- tests/integration/conftest.py | 5 +++-- tests/unit/conftest.py | 5 +++-- 7 files changed, 20 insertions(+), 9 deletions(-) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 3a003f8..30d9b55 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -28,7 +28,7 @@ jobs: - name: Lint with flake8 run: | # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + flake8 . --count --select=E9,F63,F7,F82 --ignore=C901 --show-source --statistics # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics diff --git a/config.ini b/config.ini index deccac3..fef1f24 100644 --- a/config.ini +++ b/config.ini @@ -51,4 +51,6 @@ show_orientation = True background_color = 100, 100, 100 ; number of decimal places shown for the parameters of the active bounding box viewing_precision = 2 - +; near and far clipping plane for OpenGL (where objects are visible, in meter) +near_plane=0.1 +far_plane=300 diff --git a/docs/documentation.md b/docs/documentation.md index cef796b..6667aba 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -56,9 +56,11 @@ The following parameters can be changed: | `STD_ROTATION` | Standard step for rotating the bounding box (with key press). | *0.5* | | `STD_SCALING` | Standard step for scaling the bounding box (with button press). | *0.03* | | `MIN_BOUNDINGBOX_DIMENSION` | Minimum value for the length, width and height of a bounding box. | *0.01* | -| **[SETTINGS]** | +| **[USER_INTERFACE]** | | `Z_ROTATION_ONLY` | Only allow z-rotation of bounding box; deactivate to also label x- & y-rotation. | *True* | | `SHOW_FLOOR` | Visualizes the floor (x-y-plane) as a grid. | *True* | | `SHOW_ORIENTATION` | Visualizes the object's orientation as an arrow. | *True* | | `BACKGROUND_COLOR` | Background color of the point cloud viewer (rgb). | *100, 100, 100* | | `VIEWING_PRECISION` | Number of decimal places shown on the right side for the parameters of the active bounding box. | *3* | +| `near_plane` | Min. distance of objects to be displayed by OpenGL | *0.1* | +| `far_plane` | Max. distance of objects to be displayed by OpenGL | *300* | diff --git a/labelCloud/ressources/default_config.ini b/labelCloud/ressources/default_config.ini index deccac3..e81fdb5 100644 --- a/labelCloud/ressources/default_config.ini +++ b/labelCloud/ressources/default_config.ini @@ -51,4 +51,6 @@ show_orientation = True background_color = 100, 100, 100 ; number of decimal places shown for the parameters of the active bounding box viewing_precision = 2 - +; near and far clipping plane for OpenGL (where objects are visible, in meter) +near_plane=0.1 +far_plane=300 \ No newline at end of file diff --git a/labelCloud/view/viewer.py b/labelCloud/view/viewer.py index 9d117b8..beaaa4c 100644 --- a/labelCloud/view/viewer.py +++ b/labelCloud/view/viewer.py @@ -15,6 +15,9 @@ # Main widget for presenting the point cloud class GLWidget(QtOpenGL.QGLWidget): + NEAR_PLANE = config.getfloat("USER_INTERFACE", "near_plane") + FAR_PLANE = config.getfloat("USER_INTERFACE", "far_plane") + def __init__(self, parent=None): self.parent = parent QtOpenGL.QGLWidget.__init__(self, parent) @@ -70,7 +73,7 @@ def resizeGL(self, width, height): GL.glLoadIdentity() aspect = width / float(height) - GLU.gluPerspective(45.0, aspect, 0.5, 30.0) + GLU.gluPerspective(45.0, aspect, GLWidget.NEAR_PLANE, GLWidget.FAR_PLANE) GL.glMatrixMode(GL.GL_MODELVIEW) def paintGL(self): diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index 0129145..ddbfd8d 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -9,9 +9,10 @@ def pytest_configure(config): print(f"Set working directory to {os.getcwd()}.") sys.path.insert(0, "labelCloud") - print(f"Added labelCloud to Python path.") + print("Added labelCloud to Python path.") - import app # preventing circular import + # preventing circular import + import app # noqa: E401 @pytest.fixture diff --git a/tests/unit/conftest.py b/tests/unit/conftest.py index dc4a9cf..9d2b5c2 100644 --- a/tests/unit/conftest.py +++ b/tests/unit/conftest.py @@ -7,6 +7,7 @@ def pytest_configure(config): print(f"Set working directory to {os.getcwd()}.") sys.path.insert(0, "labelCloud") - print(f"Added labelCloud to Python path.") + print("Added labelCloud to Python path.") - import app # preventing circular import + # preventing circular import + import app # noqa: E401