Skip to content

Commit

Permalink
Merge branch 'main' into feature/straight_skeleton_2
Browse files Browse the repository at this point in the history
  • Loading branch information
romanarust committed Apr 25, 2024
2 parents 032fae0 + e91ac21 commit 6c623b6
Show file tree
Hide file tree
Showing 44 changed files with 468 additions and 475 deletions.
17 changes: 0 additions & 17 deletions .bumpversion.cfg

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
strategy:
matrix:
os: [macos-latest, windows-latest]
python: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python: ["3.9", "3.10", "3.11", "3.12"]

steps:
- uses: compas-dev/compas-actions.build@v3
- uses: compas-dev/compas-actions.build@v4
with:
invoke_lint: true
check_import: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
docs:
runs-on: windows-latest
steps:
- uses: compas-dev/compas-actions.docs@v2
- uses: compas-dev/compas-actions.docs@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
use_conda: true
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ ENV/
*.rui_bak
*.so

temp/**
temp

.DS_Store

Expand All @@ -128,3 +128,7 @@ generated

recipe/**
!recipe/sha256.py

.pytest_cache
.ruff_cache
.vscode
5 changes: 0 additions & 5 deletions AUTHORS.md

This file was deleted.

22 changes: 0 additions & 22 deletions CONTRIBUTING.md

This file was deleted.

29 changes: 0 additions & 29 deletions MANIFEST.in

This file was deleted.

8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,21 @@ and compile and install an editable version of `compas_cgal` using `setuptools`.
**Windows**:

```bash
conda create -n cgal-dev python=3.8 mpir mpfr boost-cpp eigen=3.3 cgal-cpp=5.2 pybind11 compas compas_view2 scip --yes
conda create -n cgal-dev python=3.9 mpir mpfr boost-cpp eigen=3.3 cgal-cpp pybind11 --yes
conda activate cgal-dev
git clone https://github.com/compas-dev/compas_cgal
cd compas_cgal
pip install -e .
pip install -e .'[dev]'
```

**Mac**:

```bash
conda create -n cgal-dev python=3.8 gmp mpfr boost-cpp eigen=3.3 cgal-cpp=5.2 pybind11 compas compas_view2 --yes
conda create -n cgal-dev python=3.9 gmp mpfr boost-cpp eigen=3.3 cgal-cpp pybind11 --yes
conda activate cgal-dev
git clone https://github.com/compas-dev/compas_cgal
cd compas_cgal
pip install -e .
pip install -e .'[dev]'
```

> Note that the version of eigen is important and should be `3.3`.
Expand Down
19 changes: 10 additions & 9 deletions docs/examples/booleans.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
from compas.geometry import Box
from compas.geometry import Sphere
from compas.geometry import Polyhedron

from compas_view2.app import App

from compas.geometry import Sphere
from compas_cgal.booleans import boolean_union_mesh_mesh
from compas_cgal.meshing import mesh_remesh
from compas_viewer import Viewer

# ==============================================================================
# Make a box and a sphere
Expand All @@ -30,14 +28,17 @@
V, F = boolean_union_mesh_mesh(A, B)
shape = Polyhedron(V.tolist(), F.tolist()) # revise the Shape API

# temp solution until viewer supports polyhedrons
shape = shape.to_mesh()

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

viewer = App(width=1600, height=900)
viewer.view.camera.position = [5, -4, 2]
viewer.view.camera.look_at([0, 1, 0])
viewer = Viewer()

viewer.add(shape, linewidth=2)
# viewer.ui.window.viewport.view3d.camera.position = [...]
# viewer.ui.window.viewport.view3d.camera.target = [...]

viewer.run()
viewer.scene.add(shape, linewidth=2, show_points=False)
viewer.show()
27 changes: 13 additions & 14 deletions docs/examples/intersections.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
from compas.geometry import Point
from compas.datastructures import Mesh
from compas.geometry import Box
from compas.geometry import Sphere
from compas.geometry import Point
from compas.geometry import Polyline
from compas.datastructures import Mesh

from compas_view2.app import App

from compas.geometry import Sphere
from compas_cgal.intersections import intersection_mesh_mesh
from compas_viewer import Viewer

# ==============================================================================
# Make a box and a sphere
Expand Down Expand Up @@ -38,19 +36,20 @@
# Visualize
# ==============================================================================

viewer = App(width=1600, height=900)
viewer.view.camera.position = [5, -4, 2]
viewer.view.camera.look_at([0, 1, 0])
viewer = Viewer()

# viewer.ui.window.viewport.view3d.camera.position = [...]
# viewer.ui.window.viewport.view3d.camera.target = [...]

viewer.add(Mesh.from_vertices_and_faces(*A), facecolor=(1, 0, 0), opacity=0.3)
viewer.add(Mesh.from_vertices_and_faces(*B), facecolor=(0, 1, 0), opacity=0.3)
viewer.scene.add(Mesh.from_vertices_and_faces(*A), facecolor=(1.0, 0.0, 0.0), show_points=False)
viewer.scene.add(Mesh.from_vertices_and_faces(*B), facecolor=(0.0, 1.0, 0.0), show_points=False, opacity=0.3)

for polyline in polylines:
viewer.add(
viewer.scene.add(
polyline,
linecolor=(0, 0, 1),
linecolor=(0.0, 0.0, 1.0),
linewidth=3,
pointcolor=(0, 0, 1),
pointcolor=(0.0, 0.0, 1.0),
pointsize=20,
show_points=True,
)
Expand Down
22 changes: 12 additions & 10 deletions docs/examples/mesh_split.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from compas.geometry import Box, Sphere
from compas.datastructures import Mesh
from compas.colors import Color
from compas_view2.app import App

from compas.datastructures import Mesh
from compas.geometry import Box
from compas.geometry import Sphere
from compas_cgal.booleans import split_mesh_mesh
from compas_viewer import Viewer

# ==============================================================================
# Make a box and a sphere
Expand All @@ -27,17 +27,19 @@
# Seperate disjoint faces and visualize
# ==============================================================================

viewer = App(width=1600, height=900)
viewer.view.camera.position = [5, -4, 2]
viewer.view.camera.look_at([0, 0, 0])
viewer = Viewer()

for color, vertices in zip([Color.blue(), Color.pink()], mesh.connected_components()):
# viewer.ui.window.viewport.view3d.camera.position = [...]
# viewer.ui.window.viewport.view3d.camera.target = [...]

for color, vertices in zip([Color.blue(), Color.pink()], mesh.connected_vertices()):
faces = []
for indices in F:
if all(index in vertices for index in indices):
faces.append(indices)
mesh = Mesh.from_vertices_and_faces(V, faces)
mesh.remove_unused_vertices()
viewer.add(mesh, facecolor=color)

viewer.run()
viewer.scene.add(mesh, facecolor=color, show_points=False)

viewer.show()
33 changes: 20 additions & 13 deletions docs/examples/pointset_reduction.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
from pathlib import Path
from compas.geometry import Pointcloud, Translation
from compas_view2.app import App

from compas.colors import Color
from compas.geometry import Point
from compas.geometry import Pointcloud
from compas.geometry import Translation
from compas_cgal.reconstruction import pointset_reduction
from compas_viewer import Viewer

# Define the file path for the point cloud data
FILE = Path(__file__).parent.parent.parent / "data" / "forked_branch_1.ply"
Expand All @@ -19,19 +23,22 @@
points = pointset_reduction(cloud, 50)
print(f"Original points: {len(cloud)}, Reduced points: {len(points)}")

# =============================================================================
# Viz
# =============================================================================

# Initialize the COMPAS viewer
viewer = App(width=1600, height=900)
viewer = Viewer()

# viewer.ui.window.viewport.view3d.camera.position = [...]
# viewer.ui.window.viewport.view3d.camera.target = [...]

# Adjust viewer settings
viewer.view.camera.scale = 1000
viewer.view.grid.cell_size = 1000
# viewer.scene.add(Pointcloud(points))
# viewer.scene.add(Pointcloud(original_points))

# Add the reduced point cloud and the original point cloud to the viewer
viewer.add(Pointcloud(points))
viewer.add(Pointcloud(original_points))
for x, y, z in points:
viewer.scene.add(Point(x, y, z).scaled(1e-3, 1e-3, 1e-3))

# Set the camera to zoom to fit all points
viewer.view.camera.zoom_extents()
# viewer.view.camera.zoom_extents()

# Run the viewer
viewer.run()
viewer.show()
22 changes: 14 additions & 8 deletions docs/examples/pointsets.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from pathlib import Path

from compas.geometry import Pointcloud
from compas_view2.app import App
from compas_cgal.reconstruction import pointset_outlier_removal
from compas_viewer import Viewer

FILE = Path(__file__).parent.parent.parent / "data" / "forked_branch_1.ply"

Expand All @@ -12,12 +13,17 @@
cloud2 = Pointcloud(points)
could3 = cloud1.difference(cloud2)

viewer = App(width=1600, height=900)
viewer.view.camera.scale = 1000
viewer.view.grid.cell_size = 1000
# =============================================================================
# Viz
# =============================================================================

viewer = Viewer()

# viewer.view.camera.scale = 1000
# viewer.view.grid.cell_size = 1000

viewer.add(cloud2)
viewer.add(could3, pointcolor=(1.0, 0.0, 0.0))
viewer.scene.add(cloud2)
viewer.scene.add(could3, pointcolor=(1.0, 0.0, 0.0))

viewer.view.camera.zoom_extents()
viewer.run()
# viewer.view.camera.zoom_extents()
viewer.show()
Loading

0 comments on commit 6c623b6

Please sign in to comment.