| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 | 
							- using o0.Geometry2D.Float;
 
- using o0InfraredLocate.ZIM;
 
- using UnityEngine;
 
- using UnityEngine.UI;
 
- // 用椭圆标记要识别的区域,区域外的像素会被剔除
 
- public class PixelCheaker : MonoBehaviour, IPixelCheaker
 
- {
 
-     public Image Bordermage;            // 椭圆的图片
 
-     public RectTransform BorderArea;    // 椭圆的大小区域,调整这个gameobject的scale作为椭圆的区域
 
-     public void Start()
 
-     {
 
-         ellipseRadius = BorderArea.localScale / 2f;
 
-     }
 
-     private Vector2 ellipseRadius;
 
-     //public bool OutArea2D(Vector2 pixelPosition, Vector<int> imageSize, out float f) => OutArea2D(new Vector2(pixelPosition.x / imageSize.x, pixelPosition.y / imageSize.y), out f);
 
-     //public bool OutArea2D(Vector2 pixelPosition, Vector2 imageSize, out float f) => OutArea2D(pixelPosition / imageSize, out f);
 
-     //public bool OutArea2D(o0.Geometry2D.Float.Vector pixelPosition, Vector<int> imageSize, out float f) => OutArea2D(new Vector2(pixelPosition.x / imageSize.x, pixelPosition.y / imageSize.y), out f);
 
-     public bool OutArea2D(Vector2 pixelPosition, Vector2 imageSize) => OutArea2D(pixelPosition / imageSize);
 
-     public bool OutArea2D(Vector pixelPosition, Vector imageSize)=> OutArea2D(new Vector2(pixelPosition.x / imageSize.x, pixelPosition.y / imageSize.y));
 
-     // out 椭圆的距离系数,越大表示离椭圆越远
 
-     //private bool OutArea2D(Vector2 pixelUV, out float f)
 
-     //{
 
-     //    Vector2 center = new Vector2(0.5f, 0.5f);           // 椭圆中心
 
-     //    float normalizedX = (pixelUV.x - center.x) / ellipseRadius.x;
 
-     //    float normalizedY = (pixelUV.y - center.y) / ellipseRadius.y;
 
-     //    float value = (normalizedX * normalizedX) + (normalizedY * normalizedY);    // 使用椭圆方程判断
 
-     //    f = (float)Math.Sqrt(value);
 
-     //    return value > 1.0f;
 
-     //}
 
-     // 无out的版本
 
-     private bool OutArea2D(Vector2 pixelUV)
 
-     {
 
-         Vector2 center = new Vector2(0.5f, 0.5f);           // 椭圆中心
 
-         float normalizedX = (pixelUV.x - center.x) / ellipseRadius.x;
 
-         float normalizedY = (pixelUV.y - center.y) / ellipseRadius.y;
 
-         float value = (normalizedX * normalizedX) + (normalizedY * normalizedY);    // 使用椭圆方程判断
 
-         return value > 1.0f;
 
-     }
 
-     public void ShowImage() => Bordermage.enabled = true;
 
-     public void HideImage() => Bordermage.enabled = false;
 
- }
 
 
  |