Skip to content

Commit 52615c6

Browse files
Copilotlachlangrose
andcommitted
Address code review comments
Co-authored-by: lachlangrose <7371904+lachlangrose@users.noreply.github.com>
1 parent f16325d commit 52615c6

9 files changed

Lines changed: 13 additions & 16 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ jobs:
2727
- if: matrix.os == 'ubuntu-latest'
2828
run: |
2929
sudo apt-get install -y libgl1-mesa-dev libeigen3-dev libcgal-dev
30-
- if: matrix.os == 'macos-latest' || matrix.os == 'macos-14'
31-
run: |
30+
- if: ${{ startsWith(matrix.os, 'macos') }}
31+
run: |
3232
brew install cgal
3333
# Cache vcpkg on Windows
3434
- name: Restore vcpkg cache

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,11 @@ add_library(_loop_cgal MODULE
2424

2525
target_link_libraries(_loop_cgal PRIVATE pybind11::module CGAL::CGAL)
2626
target_include_directories(_loop_cgal PRIVATE ${CMAKE_SOURCE_DIR}/src)
27-
set_target_properties(_loop_cgal PROPERTIES PREFIX "" SUFFIX ".so")
2827

2928
if(WIN32)
3029
set_target_properties(_loop_cgal PROPERTIES PREFIX "" SUFFIX ".pyd")
30+
else()
31+
set_target_properties(_loop_cgal PROPERTIES PREFIX "" SUFFIX ".so")
3132
endif()
3233

3334
# Windows: copy required DLLs from VCPKG_ROOT

examples/cut_example.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import numpy as np
2-
import pyvista as pv
32
from loop_cgal import TriMesh, set_verbose
43
from LoopStructural.datatypes import BoundingBox
54
set_verbose(True)

loop_cgal/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def __init__(self, surface: pv.PolyData):
3030
# Extract vertices and triangles
3131
verts = np.array(surface.points, dtype=np.float64).copy()
3232
faces = surface.faces.reshape(-1, 4)[:, 1:].copy().astype(np.int32)
33-
if (not validate_vertices_and_faces(verts, faces)):
33+
if not validate_vertices_and_faces(verts, faces):
3434
raise ValueError("Invalid surface geometry")
3535

3636
super().__init__(verts, faces)
@@ -54,7 +54,7 @@ def from_vertices_and_triangles(
5454
The created TriMesh object.
5555
"""
5656
# Create a temporary PyVista PolyData object for validation
57-
if (not validate_vertices_and_faces(vertices, triangles)):
57+
if not validate_vertices_and_faces(vertices, triangles):
5858
raise ValueError("Invalid vertices or triangles")
5959
surface = pv.PolyData(vertices, np.hstack((np.full((triangles.shape[0], 1), 3), triangles)).flatten())
6060
return cls(surface)

loop_cgal/utils.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def validate_pyvista_polydata(
3232
raise ValueError(f"{surface_name} points contain NaN or infinite values")
3333

3434

35-
def validate_vertices_and_faces(verts, faces) -> bool:
35+
def validate_vertices_and_faces(verts, faces):
3636
"""Validate vertices and faces arrays.
3737
Parameters
3838
----------
@@ -42,10 +42,6 @@ def validate_vertices_and_faces(verts, faces) -> bool:
4242
faces : np.ndarray
4343
4444
An array of shape (n_faces, 3) containing the triangle vertex indices.
45-
Returns
46-
-------
47-
bool
48-
True if valid, False otherwise.
4945
Raises
5046
------
5147
ValueError

pyproject.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ classifiers = [
2727
]
2828

2929
dependencies = ['pyvista','vtk','scipy','numpy']
30-
optional-dependencies = { test = ['pytest'] }
30+
31+
[project.optional-dependencies]
32+
test = ['pytest']
3133

3234
[tool.scikit-build]
3335
wheel.expand-macos-universal-tags = true

src/mesh.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ void TriMesh::cutWithSurface(TriMesh &clipper,
294294
bool preserve_intersection_clipper,
295295
bool use_exact_kernel)
296296
{
297-
297+
298298
if (LoopCGAL::verbose)
299299
{
300300
std::cout << "Cutting mesh with surface." << std::endl;
@@ -692,7 +692,7 @@ void TriMesh::cut_with_implicit_function(const std::vector<double> &property, do
692692
double v0 = newvals[tri[0]];
693693
double v1 = newvals[tri[1]];
694694
double v2 = newvals[tri[2]];
695-
if (v0 <= value && v1 <= value && v2 <= value)
695+
if (v0 < value && v1 < value && v2 < value)
696696
{
697697
continue;
698698
}

src/meshutils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ double calculate_triangle_area(const std::array<double, 3> &v1,
1010
const std::array<double, 3> &v3);
1111
Exact_Mesh convert_to_exact(const TriMesh& input);
1212
TriangleMesh convert_to_double_mesh(const Exact_Mesh& input);
13-
13+
1414
#endif // MESHUTILS_H

tests/test_mesh_operations.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
def square_surface():
1111
# Unit square made of two triangles
1212
return pv.Plane(center=(0,0,0),direction=(0,0,1),i_size=1.0,j_size=1.0)
13-
1413

1514

1615
@pytest.fixture

0 commit comments

Comments
 (0)