Click or drag to resize

BasePluginCameraConvertWorldToPixel(dvec2, Double) Method

Converts a point in world coordinates into pixel coordinates using the field sizes in world and pixel coordinates and the downscale factor. In difference to ConvertWorldPosToPixelPos() the origin in world coordinates is not expected to be in the center of the field. The origin of the pixel coordinates is expected to be in the upper left corner.

Namespace: RAYLASE.Marker.CamerasPlugin
Assembly: RAYLASE.Marker.CamerasPlugin (in RAYLASE.Marker.CamerasPlugin.dll) Version: 2.19.0
Syntax
C#
public dvec2 ConvertWorldToPixel(
	dvec2 pointWorld,
	double scale
)

Parameters

pointWorld  dvec2
Point in world coordinates.
scale  Double
The downscale factor.

Return Value

dvec2
The world pos in pixel pos.
Remarks
The calculation is done by two simple ratio equations:
   0              xWrld  widthWrld
   |----------------+------|             xWrld       xPxl
                                    => --------- ~ ----------
   |----------------+------|           widthWrld   widthPxl-1
   0               xPxl  widthPxl-1

heightWrld -    - 0
           |    |                        -yWrld       yPxl
     yWrld +    + yPxl              => ---------- ~ ----------- 
           |    |                      heightWrld   heightPxl-1
           |    |
         0 -    - heightPxl-1
See Also