Skip to content

Commit

Permalink
Merge pull request #1339 from compas-dev/remove-indexed-attribute-access
Browse files Browse the repository at this point in the history
Remove remaining indexed attribute access and related references in docstrings of functional API
  • Loading branch information
tomvanmele authored Apr 25, 2024
2 parents b33feef + 05d8a4f commit f28cdb8
Show file tree
Hide file tree
Showing 12 changed files with 62 additions and 117 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Removed default implementation of `compas.geometry.trimesh_geodistance` since nonexistent.
* Removed `compas.utilities.geometric_key` and replaced it by `compas.tolerance.TOL.geometric_key`.
* Removed `compas.utilities.geometric_key_xy` and replaced it by `compas.tolerance.TOL.geometric_key_xy`.
* Removed indexed attribute access from all geometry classes except `Point`, `Vector`, `Line`, `Polygon`, `Polyline`.

## [2.1.0] 2024-03-01

Expand Down
6 changes: 3 additions & 3 deletions src/compas/geometry/_core/_algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -2347,7 +2347,7 @@ def matrix_from_orthogonal_projection(plane):
Parameters
----------
plane : [point, normal] | :class:`compas.geometry.Plane`
plane : [point, normal]
The plane to project onto.
Returns
Expand Down Expand Up @@ -2380,7 +2380,7 @@ def matrix_from_parallel_projection(plane, direction):
Parameters
----------
plane : [point, normal] | :class:`compas.geometry.Plane`
plane : [point, normal]
The plane to project onto.
direction : [float, float, float] | :class:`compas.geometry.Vector`
Direction of the projection.
Expand Down Expand Up @@ -2417,7 +2417,7 @@ def matrix_from_perspective_projection(plane, center_of_projection):
Parameters
----------
plane : [point, normal] | :class:`compas.geometry.Plane`
plane : [point, normal]
The plane to project onto.
center_of_projection : [float, float, float] | :class:`compas.geometry.Point`
The camera view point.
Expand Down
4 changes: 2 additions & 2 deletions src/compas/geometry/_core/angles.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,9 +384,9 @@ def angle_planes(a, b, deg=False):
Parameters
----------
a : [point, vector] | :class:`compas.geometry.Plane`
a : [point, vector]
The first plane.
b : [point, vector] | :class:`compas.geometry.Plane`
b : [point, vector]
The second plane.
deg : bool, optional
If True, returns the angle in degrees.
Expand Down
6 changes: 3 additions & 3 deletions src/compas/geometry/_core/distance.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ def distance_point_plane(point, plane):
----------
point : [float, float, float] | :class:`compas.geometry.Point`
Point coordinates.
plane : [point, vector] | :class:`compas.geometry.Plane`
plane : [point, vector]
A point and a vector defining a plane.
Returns
Expand Down Expand Up @@ -353,7 +353,7 @@ def distance_point_plane_signed(point, plane):
----------
point : [float, float, float] | :class:`compas.geometry.Point`
Point coordinates.
plane : [point, vector] | :class:`compas.geometry.Plane`
plane : [point, vector]
A point and a vector defining a plane.
Returns
Expand Down Expand Up @@ -838,7 +838,7 @@ def closest_point_on_plane(point, plane):
----------
point : [float, float, float] | :class:`compas.geometry.Point`
XYZ coordinates of point.
plane : [point, vector] | :class:`compas.geometry.Plane`
plane : [point, vector]
The base point and normal defining the plane.
Returns
Expand Down
2 changes: 1 addition & 1 deletion src/compas/geometry/_core/predicates_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ def is_point_in_circle_xy(point, circle):
----------
point : [float, float, float] | :class:`compas.geometry.Point`
XY(Z) coordinates of a point (Z will be ignored).
circle : [[point, vector], float] | :class:`compas.geometry.Circle`
circle : [[point, vector], float]
Center and radius of the circle on the XY plane.
Returns
Expand Down
26 changes: 13 additions & 13 deletions src/compas/geometry/_core/predicates_3.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,9 @@ def is_parallel_plane_plane(plane1, plane2, tol=None):
Parameters
----------
plane1 : [point, vector] | :class:`compas.geometry.Plane`
plane1 : [point, vector]
Plane 1.
plane2 : [point, vector] | :class:`compas.geometry.Plane`
plane2 : [point, vector]
Plane 2.
tol : float, optional
A tolerance for verifying parallelity of the plane normals.
Expand Down Expand Up @@ -333,9 +333,9 @@ def is_perpendicular_plane_plane(plane1, plane2, tol=None):
Parameters
----------
plane1 : [point, vector] | :class:`compas.geometry.Plane`
plane1 : [point, vector]
Plane 1.
plane2 : [point, vector] | :class:`compas.geometry.Plane`
plane2 : [point, vector]
Plane 2.
tol : float, optional
A tolerance for verifying perpendicularity of the plane normals.
Expand Down Expand Up @@ -425,7 +425,7 @@ def is_polyhedron_convex(polyhedron):
Parameters
----------
polyhedron : [sequence[point], sequence[sequence[int]]] | :class:`compas.geometry.Polyhedron`
polyhedron : [sequence[point], sequence[sequence[int]]]
A polyhedron defined by a sequence of points
and a sequence of faces, with each face defined as a sequence of indices into the sequence of points.
Expand Down Expand Up @@ -480,7 +480,7 @@ def is_point_on_plane(point, plane, tol=None):
----------
point : [float, float, float] | :class:`compas.geometry.Point`
A point.
plane : [point, vector] | :class:`compas.geometry.Plane`
plane : [point, vector]
A plane.
tol : float, optional
Tolerance for comparing the distance between the point and the plane to zero.
Expand Down Expand Up @@ -812,7 +812,7 @@ def is_point_in_polyhedron(point, polyhedron, tol=None):
----------
point : [float, float, float] | :class:`compas.geometry.Point`
The test point.
polyhedron : [sequence[point], sequence[sequence[int]]] | :class:`compas.geometry.Polyhedron`.
polyhedron : [sequence[point], sequence[sequence[int]]]
The polyhedron defined by a sequence of points
and a sequence of faces, with each face defined as a sequence of indices into the sequence of points.
Expand All @@ -836,7 +836,7 @@ def is_point_infrontof_plane(point, plane, tol=None):
----------
point : [float, float, float] | :class:`compas.geometry.Point`
A point.
plane : [point, vector] | :class:`compas.geometry.Plane`
plane : [point, vector]
A plane.
tol : float, optional
A tolerance for membership verification.
Expand All @@ -858,7 +858,7 @@ def is_point_behind_plane(point, plane, tol=None):
----------
point : [float, float, float] | :class:`compas.geometry.Point`
A point.
plane : [point, normal] | :class:`compas.geometry.Plane`
plane : [point, normal]
A plane.
tol : float, optional
A tolerance for membership verification.
Expand Down Expand Up @@ -1025,7 +1025,7 @@ def is_point_behind_plane(point, plane, tol=None):
# ----------
# line : [point, point] | :class:`compas.geometry.Line`
# A line.
# plane : [point, vector] | :class:`compas.geometry.Plane`
# plane : [point, vector]
# A plane.
# tol : float, optional
# A tolerance for intersection verification.
Expand Down Expand Up @@ -1056,7 +1056,7 @@ def is_point_behind_plane(point, plane, tol=None):
# ----------
# segment : [point, point] | :class:`compas.geometry.Line`
# A line segment.
# plane : [point, vector] | :class:`compas.geometry.Plane`
# plane : [point, vector]
# A plane.
# tol : float, optional
# A tolerance for intersection verification.
Expand Down Expand Up @@ -1091,9 +1091,9 @@ def is_point_behind_plane(point, plane, tol=None):

# Parameters
# ----------
# plane1 : [point, vector] | :class:`compas.geometry.Plane`
# plane1 : [point, vector]
# A plane.
# plane2 : [point, vector] | :class:`compas.geometry.Plane`
# plane2 : [point, vector]
# A plane.
# tol : float, optional
# A tolerance for intersection verification.
Expand Down
2 changes: 1 addition & 1 deletion src/compas/geometry/_core/tangent.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def tangent_points_to_circle_xy(circle, point):
Parameters
----------
circle : [plane, float] | :class:`compas.geometry.Circle`
circle : [plane, float]
Plane and radius of the circle.
point : [float, float] or [float, float, float] | :class:`compas.geometry.Point`
XY(Z) coordinates of a point in the xy plane.
Expand Down
24 changes: 12 additions & 12 deletions src/compas/geometry/_core/transformations.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def homogenize_and_flatten_frames(frames):
Parameters
----------
frames : sequence[[point, vector, vector] | :class:`compas.geometry.Frame`]
frames : sequence[[point, vector, vector]]
Returns
-------
Expand Down Expand Up @@ -245,7 +245,7 @@ def transform_frames(frames, T):
Parameters
----------
frames : sequence[[point, vector, vector] | :class:`compas.geometry.Frame`]
frames : sequence[[point, vector, vector]]
A list of frames to be transformed.
T : list[list[float]] | :class:`compas.geometry.Transformation`
The transformation to apply on the frames.
Expand All @@ -272,7 +272,7 @@ def world_to_local_coordinates(frame, xyz):
Parameters
----------
frame : [point, vector, vector] | :class:`compas.geometry.Frame`
frame : [point, vector, vector]
The local coordinate system.
xyz : array-like[[float, float, float] | :class:`compas.geometry.Point`]
The global coordinates of the points to convert.
Expand Down Expand Up @@ -302,7 +302,7 @@ def local_to_world_coordinates(frame, xyz):
Parameters
----------
frame : [point, vector, vector] | :class:`compas.geometry.Frame`
frame : [point, vector, vector]
The local coordinate system.
xyz : array-like[[float, float, float] | :class:`compas.geometry.Point`]
The global coordinates of the points to convert.
Expand Down Expand Up @@ -714,7 +714,7 @@ def mirror_point_plane(point, plane):
----------
point : list[float]
XYZ coordinates of mirror point.
plane : [point, vector] | :class:`compas.geometry.Plane`
plane : [point, vector]
Base point and normal defining the mirror plane.
Returns
Expand All @@ -734,7 +734,7 @@ def mirror_points_plane(points, plane):
----------
points : sequence[[float, float, float] | :class:`compas.geometry.Point`]
List of points to mirror.
plane : [point, vector] | :class:`compas.geometry.Plane`
plane : [point, vector]
Base point and normal defining the mirror plane.
Returns
Expand All @@ -760,7 +760,7 @@ def project_point_plane(point, plane):
----------
point : [float, float, float] | :class:`compas.geometry.Point`
XYZ coordinates of the point.
plane : [point, vector] | :class:`compas.geometry.Plane`
plane : [point, vector]
Base point and normal vector defining the projection plane.
Returns
Expand Down Expand Up @@ -802,7 +802,7 @@ def project_points_plane(points, plane):
----------
points : sequence[[float, float, float] | :class:`compas.geometry.Point`]
List of points.
plane : [point, vector] | :class:`compas.geometry.Plane`
plane : [point, vector]
Base point and normal vector defining the projection plane.
Returns
Expand Down Expand Up @@ -951,7 +951,7 @@ def reflect_line_plane(line, plane, tol=None):
----------
line : [point, point] | :class:`compas.geometry.Line`
Two points defining the line.
plane : [point, vector] | :class:`compas.geometry.Plane`
plane : [point, vector]
Base point and normal vector of the plane.
tol : float, optional
A tolerance for finding the intersection between the line and the plane.
Expand Down Expand Up @@ -1066,11 +1066,11 @@ def orient_points(points, reference_plane, target_plane):
Parameters
----------
points : sequence[[float, float, float] | :class:`compas.geometry.Point`]s
points : sequence[[float, float, float] | :class:`compas.geometry.Point`]
XYZ coordinates of the points.
reference_plane : [point, vector] | :class:`compas.geometry.Plane`
reference_plane : [point, vector]
Base point and normal defining a reference plane.
target_plane : [point, vector] | :class:`compas.geometry.Plane`
target_plane : [point, vector]
Base point and normal defining a target plane.
Returns
Expand Down
8 changes: 4 additions & 4 deletions src/compas/geometry/_core/transformations_numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def transform_frames_numpy(frames, T):
Parameters
----------
frames : sequence[[point, vector, vector] | :class:`compas.geometry.Frame`]
frames : sequence[[point, vector, vector]]
A list of frames to be transformed.
T : :class:`compas.geometry.Transformation`
The transformation to apply on the frames.
Expand Down Expand Up @@ -97,7 +97,7 @@ def world_to_local_coordinates_numpy(frame, xyz):
Parameters
----------
frame : [point, vector, vector] | :class:`compas.geometry.Frame`
frame : [point, vector, vector]
The local coordinate system.
xyz : array-like[[float, float, float] | :class:`compas.geometry.Point`]
The global coordinates of the points to convert.
Expand Down Expand Up @@ -130,7 +130,7 @@ def local_to_world_coordinates_numpy(frame, rst):
Parameters
----------
frame : [point, vector, vector] | :class:`compas.geometry.Frame`
frame : [point, vector, vector]
The local coordinate system.
rst : array-like[[float, float, float] | :class:`compas.geometry.Point`]
The coordinates of the points wrt the local coordinate system.
Expand Down Expand Up @@ -231,7 +231,7 @@ def homogenize_and_flatten_frames_numpy(frames):
Parameters
----------
frames : array_like[[point, vector, vector] | :class:`compas.geometry.Frame`]
frames : array_like[[point, vector, vector]]
The input frames.
Returns
Expand Down
Loading

0 comments on commit f28cdb8

Please sign in to comment.