Browse Source

Remove python stuff, add cpp gitignore

Johannes Kreutz 4 years ago
parent
commit
acd0d46968

+ 168 - 253
trackpoint-app/.gitignore

@@ -1,269 +1,47 @@
-### macOS ###
-# General
-.DS_Store
-.AppleDouble
-.LSOverride
-
-# Icon must end with two \r
-Icon
-
-
-# Thumbnails
-._*
-
-# Files that might appear in the root of a volume
-.DocumentRevisions-V100
-.fseventsd
-.Spotlight-V100
-.TemporaryItems
-.Trashes
-.VolumeIcon.icns
-.com.apple.timemachine.donotpresent
-
-# Directories potentially created on remote AFP share
-.AppleDB
-.AppleDesktop
-Network Trash Folder
-Temporary Items
-.apdisk
-
-### Python ###
-# Byte-compiled / optimized / DLL files
-__pycache__/
-*.py[cod]
-*$py.class
-
-# C extensions
-*.so
-
-# Distribution / packaging
-.Python
+# Build folder
 build/
-develop-eggs/
-dist/
-downloads/
-eggs/
-.eggs/
-parts/
-sdist/
-var/
-wheels/
-pip-wheel-metadata/
-share/python-wheels/
-*.egg-info/
-.installed.cfg
-*.egg
-MANIFEST
-
-# PyInstaller
-#  Usually these files are written by a python script from a template
-#  before PyInstaller builds the exe, so as to inject date/other infos into it.
-*.manifest
-*.spec
-
-# Installer logs
-pip-log.txt
-pip-delete-this-directory.txt
-
-# Unit test / coverage reports
-htmlcov/
-.tox/
-.nox/
-.coverage
-.coverage.*
-.cache
-nosetests.xml
-coverage.xml
-*.cover
-*.py,cover
-.hypothesis/
-.pytest_cache/
-pytestdebug.log
-
-# Translations
-*.mo
-*.pot
-
-# Django stuff:
-*.log
-local_settings.py
-db.sqlite3
-db.sqlite3-journal
-
-# Flask stuff:
-instance/
-.webassets-cache
-
-# Scrapy stuff:
-.scrapy
-
-# Sphinx documentation
-docs/_build/
-doc/_build/
-
-# PyBuilder
-target/
-
-# Jupyter Notebook
-.ipynb_checkpoints
-
-# IPython
-profile_default/
-ipython_config.py
-
-# pyenv
-.python-version
-
-# pipenv
-#   According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
-#   However, in case of collaboration, if having platform-specific dependencies or dependencies
-#   having no cross-platform support, pipenv may install dependencies that don't work, or not
-#   install all needed dependencies.
-#Pipfile.lock
-
-# poetry
-#poetry.lock
-
-# PEP 582; used by e.g. github.com/David-OConnor/pyflow
-__pypackages__/
-
-# Celery stuff
-celerybeat-schedule
-celerybeat.pid
-
-# SageMath parsed files
-*.sage.py
-
-# Environments
-# .env
-.env/
-.venv/
-env/
-venv/
-ENV/
-env.bak/
-venv.bak/
-pythonenv*
-
-# Spyder project settings
-.spyderproject
-.spyproject
-
-# Rope project settings
-.ropeproject
-
-# mkdocs documentation
-/site
-
-# mypy
-.mypy_cache/
-.dmypy.json
-dmypy.json
-
-# Pyre type checker
-.pyre/
-
-# pytype static type analyzer
-.pytype/
-
-# operating system-related files
-# file properties cache/storage on macOS
-*.DS_Store
-# thumbnail cache on Windows
-Thumbs.db
-
-# profiling data
-.prof
-
 
-### QML ###
-# Cached binary representations of QML and JS files
-*.qmlc
-*.jsc
+### C++ ###
+# Prerequisites
+*.d
 
-### Qt ###
-# C++ objects and libs
+# Compiled Object files
 *.slo
 *.lo
 *.o
-*.a
-*.la
-*.lai
-*.so.*
-*.dll
-*.dylib
-
-# Qt-es
-object_script.*.Release
-object_script.*.Debug
-*_plugin_import.cpp
-/.qmake.cache
-/.qmake.stash
-*.pro.user
-*.pro.user.*
-*.qbs.user
-*.qbs.user.*
-*.moc
-moc_*.cpp
-moc_*.h
-qrc_*.cpp
-ui_*.h
-Makefile*
-*build-*
-*.qm
-*.prl
-
-# Qt unit tests
-target_wrapper.*
-
-# QtCreator
-*.autosave
-
-# QtCreator Qml
-*.qmlproject.user
-*.qmlproject.user.*
-
-# QtCreator CMake
-CMakeLists.txt.user*
-
-# QtCreator 4.8< compilation database
-compile_commands.json
-
-# QtCreator local machine specific files for imported projects
-*creator.user*
-
-### QtCreator ###
-# gitignore for Qt Creator like IDE for pure C/C++ project without Qt
-#
-# Reference: http://doc.qt.io/qtcreator/creator-project-generic.html
-
-
-
-# Qt Creator autogenerated files
-
+*.obj
 
-# A listing of all the files included in the project
-*.files
+# Precompiled Headers
+*.gch
+*.pch
 
-# Include directories
-*.includes
+# Linker files
+*.ilk
 
-# Project configuration settings like predefined Macros
-*.config
+# Debugger Files
+*.pdb
 
-# Qt Creator settings
-*.creator
+# Compiled Dynamic libraries
+*.so
+*.dylib
+*.dll
 
-# User project settings
-*.creator.user*
+# Fortran module files
+*.mod
+*.smod
 
-# Qt Creator backups
+# Compiled Static libraries
+*.lai
+*.la
+*.a
+*.lib
 
-# Flags for Clang Code Model
-*.cxxflags
-*.cflags
+# Executables
+*.exe
+*.out
+*.app
 
-### PyCharm ###
+### CLion ###
 # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
 # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
 
@@ -336,7 +114,7 @@ fabric.properties
 # Android studio 3.1+ serialized cache file
 .idea/caches/build_file_checksums.ser
 
-### PyCharm Patch ###
+### CLion Patch ###
 # Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
 
 # *.iml
@@ -365,3 +143,140 @@ fabric.properties
 # CodeStream plugin
 # https://plugins.jetbrains.com/plugin/12206-codestream
 .idea/codestream.xml
+
+### CMake ###
+CMakeLists.txt.user
+CMakeCache.txt
+CMakeFiles
+CMakeScripts
+Testing
+Makefile
+cmake_install.cmake
+install_manifest.txt
+compile_commands.json
+CTestTestfile.cmake
+_deps
+CMakeUserPresets.json
+
+### CMake Patch ###
+# External projects
+*-prefix/
+
+### Linux ###
+*~
+
+# temporary files which can be created if a process still has a handle open of a deleted file
+.fuse_hidden*
+
+# KDE directory preferences
+.directory
+
+# Linux trash folder which might appear on any partition or disk
+.Trash-*
+
+# .nfs files are created when an open file is removed but is still being accessed
+.nfs*
+
+### macOS ###
+# General
+.DS_Store
+.AppleDouble
+.LSOverride
+
+# Icon must end with two \r
+Icon
+
+
+# Thumbnails
+._*
+
+# Files that might appear in the root of a volume
+.DocumentRevisions-V100
+.fseventsd
+.Spotlight-V100
+.TemporaryItems
+.Trashes
+.VolumeIcon.icns
+.com.apple.timemachine.donotpresent
+
+# Directories potentially created on remote AFP share
+.AppleDB
+.AppleDesktop
+Network Trash Folder
+Temporary Items
+.apdisk
+
+### Qt ###
+# C++ objects and libs
+*.so.*
+
+# Qt-es
+object_script.*.Release
+object_script.*.Debug
+*_plugin_import.cpp
+/.qmake.cache
+/.qmake.stash
+*.pro.user
+*.pro.user.*
+*.qbs.user
+*.qbs.user.*
+*.moc
+moc_*.cpp
+moc_*.h
+qrc_*.cpp
+ui_*.h
+*.qmlc
+*.jsc
+Makefile*
+*build-*
+*.qm
+*.prl
+
+# Qt unit tests
+target_wrapper.*
+
+# QtCreator
+*.autosave
+
+# QtCreator Qml
+*.qmlproject.user
+*.qmlproject.user.*
+
+# QtCreator CMake
+CMakeLists.txt.user*
+
+# QtCreator 4.8< compilation database
+
+# QtCreator local machine specific files for imported projects
+*creator.user*
+
+### QtCreator ###
+# gitignore for Qt Creator like IDE for pure C/C++ project without Qt
+#
+# Reference: http://doc.qt.io/qtcreator/creator-project-generic.html
+
+
+
+# Qt Creator autogenerated files
+
+
+# A listing of all the files included in the project
+*.files
+
+# Include directories
+*.includes
+
+# Project configuration settings like predefined Macros
+*.config
+
+# Qt Creator settings
+*.creator
+
+# User project settings
+*.creator.user*
+
+# Qt Creator backups
+
+# Flags for Clang Code Model
+*.cxxflags
+*.cflags

+ 0 - 3
trackpoint-app/.idea/.gitignore

@@ -1,3 +0,0 @@
-# Default ignored files
-/shelf/
-/workspace.xml

+ 0 - 6
trackpoint-app/.idea/inspectionProfiles/profiles_settings.xml

@@ -1,6 +0,0 @@
-<component name="InspectionProjectProfileManager">
-  <settings>
-    <option name="USE_PROJECT_PROFILE" value="false" />
-    <version value="1.0" />
-  </settings>
-</component>

+ 0 - 4
trackpoint-app/.idea/misc.xml

@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
-  <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9 (trackpoint-app)" project-jdk-type="Python SDK" />
-</project>

+ 0 - 8
trackpoint-app/.idea/modules.xml

@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
-  <component name="ProjectModuleManager">
-    <modules>
-      <module fileurl="file://$PROJECT_DIR$/.idea/trackpoint-app.iml" filepath="$PROJECT_DIR$/.idea/trackpoint-app.iml" />
-    </modules>
-  </component>
-</project>

+ 0 - 10
trackpoint-app/.idea/trackpoint-app.iml

@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<module type="PYTHON_MODULE" version="4">
-  <component name="NewModuleRootManager">
-    <content url="file://$MODULE_DIR$">
-      <excludeFolder url="file://$MODULE_DIR$/venv" />
-    </content>
-    <orderEntry type="inheritedJdk" />
-    <orderEntry type="sourceFolder" forTests="false" />
-  </component>
-</module>

+ 0 - 6
trackpoint-app/.idea/vcs.xml

@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
-  <component name="VcsDirectoryMappings">
-    <mapping directory="$PROJECT_DIR$/.." vcs="Git" />
-  </component>
-</project>

+ 1 - 1
trackpoint-cpp/CMakeLists.txt → trackpoint-app/CMakeLists.txt

@@ -1,7 +1,7 @@
 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
 PROJECT(osgExample)
 
-FIND_PACKAGE(OpenSceneGraph REQUIRED COMPONENTS osgViewer osgDB osgGA osgText)
+FIND_PACKAGE(OpenSceneGraph REQUIRED COMPONENTS osgViewer osgDB osgGA osgText osgUtil)
 
 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
 

+ 0 - 0
trackpoint-cpp/main.cpp → trackpoint-app/main.cpp


+ 0 - 5
trackpoint-app/requirements.txt

@@ -1,5 +0,0 @@
-numpy-stl
-matplotlib
-PyQt6
-gmsh
-pygmsh

+ 0 - 22
trackpoint-app/trackpoint-app.py

@@ -1,22 +0,0 @@
-#!/usr/bin/env python3
-
-import numpy
-import stl
-from stl import mesh
-import pygmsh
-
-with pygmsh.geo.Geometry() as geom:
-    circle = geom.add_circle([0.0, 0.0], 1.0, mesh_size=0.2)
-    #geom.extrude(circle, [0.0, 0.3, 1.0], num_layers=5)
-    cube = geom.generate_mesh()
-
-meshx = mesh.Mesh.from_file("../testdata/zPlate_0.stl")
-
-
-
-combi = mesh.Mesh(numpy.concatenate([
-    meshx.data.copy(),
-    cube.data.copy(),
-]))
-
-combi.save("combi.stl", mode=stl.Mode.ASCII)

+ 84 - 0
trackpoint-app/transforms.cpp

@@ -0,0 +1,84 @@
+#include <osgViewer/Viewer>
+#include <osg/ShapeDrawable>
+#include <osg/Geode>
+#include <osgDB/ReadFile>
+#include <osg/Group>
+#include <osg/MatrixTransform>
+#include <osg/Matrix>
+#include <osgGA/TrackballManipulator>
+#include <osgUtil/LineSegmentIntersector>
+#include <osgUtil/IntersectionVisitor>
+#include <osg/PolygonMode>
+
+class PickHandler: public osgGA::GUIEventHandler {
+public:
+  osg::Node* getOrCreateSelectionPoint();
+  virtual bool handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa);
+
+protected:
+  osg::ref_ptr<osg::MatrixTransform> _selectionPoint;
+};
+
+osg::Node* PickHandler::getOrCreateSelectionPoint() {
+  if (!_selectionPoint) {
+    printf("Got here\n");
+  }
+  return _selectionPoint.get();
+}
+
+bool PickHandler::handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa) {
+  if (ea.getEventType() != osgGA::GUIEventAdapter::RELEASE || ea.getButton() != osgGA::GUIEventAdapter::LEFT_MOUSE_BUTTON || !(ea.getModKeyMask()&osgGA::GUIEventAdapter::MODKEY_CTRL)) {
+    return false;
+  }
+  osgViewer::Viewer* viewer = dynamic_cast<osgViewer::Viewer*>(&aa);
+  if (viewer) {
+    osg::ref_ptr<osgUtil::LineSegmentIntersector> intersector = new osgUtil::LineSegmentIntersector(osgUtil::Intersector::WINDOW, ea.getX(), ea.getY());
+    osgUtil::IntersectionVisitor iv(intersector.get());
+    iv.setTraversalMask(~0x1);
+    viewer->getCamera()->accept(iv);
+    if (intersector->containsIntersections()) {
+      osgUtil::LineSegmentIntersector::Intersection result = *(intersector->getIntersections().begin());
+      printf("Found intersection at: %lf, %lf, %lf\n", result.localIntersectionPoint.x(), result.localIntersectionPoint.y(), result.localIntersectionPoint.z());
+      printf("Intersection normals: %lf, %lf, %lf\n", result.localIntersectionNormal.x(), result.localIntersectionNormal.y(), result.localIntersectionNormal.z());
+    }
+  }
+  return false;
+}
+
+int main(int argc, char** argv)
+{
+    // Root node of the scene
+    osg::ref_ptr<osg::Group> root = new osg::Group;
+
+    // Create the viewer
+    osgViewer::Viewer viewer;
+    viewer.setSceneData(root);
+    viewer.realize();
+
+    // Add a small sphere
+    osg::ref_ptr<osg::ShapeDrawable> mouseSphere = new osg::ShapeDrawable;
+    mouseSphere->setShape(new osg::Sphere(osg::Vec3(3.0f, 0.0f, 0.0f), 1.0f));
+    mouseSphere->setColor(osg::Vec4(1.0f, 1.0f, 1.0f, 1.0f));
+
+    osg::ref_ptr<osg::Geode> mouseParent = new osg::Geode;
+    mouseParent->addDrawable(mouseSphere.get());
+    root->addChild(mouseParent);
+
+    // Add axesNode under root
+    osg::ref_ptr<osg::Node> axesNode = osgDB::readNodeFile("../../testdata/zPlate_0.stl");
+    if (!axesNode)
+    {
+        printf("Origin node not loaded, model not found\n");
+        return 1;
+    }
+    root->addChild(axesNode);
+
+    // Attach a manipulator (it's usually done for us when we use viewer.run())
+    osg::ref_ptr<osgGA::TrackballManipulator> tm = new osgGA::TrackballManipulator;
+    viewer.setCameraManipulator(tm);
+
+    osg::ref_ptr<PickHandler> picker = new PickHandler();
+    viewer.addEventHandler(picker.get());
+
+    return viewer.run();
+}

+ 0 - 32
trackpoint-cpp/transforms.cpp

@@ -1,32 +0,0 @@
-#include <osgViewer/Viewer>
-#include <osgDB/ReadFile>
-#include <osg/Group>
-#include <osg/MatrixTransform>
-#include <osg/Matrix>
-#include <osgGA/TrackballManipulator>
-
-int main(int argc, char** argv)
-{
-    // Root node of the scene
-    osg::ref_ptr<osg::Group> root = new osg::Group;
-
-    // Create the viewer
-    osgViewer::Viewer viewer;
-    viewer.setSceneData(root);
-    viewer.realize();
-
-    // Add axesNode under root
-    osg::ref_ptr<osg::Node> axesNode = osgDB::readNodeFile("test.stl");
-    if (!axesNode)
-    {
-        printf("Origin node not loaded, model not found\n");
-        return 1;
-    }
-    root->addChild(axesNode);
-
-    // Attach a manipulator (it's usually done for us when we use viewer.run())
-    osg::ref_ptr<osgGA::TrackballManipulator> tm = new osgGA::TrackballManipulator;
-    viewer.setCameraManipulator(tm);
-
-    return viewer.run();
-}