protected Vector3[] GetPositions(Transform screenTransform, mplt.RelativeBoundingBox box, bool isFlipped, bool isFiltered) { // In a mediapipe coordinate system var centerX = box.Xmin + box.Width / 2; var centerY = box.Ymin + box.Height / 2; return(GetPositionsFromNormalizedRect(screenTransform, centerX, centerY, box.Width, box.Height, 0, isFlipped, isFiltered)); }
/// <summary> /// Get a Vector3 array which represents <paramref name="boundingBox" />'s vertex coordinates in local coordinate system. /// They are ordered clockwise from bottom-left point. /// </summary> /// <param name="rectTransform"> /// <see cref="RectTransform" /> to be used for calculating local coordinates /// </param> /// <param name="imageRotation">Counterclockwise rotation angle of the input image</param> /// <param name="isMirrored">Set to true if the original coordinates is mirrored</param> public static Vector3[] GetRectVertices(this RectTransform rectTransform, mplt.RelativeBoundingBox boundingBox, RotationAngle imageRotation = RotationAngle.Rotation0, bool isMirrored = false) { return(GetRectVerticesNormalized(rectTransform, boundingBox.Xmin, boundingBox.Ymin, boundingBox.Width, boundingBox.Height, imageRotation, isMirrored)); }