compas-dev / compas_cgal Goto Github PK
View Code? Open in Web Editor NEWCOMPAS package for working with CGAL.
Home Page: https://compas.dev/compas_cgal
License: GNU Lesser General Public License v3.0
COMPAS package for working with CGAL.
Home Page: https://compas.dev/compas_cgal
License: GNU Lesser General Public License v3.0
As a coder, I want know what this package is for so that my curiosity is sated.
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 :).
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
The current requirements.txt
lists compas_viewer
as dependency, but that should be an optional one because nothing in the source code seems to depend on it, only examples.
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.
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.
Describe the bug
Running pip install -e .
fails.
To Reproduce
Steps to reproduce the behavior:
compas_cgal
on your computercompas_cgal
folderpip install -e .
Expected behavior
Install compas_cgal
with no errors.
Desktop (please complete the following information):
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.
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
Expected behavior
A working example set which helps developer use this great cgal bindings.
Desktop (please complete the following information):
Hi,
I would like to ask what does the star symbol mean in Slicer:
https://github.com/compas-dev/compas_cgal/blob/main/tests/test_slicer.py
Does the Point(*point) has something to do with the pointers in C++?
polylines = []
for points in pointsets:
points = [Point(*point) for point in points]
polyline = Polyline(points)
polylines.append(polyline)
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.
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).
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:
I set up a Visual Studio 2019 project that links pybind11, CGAL, boost and eigen.
Compiles without issues.
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
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:
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:
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
As mentioned in compas-dev/compas#698.
Probably a github setting wrong somewhere.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.