Skip to content

Commit

Permalink
deprecate Path3D.to_planar->Path3D.to_2D
Browse files Browse the repository at this point in the history
  • Loading branch information
mikedh committed Jan 9, 2025
1 parent 08328c3 commit 6b5373e
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 23 deletions.
18 changes: 9 additions & 9 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
pypandoc==1.13
pypandoc==1.14
recommonmark==0.7.1
jupyter==1.0.0
jupyter==1.1.1

# get sphinx version range from furo install
furo==2024.5.6
myst-parser==3.0.1
pyopenssl==24.1.0
autodocsumm==0.2.12
jinja2==3.1.4
matplotlib==3.8.4
nbconvert==7.16.4
furo==2024.8.6
myst-parser==4.0.0
pyopenssl==24.3.0
autodocsumm==0.2.14
jinja2==3.1.5
matplotlib==3.10.0
nbconvert==7.16.5

7 changes: 3 additions & 4 deletions trimesh/exchange/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ def load(
if len(loaded.geometry) == 1:
kind = loaded._source.file_type
geom = next(iter(loaded.geometry.values()))
geom.metadata.update(loaded.metadata)
if (kind not in {"glb", "gltf"} and isinstance(geom, PointCloud)) or kind in {
"obj",
"stl",
Expand Down Expand Up @@ -242,10 +243,8 @@ def load_scene(
loaded._source = arg

## add the "file_path" information to the overall scene metadata
# if "metadata" not in kwargs:
# loaded.metadata.update(arg.metadata)
# add the load path metadata to every geometry
# [g.metadata.update(arg.metadata) for g in loaded.geometry.values()]
if "metadata" not in kwargs:
loaded.metadata.update(arg.metadata)

return loaded

Expand Down
32 changes: 22 additions & 10 deletions trimesh/path/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import collections
import copy
import warnings
from hashlib import sha256

import numpy as np
Expand All @@ -18,7 +19,7 @@
from ..constants import tol_path as tol
from ..geometry import plane_transform
from ..points import plane_fit
from ..typed import ArrayLike, Dict, Iterable, List, NDArray, Optional, float64
from ..typed import ArrayLike, Dict, Iterable, List, NDArray, Optional, Tuple, float64
from ..visual import to_rgba
from . import (
creation, # NOQA
Expand Down Expand Up @@ -773,12 +774,23 @@ class Path3D(Path):
Hold multiple vector curves (lines, arcs, splines, etc) in 3D.
"""

def to_planar(
def to_planar(self, *args, **kwargs):
"""
DEPRECATED: replace `path.to_planar`->`path.to_2D), removal 1/1/2026
"""
warnings.warn(
"DEPRECATED: replace `path.to_planar`->`path.to_2D), removal 1/1/2026",
category=DeprecationWarning,
stacklevel=2,
)
return self.to_3D(*args, **kwargs)

def to_2D(
self,
to_2D: Optional[ArrayLike] = None,
normal: Optional[ArrayLike] = None,
check: bool = True,
):
) -> Tuple["Path2D", NDArray[float64]]:
"""
Check to see if current vectors are all coplanar.
Expand All @@ -791,17 +803,17 @@ def to_planar(
Homogeneous transformation matrix to apply,
if not passed a plane will be fitted to vertices.
normal : (3,) float or None
Normal of direction of plane to use.
Normal of direction of plane to use.
check
Raise a ValueError if points aren't coplanar
Raise a ValueError if points aren't coplanar.
Returns
-----------
planar : trimesh.path.Path2D
Current path transformed onto plane
to_3D : (4,4) float
Homeogenous transformations to move planar
back into 3D space
planar
Current path transformed onto plane
to_3D : (4, 4) float
Homeogenous transformations to move planar
back into the original 3D frame.
"""
# which vertices are actually referenced
referenced = self.referenced_vertices
Expand Down

0 comments on commit 6b5373e

Please sign in to comment.