Skip to content

Commit

Permalink
Merge pull request #17 from ch-sa/opengl-clipping
Browse files Browse the repository at this point in the history
Change clipping space and add to config.ini
  • Loading branch information
ch-sa authored Jul 22, 2021
2 parents 69f7551 + e8d7959 commit eb78aed
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 3 additions & 1 deletion docs/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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* |
4 changes: 3 additions & 1 deletion labelCloud/ressources/default_config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 4 additions & 1 deletion labelCloud/view/viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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):
Expand Down
5 changes: 3 additions & 2 deletions tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions tests/unit/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit eb78aed

Please sign in to comment.