Skip to content

Commit

Permalink
common/lib/render_control: Test RenderControlMirror docs
Browse files Browse the repository at this point in the history
  • Loading branch information
e10harvey committed Nov 25, 2024
1 parent ad53192 commit 59e6052
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions opencsp/common/lib/render_control/RenderControlMirror.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@


class RenderControlMirror:
"""
A class for controlling the rendering of a mirror in a graphical environment.
This class allows for the configuration of various visual aspects of a mirror,
including its centroid, surface normals, resolution, and styles for rendering.
"""

# "ChatGPT 4o-mini" assisted with generating this docstring.
def __init__(
self,
centroid: bool = False,
Expand All @@ -17,6 +25,31 @@ def __init__(
point_styles: RenderControlPointSeq = None,
number_of_edge_points: int = 20,
) -> None:
"""
Initializes a RenderControlMirror object with the specified parameters.
Parameters
----------
centroid : bool, optional
If True, renders the centroid of the mirror (default is False).
surface_normals : bool, optional
If True, renders the surface normals of the mirror (default is False).
resolution : Resolution, optional
The resolution of the rendering, specified as a Resolution object (default is None).
norm_len : float, optional
The length of the normals to be rendered (default is 1).
norm_res : int, optional
The resolution of the normals (default is 5).
norm_base_style : RenderControlPointSeq, optional
The style for rendering the normals (default is a marker with size 2).
surface_style : RenderControlSurface, optional
The style for rendering the surface of the mirror (default is a new RenderControlSurface object).
point_styles : RenderControlPointSeq, optional
The styles for rendering points on the mirror (default is None, which sets it to a marker with size 2).
number_of_edge_points : int, optional
The number of edge points to be rendered (default is 20).
"""
# "ChatGPT 4o-mini" assisted with generating this docstring.
if point_styles == None:
self.point_styles = rcps.marker(markersize=2)
if resolution is None:
Expand All @@ -36,8 +69,26 @@ def __init__(


def normal_mirror():
"""
Creates a default RenderControlMirror object with standard settings.
Returns
-------
RenderControlMirror
A RenderControlMirror object initialized with default parameters.
"""
# "ChatGPT 4o-mini" assisted with generating this docstring.
return RenderControlMirror()


def low_res_mirror():
"""
Creates a RenderControlMirror object with low resolution.
Returns
-------
RenderControlMirror
A RenderControlMirror object initialized with a resolution of 5 pixels in the x direction.
"""
# "ChatGPT 4o-mini" assisted with generating this docstring.
return RenderControlMirror(resolution=Resolution.pixelX(5))

0 comments on commit 59e6052

Please sign in to comment.