Giter Club home page Giter Club logo

compas_cgal's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

compas_cgal's Issues

Not Passing arguments in some function

Describe the bug

While using the library (freshly installed from anaconda) I’ve found out that meshing.py function: remesh does not pass the argument do_project to the meshing.remesh call…

I’ll look out for other miss like that in the future and report here if it’s ok with you

Implementation of CGAL functionality for surface reconstruction from point-clouds

Feature Request

As a user of compas, I want an extension for surface reconstruction from point-clouds so that work with point-clouds without relying on 3rd party software.

Details

Is your feature request related to a problem? Please describe.
As we discussed in the meeting on Monday (05.12.2022), a specific extension for point-cloud processing does not exist within the compas framework. We concluded that implementing the funcitonality provided by CGAL into compas_cgal would be a first remedy.

Describe the solution you'd like
The three relevant algorithms are quite precisely described here. It would be amazing to have them available.

Describe alternatives you've considered
Exploring Open3D's Python API in parallel (as discussed on Monday).

Examples not up-to-date

Describe the bug
Any example on this repository which have import from compas_viewers can't work because of the refactor that have been done.
the new examples should use compas_plotters.meshplotter apparently, I've tried to make the example work as expected but I didn't get there apparently, I'm still giving you the script that is close to the fix (to the best of my knowledge)

from compas.geometry import Box
from compas.geometry import Sphere
from compas.datastructures import Mesh

from compas_plotters.meshplotter import MeshPlotter

from compas_cgal.booleans import boolean_union
from compas_cgal.meshing import remesh

# ==============================================================================
# Make a box and a sphere
# ==============================================================================

box = Box.from_width_height_depth(2, 2, 2)
box = Mesh.from_shape(box)
box.quads_to_triangles()

A = box.to_vertices_and_faces()

sphere = Sphere(Point(1, 1, 1), 1)
sphere = Mesh.from_shape(sphere, u=30, v=30)
sphere.quads_to_triangles()

B = sphere.to_vertices_and_faces()

# ==============================================================================
# Remesh the sphere
# ==============================================================================

B = remesh(B, 0.3, 10)

# ==============================================================================
# Compute the boolean mesh
# ==============================================================================

V, F = boolean_union(A, B)

mesh = Mesh.from_vertices_and_faces(V, F)

# ==============================================================================
# Visualize
# ==============================================================================

plotter = MeshPlotter(mesh, color='#cccccc')
plotter.draw_edges()
plotter.draw_faces()


def onpick(event):
    index = event.ind[0]
    for i, text in enumerate(plotter.axes.texts):
        if i == index:
            text.set_visible(True)
        else:
            text.set_visible(False)
    plotter.update()


plotter.register_listener(onpick)
plotter.show()

To Reproduce

  1. install COMPAS and compas_cgal
  2. try to run the Example
  3. fail on import of compas_viewers

Expected behavior
A working example set which helps developer use this great cgal bindings.

Desktop (please complete the following information):

  • OS: Win10
  • Python version: 3.8
  • Python package manager: conda

What have we got here?

Feature Request

As a coder, I want know what this package is for so that my curiosity is sated.

Details

I've heard some chatter about compas_cgal mostly in compas issues/prs and I think I have an idea of what this does. C++ implementations of boolean operations? For quicker operations than numpy offers?

I think I might not be alone, so a short introduction in README.md and on doc website would be good I think :).

pip install fails

Describe the bug
Running pip install -e . fails.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new conda environment
  2. Clone compas_cgal on your computer
  3. Open terminal and navigate to the compas_cgal folder
  4. Activate the environment created in step 1.
  5. Run pip install -e .

Expected behavior
Install compas_cgal with no errors.

Desktop (please complete the following information):

  • OS: macOS Catalina 10.15.7
  • Python version: 3.8.6
  • Python package manager: conda

Additional context
This is the error output:

(cgal) ➜  compas_cgal git:(master) pip install -e .
Obtaining file:///Users/axydis/PROJECTS/python/compas_cgal
Installing collected packages: compas-cgal
  Running setup.py develop for compas-cgal
    ERROR: Command errored out with exit status 1:
     command: /Users/axydis/anaconda2/envs/cgal/bin/python3.8 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/Users/axydis/PROJECTS/python/compas_cgal/setup.py'"'"'; __file__='"'"'/Users/axydis/PROJECTS/python/compas_cgal/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps
         cwd: /Users/axydis/PROJECTS/python/compas_cgal/
    Complete output (41 lines):
    running develop
    running egg_info
    writing src/compas_cgal.egg-info/PKG-INFO
    writing dependency_links to src/compas_cgal.egg-info/dependency_links.txt
    writing top-level names to src/compas_cgal.egg-info/top_level.txt
    reading manifest file 'src/compas_cgal.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    no previously-included directories found matching '.github'
    no previously-included directories found matching '.vscode'
    no previously-included directories found matching 'data'
    no previously-included directories found matching 'docs'
    no previously-included directories found matching 'ext'
    no previously-included directories found matching 'scripts'
    no previously-included directories found matching 'temp'
    no previously-included directories found matching 'tests'
    no previously-included directories found matching 'var'
    no previously-included directories found matching 'wheels'
    warning: no previously-included files found matching 'requirements-dev.txt'
    warning: no previously-included files found matching 'pytest.ini'
    warning: no previously-included files found matching '.bumpversion.cfg'
    warning: no previously-included files found matching '.editorconfig'
    warning: no previously-included files found matching 'tasks.py'
    warning: no previously-included files found matching 'CONTRIBUTING.md'
    warning: no previously-included files matching '*.py[cod]' found anywhere in distribution
    warning: no previously-included files matching '__pycache__' found anywhere in distribution
    warning: no previously-included files matching '*.dylib' found anywhere in distribution
    warning: no previously-included files matching '*.nb[ic]' found anywhere in distribution
    warning: no previously-included files matching '.DS_Store' found anywhere in distribution
    writing manifest file 'src/compas_cgal.egg-info/SOURCES.txt'
    running build_ext
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/axydis/anaconda2/envs/cgal/include -arch x86_64 -I/Users/axydis/anaconda2/envs/cgal/include -arch x86_64 -I/Users/axydis/anaconda2/envs/cgal/include/python3.8 -c /var/folders/01/s2hrx_291sx8c2jpl2c70z1w0000gq/T/tmp2g4c4clp.cpp -o var/folders/01/s2hrx_291sx8c2jpl2c70z1w0000gq/T/tmp2g4c4clp.o -std=c++14
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/axydis/anaconda2/envs/cgal/include -arch x86_64 -I/Users/axydis/anaconda2/envs/cgal/include -arch x86_64 -I/Users/axydis/anaconda2/envs/cgal/include/python3.8 -c /var/folders/01/s2hrx_291sx8c2jpl2c70z1w0000gq/T/tmpra24vjbf.cpp -o var/folders/01/s2hrx_291sx8c2jpl2c70z1w0000gq/T/tmpra24vjbf.o -fvisibility=hidden
    building 'compas_cgal._cgal' extension
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/axydis/anaconda2/envs/cgal/include -arch x86_64 -I/Users/axydis/anaconda2/envs/cgal/include -arch x86_64 -DVERSION_INFO="0.1.1" -I./include -I/Users/axydis/anaconda2/envs/cgal/include/eigen3 -I/Users/axydis/anaconda2/envs/cgal/include -I/Users/axydis/anaconda2/envs/cgal/include/python3.8 -c src/booleans.cpp -o build/temp.macosx-10.9-x86_64-3.8/src/booleans.o -stdlib=libc++ -mmacosx-version-min=10.14 -DVERSION_INFO="0.1.1" -std=c++14 -fvisibility=hidden -DCGAL_DEBUG=1
    In file included from src/booleans.cpp:1:
    In file included from src/booleans.h:4:
    ./include/compas.h:4:10: fatal error: 'pybind11/eigen.h' file not found
    #include <pybind11/eigen.h>
             ^~~~~~~~~~~~~~~~~~
    1 error generated.
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Users/axydis/anaconda2/envs/cgal/bin/python3.8 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/Users/axydis/PROJECTS/python/compas_cgal/setup.py'"'"'; __file__='"'"'/Users/axydis/PROJECTS/python/compas_cgal/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps Check the logs for full command output.

compas_cgal.slicer.slice_mesh, open versus closed contours

Feature Request

As a user of the package, I want an extension of the compas_cgal.slicer.slice_mesh function so that I can use it for slicing open and closed meshes.

Details

Currently, the slice_mesh function returns a list of arrays that define the slice polylines. However, there is no information regarding whether the polyline represents an open or a closed contour. Instead, it would be nice if it also returned a boolean for example that defines if the first and the last point of each polyline are connected.

Describe alternatives you've considered
We considered having a distance threshold between the first and last points, but that seemed to us impossible to make reliable. So now we consider that all paths are closed, but of course, this limits the shapes that we can apply this method on.

Question about pybind11 and linking

Hi @brgcode ,

Thank you for a help during the visit in Zurich.

Short description what I did:
I went through compas_cgal in order to replicate the workflow by my code without installing this repo, simply by learning from the files that are uploaded here. I managed to run the slicer from C++ in compas_wood - new empty environment you helped to create.

My current workflow:

  1. I set up a Visual Studio 2019 project that links pybind11, CGAL, boost and eigen.
    Compiles without issues.

  2. Then I added 4 files in compas_wood with a more or less similar code to original repo:
    slicer.py
    slicer.pyi
    types.py
    test_slicer.py
    CGAL.zip

  3. Lastly I tested tect_slicer.py and I get a result of 338 polylines, which I assume is correct and verifies that C++ and CPython talks to each other:
    image

Question:
How do you link C++ Python binding directly in VS Code because I have to write following path which I assume is different on every computer and depending on operating system these bindings must be compiled differently on each machine:

I know that this can be difficult to explain, but I need this to move forward and depending on your time I could come to Zurich if needed.

import sys
folder = "C:/IBOIS57/_Code/Software/Python/Pybind11Example/vsstudio/Release/"
if folder not in sys.path:
    sys.path.append(folder)
import pybind11module

In my case I have a Visual Studio 2019 project that helps to debug the code, link libraries and build pybind11module.cp38-win_amd64.pyd file:
image


import numpy as np
from compas.plugins import plugin

#Import module from folder instead of using -> from _cgal import slicer

import sys
folder = "C:/IBOIS57/_Code/Software/Python/Pybind11Example/vsstudio/Release/"
if folder not in sys.path:
    sys.path.append(folder)
import pybind11module


@plugin(category='trimesh', pluggable_name='trimesh_slice')
def slice_meshPython(mesh, planes):
    """Slice a mesh by a list of planes.
    Parameters
    ----------
    mesh : tuple of vertices and faces
        The mesh to slice.
    planes : list of (point, normal) tuples or compas.geometry.Plane
        The slicing planes.
    Returns
    -------
    list of arrays
        The points defining the slice polylines.
    """
    vertices, faces = mesh
    points, normals = zip(*planes)
    V = np.asarray(vertices, dtype=np.float64)
    F = np.asarray(faces, dtype=np.int32)
    P = np.array(points, dtype=np.float64)
    N = np.array(normals, dtype=np.float64)

    pybind11module.say_hello()
    pointsets = pybind11module.slicerCGAL.slice_meshCGAL(V, F, P, N)
    return pointsets



image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.