pterasoftware.draw()¶
- pterasoftware.draw(
- solver: SteadyHorseshoeVortexLatticeMethodSolver | SteadyRingVortexLatticeMethodSolver | UnsteadyRingVortexLatticeMethodSolver,
- /,
- *,
- scalar_type: str | None = None,
- show_streamlines: bool | np.bool = False,
- show_wake_vortices: bool | np.bool = False,
- show_mujoco_geometry: bool | np.bool = False,
- window_size: Sequence[int] = (1024, 768),
- save: bool | np.bool = False,
- path: str | Path = 'draw.webp',
- quality: int | float = 75.0,
- testing: bool | np.bool = False,
- cameraPosition_D_Do: np.ndarray | Sequence[float | int] | None = None,
- cameraFocalPoint_D_Do: np.ndarray | Sequence[float | int] | None = None,
- cameraViewUp_D: np.ndarray | Sequence[float | int] | None = None,
- camera_parallel_scale: int | float | None = None,
- return_camera_state: bool | np.bool = False,
Draws a solver's Airplane(s).
For a FreeFlightUnsteadyRingVortexLatticeMethodSolver, the final time step's geometry is rendered in Earth axes at its true position and orientation, so the body's flight attitude is visible, rather than being drawn body-fixed in geometry axes.
Citation:
Adapted from: vlm3.draw in AeroSandbox
Author: Peter Sharpe
Date of retrieval: 03/28/2020
- Parameters:
solver -- The solver whose Airplane(s) will be plotted. This can be a SteadyHorseshoeVortexLatticeMethodSolver, a SteadyRingVortexLatticeMethodSolver, or an UnsteadyRingVortexLatticeMethodSolver. The UnsteadyRingVortexLatticeMethodSolver's subclasses, the AeroelasticUnsteadyRingVortexLatticeMethodSolver and the FreeFlightUnsteadyRingVortexLatticeMethodSolver, are also accepted.
scalar_type -- Determines how to color the Panels. Setting this to None colors the Panels uniformly. If the solver has been run, it can also be "induced drag", "crosswind force", or "lift", which respectively use each Panel's induced drag, crosswind force, and lift coefficient. The default is None.
show_streamlines -- Set this to True to show the streamlines emanating from the back of the Wings. If True, the solver's streamlines must have already been calculated. Can be a bool or a numpy bool and will be converted internally to a bool. The default is False.
show_wake_vortices -- Set this to True to show any wake ring vortices. If True, the solver must be an UnsteadyRingVortexLatticeMethodSolver and must have already been run. Can be a bool or a numpy bool and will be converted internally to a bool. The default is False.
show_mujoco_geometry -- Set this to True to show the MuJoCo geometry that extra_xml and mujoco_assets inject into the solver's model, with body geoms posed at the drawn time step and worldbody geoms static in Earth axes. If True, the solver must be a FreeFlightUnsteadyRingVortexLatticeMethodSolver. Can be a bool or a numpy bool and will be converted internally to a bool. The default is False.
window_size -- The width and height, in pixels, of the render window. This also sets the resolution of the saved WebP. It must be a sequence of two positive ints. The text and line widths scale with it, so a larger or smaller window is legible rather than being drawn with the same pixel counts as the default. When rendering on screen, a window_size that does not fit in the area the window manager grants is shown scaled down to fit, keeping its aspect ratio, with its text and line widths scaled down to match, while a saved WebP keeps the requested size. The default is (1024, 768).
save -- Set this to True to save the image as a WebP. The image is rendered separately, off screen, at window_size and from the view the window ends with, so resizing the window does not change the saved image's size or styling. However, a window resized to a different aspect ratio shows more or less of the scene horizontally than the saved image does. It can be a bool or a numpy bool and will be converted internally to a bool. The default is False.
path -- The file path to save the image to. It can be a str or a Path, must end with ".webp", and its directory must already exist. This has no effect unless save is True. The default is "draw.webp".
quality -- The quality of the saved WebP, where 0.0 is the smallest file with the most compression artifacts and 100.0 is the largest file with the fewest. It can be an int or a float and will be converted internally to a float. This has no effect unless save is True. The default is 75.0.
testing -- Set this to True to close the image after one second, which is useful for running test suites. It can be a bool or a numpy bool and will be converted internally to a bool. The default is False.
cameraPosition_D_Do -- None, or an array-like object of 3 numbers (int or float) representing the camera's position (in diagram axes, relative to the diagram origin). The diagram axes and diagram origin are the first Airplane's geometry axes and CG, or Earth axes and the Earth origin for a free flight solver. Can be a tuple, list, or ndarray. Values are converted to floats internally. The units are in meters. When omitted, the mode's default camera position is used.
cameraFocalPoint_D_Do -- None, or an array-like object of 3 numbers (int or float) representing the camera's focal point (in diagram axes, relative to the diagram origin). See cameraPosition_D_Do for the diagram axes and diagram origin. Can be a tuple, list, or ndarray. Values are converted to floats internally. The units are in meters. When omitted, the mode's default focal point is used.
cameraViewUp_D -- None, or an array-like object of 3 numbers (int or float) representing the camera's view up direction (in diagram axes). See cameraPosition_D_Do for the diagram axes. It must not be parallel or antiparallel to the view direction. Can be a tuple, list, or ndarray. Values are converted to floats internally. When omitted, the mode's default view up direction is used.
camera_parallel_scale -- Optional positive parallel-projection scale. When omitted alongside any camera override, the scale is fitted to the relevant geometry for the effective camera direction.
return_camera_state -- If True, return the final camera position, focal point, view up direction, and parallel scale after the preview interaction. The returned dictionary can be unpacked as keyword arguments into a later call to reuse the view. The default is False.
- Returns:
If return_camera_state is True, a dictionary of the final camera state, whose keys are cameraPosition_D_Do, cameraFocalPoint_D_Do, and cameraViewUp_D (each a tuple of 3 floats) and camera_parallel_scale (a float). Otherwise None.