Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelle Spijker <j.spijker@ultimaker.com>2020-04-21 17:58:45 +0300
committerJelle Spijker <spijker.jelle@gmail.com>2020-04-21 17:58:45 +0300
commit6aedab78dc2e8c55fe6323ff3647203d8b994509 (patch)
tree536bc25c1adc134bf4ce675fb0336f73974f1dff /cura/PickingPass.py
parentfb4aec96a86c8a13109997c52528ba84ba103e25 (diff)
Converted comments in dir Cura/cura to rst style
Converted doxygen style comments to reStructuredText style in the files found in Cura/cura directory using the script dox_2_rst.py (provided in the Uranium repo). Comments were manually checked and changed if needed.
Diffstat (limited to 'cura/PickingPass.py')
-rw-r--r--cura/PickingPass.py28
1 files changed, 22 insertions, 6 deletions
diff --git a/cura/PickingPass.py b/cura/PickingPass.py
index 75ee21ef41..f2dfbaaf1e 100644
--- a/cura/PickingPass.py
+++ b/cura/PickingPass.py
@@ -16,11 +16,15 @@ from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator
if TYPE_CHECKING:
from UM.View.GL.ShaderProgram import ShaderProgram
-## A RenderPass subclass that renders a the distance of selectable objects from the active camera to a texture.
-# The texture is used to map a 2d location (eg the mouse location) to a world space position
-#
-# Note that in order to increase precision, the 24 bit depth value is encoded into all three of the R,G & B channels
class PickingPass(RenderPass):
+ """A :py:class:`Uranium.UM.View.RenderPass` subclass that renders a the distance of selectable objects from the
+ active camera to a texture.
+
+ The texture is used to map a 2d location (eg the mouse location) to a world space position
+
+ .. note:: that in order to increase precision, the 24 bit depth value is encoded into all three of the R,G & B channels
+ """
+
def __init__(self, width: int, height: int) -> None:
super().__init__("picking", width, height)
@@ -50,8 +54,14 @@ class PickingPass(RenderPass):
batch.render(self._scene.getActiveCamera())
self.release()
- ## Get the distance in mm from the camera to at a certain pixel coordinate.
def getPickedDepth(self, x: int, y: int) -> float:
+ """Get the distance in mm from the camera to at a certain pixel coordinate.
+
+ :param x: x component of coordinate vector in pixels
+ :param y: y component of coordinate vector in pixels
+ :return: distance in mm from the camera to pixel coordinate
+ """
+
output = self.getOutput()
window_size = self._renderer.getWindowSize()
@@ -66,8 +76,14 @@ class PickingPass(RenderPass):
distance = (distance & 0x00ffffff) / 1000. # drop the alpha channel and covert to mm
return distance
- ## Get the world coordinates of a picked point
def getPickedPosition(self, x: int, y: int) -> Vector:
+ """Get the world coordinates of a picked point
+
+ :param x: x component of coordinate vector in pixels
+ :param y: y component of coordinate vector in pixels
+ :return: vector of the world coordinate
+ """
+
distance = self.getPickedDepth(x, y)
camera = self._scene.getActiveCamera()
if camera: