Skip to content

Commit

Permalink
Merge branch 'feature/v0.4.5' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
KelSolaar committed Feb 18, 2024
2 parents d745625 + 4577a99 commit 7fb9fcc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions colour/geometry/section.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ def hull_section(
section = trimesh.intersections.mesh_plane(hull, normal, plane)
if len(section) == 0:
raise ValueError(f'No section exists on "{axis}" axis at {origin} origin!')

section = close_chord(unique_vertices(edges_to_chord(section)))

return section
11 changes: 9 additions & 2 deletions colour/plotting/section.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,8 +549,10 @@ def plot_RGB_colourspace_section(
axis: Literal["+z", "+x", "+y"] | str = "+z",
origin: float = 0.5,
normalise: bool = True,
size: float = 1.0,
show_section_colours: bool = True,
show_section_contour: bool = True,
segments: int = 64,
**kwargs: Any,
) -> Tuple[Figure, Axes]:
"""
Expand All @@ -571,10 +573,15 @@ def plot_RGB_colourspace_section(
Coordinate along ``axis`` at which to plot the hull section.
normalise
Whether to normalise ``axis`` to the extent of the hull along it.
size:
Size of the underlying *RGB* colourspace cube; used for plotting HDR
related sections.
show_section_colours
Whether to show the hull section colours.
show_section_contour
Whether to show the hull section contour.
segments
Edge segments count for the *RGB* colourspace cube.
Other Parameters
----------------
Expand Down Expand Up @@ -617,8 +624,8 @@ def plot_RGB_colourspace_section(
first_item(filter_RGB_colourspaces(colourspace).values()),
)

vertices, faces, _outline = primitive_cube(1, 1, 1, 64, 64, 64)
XYZ_vertices = RGB_to_XYZ(vertices["position"] + 0.5, colourspace)
vertices, faces, _outline = primitive_cube(1, 1, 1, segments, segments, segments)
XYZ_vertices = RGB_to_XYZ((vertices["position"] + 0.5) * size, colourspace)
hull = Trimesh(XYZ_vertices, faces, process=False)

if show_section_colours:
Expand Down

0 comments on commit 7fb9fcc

Please sign in to comment.