Skip to content

Commit

Permalink
Merge pull request #2169 from mikedh/fix/thint
Browse files Browse the repository at this point in the history
Release: Hint Fixes
  • Loading branch information
mikedh authored Feb 29, 2024
2 parents 3966450 + d1cdc44 commit b9f82a5
Show file tree
Hide file tree
Showing 58 changed files with 97 additions and 22 deletions.
1 change: 1 addition & 0 deletions examples/sinter.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
A demo for packing a volume with multiple meshes as you
might for a powder volume in a sintered printing process.
"""

import os

import numpy as np
Expand Down
1 change: 0 additions & 1 deletion examples/widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ def create_scene():


class Application:

"""
Example application that includes moving camera, scene and image update.
"""
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ requires = ["setuptools >= 61.0", "wheel"]
[project]
name = "trimesh"
requires-python = ">=3.7"
version = "4.1.6"
version = "4.1.7"
authors = [{name = "Michael Dawson-Haggerty", email = "[email protected]"}]
license = {file = "LICENSE.md"}
description = "Import, export, process, analyze and view triangular meshes."
Expand Down
1 change: 1 addition & 0 deletions tests/corpus.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Test loaders against large corpuses of test data from github:
will download more than a gigabyte to your home directory!
"""

import numpy as np
from pyinstrument import Profiler

Expand Down
1 change: 1 addition & 0 deletions tests/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Module which contains most imports and data unit tests
might need, to reduce the amount of boilerplate.
"""

import os
import sys
import json
Expand Down
1 change: 1 addition & 0 deletions tests/test_base.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Test the base trimesh.Trimesh object.
"""

try:
from . import generic as g
except BaseException:
Expand Down
1 change: 1 addition & 0 deletions tests/test_copy.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Copy meshes and make sure they do what we expect.
"""

try:
from . import generic as g
except BaseException:
Expand Down
1 change: 1 addition & 0 deletions tests/test_geom.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Load all the meshes we can get our hands on and check things, stuff.
"""

try:
from . import generic as g
except BaseException:
Expand Down
9 changes: 9 additions & 0 deletions tests/test_gmsh.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ def test_generate(self):
result = g.trimesh.interfaces.gmsh.to_volume(m)
assert len(result) > 0

def test_load(self):
if gmsh is None:
return
r = g.trimesh.interfaces.gmsh.load_gmsh(
g.os.path.join(g.dir_models, "wrench.STEP")
)
assert isinstance(r, dict)
assert len(g.trimesh.Trimesh(**r).faces) > 0


if __name__ == "__main__":
g.trimesh.util.attach_to_log()
Expand Down
1 change: 1 addition & 0 deletions tests/test_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
Make sure trimesh is importing right.
"""

import unittest


Expand Down
1 change: 1 addition & 0 deletions tests/test_mesh.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Load all the meshes we can get our hands on and check things, stuff.
"""

try:
from . import generic as g
except BaseException:
Expand Down
1 change: 1 addition & 0 deletions tests/test_minimal.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"""

import os
import unittest

Expand Down
1 change: 1 addition & 0 deletions tests/test_off.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Load all the meshes we can get our hands on and check things, stuff.
"""

try:
from . import generic as g
except BaseException:
Expand Down
1 change: 1 addition & 0 deletions tests/test_pathlib.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Test loading from pathlib objects.
"""

try:
from . import generic as g
except BaseException:
Expand Down
1 change: 1 addition & 0 deletions tests/test_stl.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Check things related to STL files
"""

try:
from . import generic as g
except BaseException:
Expand Down
1 change: 1 addition & 0 deletions trimesh/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
provide a fully featured Trimesh object which allows for easy manipulation
and analysis, in the style of the Polygon object in the Shapely library.
"""

# avoid a circular import in trimesh.base
from . import (
boolean,
Expand Down
15 changes: 9 additions & 6 deletions trimesh/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1691,24 +1691,27 @@ def remove_degenerate_faces(self, height: float = tol.merge) -> None:

def nondegenerate_faces(self, height: float = tol.merge) -> NDArray[bool]:
"""
Remove degenerate faces (faces without 3 unique vertex indices)
from the current mesh.
Identify degenerate faces (faces without 3 unique vertex indices)
in the current mesh.
If a height is specified, it will remove any face with a 2D oriented
Usage example for removing them:
`mesh.update_faces(mesh.nondegenerate_faces())`
If a height is specified, it will identify any face with a 2D oriented
bounding box with one edge shorter than that height.
If not specified, it will remove any face with a zero normal.
If not specified, it will identify any face with a zero normal.
Parameters
------------
height : float
If specified removes faces with an oriented bounding
If specified identifies faces with an oriented bounding
box shorter than this on one side.
Returns
-------------
nondegenerate : (len(self.faces), ) bool
Mask used to remove faces
Mask that can be used to remove faces
"""
return triangles.nondegenerate(
self.triangles, areas=self.area_faces, height=height
Expand Down
10 changes: 5 additions & 5 deletions trimesh/boolean.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import numpy as np

from . import exceptions, interfaces
from .typed import Optional, Sequence
from .typed import Iterable, Optional

try:
from manifold3d import Manifold, Mesh
Expand All @@ -18,7 +18,7 @@


def difference(
meshes: Sequence, engine: Optional[str] = None, check_volume: bool = True, **kwargs
meshes: Iterable, engine: Optional[str] = None, check_volume: bool = True, **kwargs
):
"""
Compute the boolean difference between a mesh an n other meshes.
Expand Down Expand Up @@ -48,7 +48,7 @@ def difference(


def union(
meshes: Sequence, engine: Optional[str] = None, check_volume: bool = True, **kwargs
meshes: Iterable, engine: Optional[str] = None, check_volume: bool = True, **kwargs
):
"""
Compute the boolean union between a mesh an n other meshes.
Expand Down Expand Up @@ -79,7 +79,7 @@ def union(


def intersection(
meshes: Sequence, engine: Optional[str] = None, check_volume: bool = True, **kwargs
meshes: Iterable, engine: Optional[str] = None, check_volume: bool = True, **kwargs
):
"""
Compute the boolean intersection between a mesh and other meshes.
Expand Down Expand Up @@ -108,7 +108,7 @@ def intersection(


def boolean_manifold(
meshes: Sequence,
meshes: Iterable,
operation: str,
check_volume: bool = True,
debug: bool = False,
Expand Down
1 change: 1 addition & 0 deletions trimesh/caching.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
3.37 us +/- 116 ns per loop
```
"""

import os
import sys
import time
Expand Down
1 change: 1 addition & 0 deletions trimesh/curvature.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
Query mesh curvature.
"""

import numpy as np

from . import util
Expand Down
1 change: 1 addition & 0 deletions trimesh/exchange/binvox.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
Exporting meshes as binvox files requires the
`binvox` executable to be in your path.
"""

import collections
import os
import subprocess
Expand Down
16 changes: 16 additions & 0 deletions trimesh/exchange/openctm.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# DEPRECATED AND WILL BE REMOVED MAY 2024!
# This should be built into wheels separately if someone
# wants to maintain a ctypes binding of openctm, e.g.
# https://github.com/trimesh/vhacdx


# Modified from the original OpenCTM python binding
# for inclusion in the `trimesh` package:
# https://github.com/mikedh/trimesh
Expand Down Expand Up @@ -31,9 +37,19 @@
import ctypes
import ctypes.util
import os
import warnings

import numpy as np

warnings.warn(
"trimesh.exchange.openctm is deprecated "
+ " and will be removed May 2025! Copy `openctm.py`"
+ " into your own project!",
category=DeprecationWarning,
stacklevel=2,
)


_ctm_loaders = {}

try:
Expand Down
1 change: 1 addition & 0 deletions trimesh/exchange/threedxml.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
Load 3DXML files, a scene format from Dassault products like Solidworks, Abaqus, Catia
"""

import numpy as np

try:
Expand Down
1 change: 1 addition & 0 deletions trimesh/exchange/xaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
Load 3D XAMl files, an export option from Solidworks.
"""

import collections

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions trimesh/intersections.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
Primarily mesh-plane intersections (slicing).
"""

import numpy as np

from . import geometry, grouping, util
Expand Down
1 change: 1 addition & 0 deletions trimesh/nsphere.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Functions for fitting and minimizing nspheres:
circles, spheres, hyperspheres, etc.
"""

import numpy as np

from . import convex, util
Expand Down
3 changes: 1 addition & 2 deletions trimesh/parent.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
The base class for Trimesh, PointCloud, and Scene objects
"""

import abc

import numpy as np
Expand All @@ -16,7 +17,6 @@


class Geometry(ABC):

"""
`Geometry` is the parent class for all geometry.
Expand Down Expand Up @@ -181,7 +181,6 @@ def scale(self) -> float:


class Geometry3D(Geometry):

"""
The `Geometry3D` object is the parent object of geometry objects
which are three dimensional, including Trimesh, PointCloud,
Expand Down
1 change: 1 addition & 0 deletions trimesh/path/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Handle 2D and 3D vector paths such as those contained in an
SVG or DXF file.
"""

try:
from .path import Path2D, Path3D
except BaseException as E:
Expand Down
1 change: 1 addition & 0 deletions trimesh/path/entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Basic geometric primitives which only store references to
vertex indices rather than vertices themselves.
"""

from copy import deepcopy

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions trimesh/path/packing.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
Pack rectangular regions onto larger rectangular regions.
"""

from typing import Optional

import numpy as np
Expand Down
7 changes: 4 additions & 3 deletions trimesh/path/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
A module designed to work with vector paths such as
those stored in a DXF or SVG file.
"""

import collections
import copy
from hashlib import sha256
Expand All @@ -17,7 +18,7 @@
from ..constants import tol_path as tol
from ..geometry import plane_transform
from ..points import plane_fit
from ..typed import Dict, List, NDArray, Optional, Sequence, float64
from ..typed import Dict, Iterable, List, NDArray, Optional, float64
from ..visual import to_rgba
from . import (
creation, # NOQA
Expand Down Expand Up @@ -71,7 +72,7 @@ class Path(parent.Geometry):

def __init__(
self,
entities: Optional[Sequence[Entity]] = None,
entities: Optional[Iterable[Entity]] = None,
vertices: Optional[NDArray[float64]] = None,
metadata: Optional[Dict] = None,
process: bool = True,
Expand Down Expand Up @@ -1084,7 +1085,7 @@ def polygons_closed(self) -> NDArray:
return polygons.paths_to_polygons(self.discrete)

@caching.cache_decorator
def polygons_full(self) -> NDArray:
def polygons_full(self) -> List:
"""
A list of shapely.geometry.Polygon objects with interiors created
by checking which closed polygons enclose which other polygons.
Expand Down
1 change: 1 addition & 0 deletions trimesh/path/raster.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
Turn 2D vector paths into raster images using `pillow`
"""

import numpy as np

try:
Expand Down
Loading

0 comments on commit b9f82a5

Please sign in to comment.