فهرست منبع

Fix tutorial 102_tcp and tutorial 303

Former-commit-id: 2d55c372b0c5dfca03ae1463557cebde5be9e713
s-koch 8 سال پیش
والد
کامیت
dd743f2175
3فایلهای تغییر یافته به همراه45 افزوده شده و 48 حذف شده
  1. 40 40
      python/py_igl/py_unique.cpp
  2. 4 2
      python/tcpviewer.py
  3. 1 6
      python/tutorial/102_DrawMesh_TCP.py

+ 40 - 40
python/py_igl/py_unique.cpp

@@ -32,27 +32,27 @@ m.def("unique_rows", []
 }, __doc_igl_unique,
 py::arg("A"), py::arg("C"), py::arg("IA"), py::arg("IC"));
 
-m.def("unique", []
-(
-  const std::vector<double> & A,
-  std::vector<double> & C,
-  std::vector<size_t> & IA,
-  std::vector<size_t> & IC
-)
-{
-  return igl::unique(A,C,IA,IC);
-}, __doc_igl_unique,
-py::arg("A"), py::arg("C"), py::arg("IA"), py::arg("IC"));
+//m.def("unique", []
+//(
+//  const std::vector<double> & A,
+//  std::vector<double> & C,
+//  std::vector<size_t> & IA,
+//  std::vector<size_t> & IC
+//)
+//{
+//  return igl::unique(A,C,IA,IC);
+//}, __doc_igl_unique,
+//py::arg("A"), py::arg("C"), py::arg("IA"), py::arg("IC"));
 
-m.def("unique", []
-(
-  const std::vector<double> & A,
-  std::vector<double> & C
-)
-{
-  return igl::unique(A,C);
-}, __doc_igl_unique,
-py::arg("A"), py::arg("C"));
+//m.def("unique", []
+//(
+//  const std::vector<double> & A,
+//  std::vector<double> & C
+//)
+//{
+//  return igl::unique(A,C);
+//}, __doc_igl_unique,
+//py::arg("A"), py::arg("C"));
 
 
 // int
@@ -92,24 +92,24 @@ m.def("unique_rows", []
 }, __doc_igl_unique,
 py::arg("A"), py::arg("C"), py::arg("IA"), py::arg("IC"));
 
-m.def("unique", []
-(
-  const std::vector<int> & A,
-  std::vector<int> & C,
-  std::vector<size_t> & IA,
-  std::vector<size_t> & IC
-)
-{
-  return igl::unique(A,C,IA,IC);
-}, __doc_igl_unique,
-py::arg("A"), py::arg("C"), py::arg("IA"), py::arg("IC"));
+//m.def("unique", []
+//(
+//  const std::vector<int> & A,
+//  std::vector<int> & C,
+//  std::vector<size_t> & IA,
+//  std::vector<size_t> & IC
+//)
+//{
+//  return igl::unique(A,C,IA,IC);
+//}, __doc_igl_unique,
+//py::arg("A"), py::arg("C"), py::arg("IA"), py::arg("IC"));
 
-m.def("unique", []
-(
-  const std::vector<int> & A,
-  std::vector<int> & C
-)
-{
-  return igl::unique(A,C);
-}, __doc_igl_unique,
-py::arg("A"), py::arg("C"));
+//m.def("unique", []
+//(
+//  const std::vector<int> & A,
+//  std::vector<int> & C
+//)
+//{
+//  return igl::unique(A,C);
+//}, __doc_igl_unique,
+//py::arg("A"), py::arg("C"));

+ 4 - 2
python/tcpviewer.py

@@ -16,7 +16,7 @@ def worker(viewer,lock,s):
             lock.acquire()
             slist = []
             while True:
-                buf = conn.recv(10000000)
+                buf = conn.recv(4096)
                 if not buf:
                     break
                 slist.append(buf.decode('unicode_internal','ignore'))
@@ -41,7 +41,9 @@ class TCPViewer(igl.viewer.Viewer):
         try:
             s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
             s.connect((HOST, PORT))
-            a = array.array('u',self.data.serialize())
+            ser = self.data.serialize()
+            print(len(ser))
+            a = array.array('u', ser)
             s.sendall(a)
             s.close()
         except:

+ 1 - 6
python/tutorial/102_DrawMesh_TCP.py

@@ -10,12 +10,7 @@ from shared import TUTORIAL_SHARED_PATH
 
 
 ## This is a test application for the TCPViewer
-
-# Launch the tcp viewer
-os.system("python ../tcpviewer.py&")
-
-# Wait for it to set up the socket
-time.sleep(1)
+# Make sure to launch the tcpviewer.py first
 
 # Read a mesh
 V = igl.eigen.MatrixXd()