-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/compas-dev/compas_cgal
- Loading branch information
Showing
15 changed files
with
518 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
from compas.datastructures import Graph | ||
from compas.geometry import Polygon | ||
from compas_viewer import Viewer | ||
|
||
from compas_cgal.straight_skeleton_2 import create_interior_straight_skeleton_with_holes | ||
|
||
points = [ | ||
(-1.91, 3.59, 0.0), | ||
(-5.53, -5.22, 0.0), | ||
(-0.39, -1.98, 0.0), | ||
(2.98, -5.51, 0.0), | ||
(4.83, -2.02, 0.0), | ||
(9.70, -3.63, 0.0), | ||
(12.23, 1.25, 0.0), | ||
(3.42, 0.66, 0.0), | ||
(2.92, 4.03, 0.0), | ||
(-1.91, 3.59, 0.0), | ||
] | ||
|
||
holes = [ | ||
[(0.42, 0.88, 0.0), (1.1, -1.0, 0.0), (-1.97, -0.93, 0.0), (-1.25, 1.82, 0.0)], | ||
[(4.25, -0.64, 0.0), (2.9, -3.03, 0.0), (2.12, -2.16, 0.0), (2.89, -0.36, 0.0)], | ||
[(10.6, 0.29, 0.0), (9.48, -1.54, 0.0), (5.48, -1.26, 0.0), (5.98, -0.04, 0.0)], | ||
] | ||
|
||
|
||
polygon = Polygon(points) | ||
holes = [Polygon(hole) for hole in holes] | ||
lines = create_interior_straight_skeleton_with_holes(polygon, holes) | ||
graph = Graph.from_lines(lines) | ||
|
||
# ============================================================================== | ||
# Viz | ||
# ============================================================================== | ||
|
||
viewer = Viewer(width=1600, height=900) | ||
viewer.renderer_config.show_grid = False | ||
viewer.scene.add(graph, edgecolor=(1.0, 0.0, 0.0)) | ||
viewer.scene.add(polygon) | ||
for hole in holes: | ||
viewer.scene.add(hole) | ||
viewer.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
from compas.geometry import Polygon | ||
from compas_viewer import Viewer | ||
|
||
from compas_cgal.straight_skeleton_2 import create_offset_polygons_2 | ||
|
||
points = [ | ||
(-1.91, 3.59, 0.0), | ||
(-5.53, -5.22, 0.0), | ||
(-0.39, -1.98, 0.0), | ||
(2.98, -5.51, 0.0), | ||
(4.83, -2.02, 0.0), | ||
(9.70, -3.63, 0.0), | ||
(12.23, 1.25, 0.0), | ||
(3.42, 0.66, 0.0), | ||
(2.92, 4.03, 0.0), | ||
(-1.91, 3.59, 0.0), | ||
] | ||
polygon = Polygon(points) | ||
offset = 1.5 | ||
|
||
offset_polygons_inner = create_offset_polygons_2(points, offset) | ||
offset_polygons_outer = create_offset_polygons_2(points, -offset) | ||
|
||
# ============================================================================== | ||
# Viz | ||
# ============================================================================== | ||
|
||
viewer = Viewer(width=1600, height=900) | ||
viewer.scene.add(polygon) | ||
viewer.config.renderer.show_grid = False | ||
|
||
for opolygon in offset_polygons_inner: | ||
viewer.scene.add(opolygon, linecolor=(1.0, 0.0, 0.0), facecolor=(1.0, 1.0, 1.0, 0.0)) | ||
for opolygon in offset_polygons_outer: | ||
viewer.scene.add(opolygon, linecolor=(0.0, 0.0, 1.0), facecolor=(1.0, 1.0, 1.0, 0.0)) | ||
|
||
viewer.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
from compas.geometry import Polygon | ||
from compas_viewer import Viewer | ||
|
||
from compas_cgal.straight_skeleton_2 import create_weighted_offset_polygons_2 | ||
|
||
points = [ | ||
(-1.91, 3.59, 0.0), | ||
(-5.53, -5.22, 0.0), | ||
(-0.39, -1.98, 0.0), | ||
(2.98, -5.51, 0.0), | ||
(4.83, -2.02, 0.0), | ||
(9.70, -3.63, 0.0), | ||
(12.23, 1.25, 0.0), | ||
(3.42, 0.66, 0.0), | ||
(2.92, 4.03, 0.0), | ||
(-1.91, 3.59, 0.0), | ||
] | ||
polygon = Polygon(points) | ||
|
||
|
||
distances = [0.1, 0.3, 0.6, 0.1, 0.7, 0.5, 0.2, 0.4, 0.8, 0.2] | ||
weights = [1.0 / d for d in distances] | ||
offset = 1.0 | ||
offset_polygons_outer = create_weighted_offset_polygons_2(points, -offset, weights) | ||
|
||
# ============================================================================== | ||
# Viz | ||
# ============================================================================== | ||
|
||
viewer = Viewer(width=1600, height=900) | ||
viewer.scene.add(polygon) | ||
viewer.config.renderer.show_grid = False | ||
|
||
for opolygon in offset_polygons_outer: | ||
viewer.scene.add(opolygon, linecolor=(0.0, 0.0, 1.0), facecolor=(1.0, 1.0, 1.0, 0.0)) | ||
|
||
viewer.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.