Exemple #1
0
 public void Initialize(Coord2D elementCoords, Vector2 size, Transform parent)
 {
     _elementCoords = new Coord2D(elementCoords.X, elementCoords.Y);
     SetSizes(size);
     SetParent(parent);
     SetRandomSprite();
 }
Exemple #2
0
 public HoughCircle(Coord2D c) : this(VisionLabPINVOKE.new_HoughCircle__SWIG_2(Coord2D.getCPtr(c)), true)
 {
     if (VisionLabPINVOKE.SWIGPendingException.Pending)
     {
         throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
     }
 }
 public Line2D(Coord2D s, Coord2D e) : this(VisionLabPINVOKE.new_Line2D__SWIG_1(Coord2D.getCPtr(s), Coord2D.getCPtr(e)), true)
 {
     if (VisionLabPINVOKE.SWIGPendingException.Pending)
     {
         throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Exemple #4
0
    public void AStar(Coord2D from, Coord2D to)
    {
        Stopwatch stopWatch = new Stopwatch();

        stopWatch.Start();

        // Initialize start node
        int      initialHeuristic = EuclideanDistance(from, to);
        TileNode startNode        = new TileNode(from.x, from.y, 0, initialHeuristic);

        // Store start node
        nodeQueue.Enqueue(startNode, startNode.totalCost);
        nodeTracker[startNode.y, startNode.x] = startNode;

        int timeC = 0;

        while (true)
        {
//            timeC++;
//            if (timeC > 14)

//            {
//                yield return null;
//                timeC = 0;
//            }

            if (nodeQueue.Count == 0) // If the queue is empty, exit and fail
            {
                print("UNABLE TO FIND PATH!");
                break;
            }

            TileNode bestNode = nodeQueue.Dequeue();

            transform.position = new Vector3(bestNode.x, bestNode.y, 1);
            GameObject.Instantiate(frontierMarker).transform.position = transform.position;


            // Set closed state and break if dest. reached
            if (SetClosedState(bestNode))
            {
                ShowBestPath(bestNode);
                break;
            }

            AScanAdjacent(bestNode);
        }

        stopWatch.Stop();

        // Get the elapsed time as a TimeSpan value.
        TimeSpan ts = stopWatch.Elapsed;

        // Format and display the TimeSpan value.
        string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}",
                                           ts.Hours, ts.Minutes, ts.Seconds,
                                           ts.Milliseconds / 10);

        print("RunTime " + elapsedTime);
    }
Exemple #5
0
    // Update is called once per frame
    void Update()
    {
        if (m_Halt || m_Pause)
        {
            return;
        }
        m_CountDown -= Time.deltaTime;
        if (m_CountDown <= 0)
        {
            m_CountDown = m_GenerateCountDown;

            int x = GetRandomPosX(); //Random.Range(0, m_BoxNumW);
            if (x == m_LastX)        //reduce burst death
            {
                x = (x + 1) % m_BoxNumW;
            }
            m_LastX = x;

            int     index = Random.Range(0, m_BoxElement.Length);
            Coord2D coord = new Coord2D(x, m_BoxNumH - 1);
            Vector2 pos   = CoordToPos(coord);

            GameObject obj = (GameObject)Instantiate(m_BoxElement[index]);
            obj.transform.parent        = this.transform;
            obj.transform.localPosition = new Vector3(pos.x, pos.y, transform.localPosition.z);;
            obj.transform.localScale    = Vector3.one;

            //random generate species by probabilities
            float rn = Random.Range(0.0f, 1.0f);
            if (rn > 0.95f)
            {
                AttachRandomSpecies(obj);
            }
        }
    }
Exemple #6
0
    bool FindNextTarget()
    {
        m_CurBounce++;
        if (m_CurBounce >= m_BounceNum)
        {
            return(false);
        }

        int w = m_BG.GetCoordW();
        int h = m_BG.GetCoordH();

        for (int x = 0; x < w; x++)
        {
            for (int y = 0; y < h; y++)
            {
                Coord2D    coord = new Coord2D((x + m_TargetCoord.x) % w, y);
                GameObject obj   = m_BG.GetElementByCoord(coord);
                if (obj == null)
                {
                    continue;
                }
                BoxElementControl objControl = obj.GetComponent <BoxElementControl>();
                if (objControl.m_Type == m_TargetType && objControl.GetState() != BoxState.ELIMINATE)
                {
                    m_Target      = obj;
                    m_TargetCoord = coord;
                    return(true);
                }
            }
        }
        return(false);
    }
Exemple #7
0
 public HoughCircle(Coord2D c, double radius, int accuValue) : this(VisionLabPINVOKE.new_HoughCircle__SWIG_0(Coord2D.getCPtr(c), radius, accuValue), true)
 {
     if (VisionLabPINVOKE.SWIGPendingException.Pending)
     {
         throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Exemple #8
0
 public void SetElementByCoord(Coord2D coord, GameObject obj)
 {
     if (coord.InRange(0, m_BoxNumW, 0, m_BoxNumH))
     {
         m_ElementArray[coord.y * m_BoxNumW + coord.x] = obj;
     }
 }
Exemple #9
0
    // Use this for initialization
    void Start()
    {
        GameObject gc = GameObject.FindGameObjectWithTag("GameController");

        m_BG = gc.GetComponent <BoxGenerator>();

        //寬度是偶數行時需shift,特效跟消融方塊的區域重疊位置才會一樣
        float offsetX = 0, offsetY = 0;

        if (m_Size % 2 == 0)
        {
            offsetX = 0.5f;
            offsetY = 0.5f;
        }
        Coord2D coord = m_BG.PosToCoord(new Vector2(transform.localPosition.x + offsetX, transform.localPosition.y + offsetY));

        if (coord.x != -1 && coord.y != -1)
        {
            int halfSize = m_Size >> 1;
            for (int x = coord.x - halfSize; x < coord.x - halfSize + m_Size; x++)
            {
                for (int y = coord.y - halfSize; y < coord.y - halfSize + m_Size; y++)
                {
                    Coord2D    targetCoord = new Coord2D(x, y);
                    GameObject element     = m_BG.GetElementByCoord(targetCoord);
                    if (element != null)
                    {
                        BoxElementControl control = element.GetComponent <BoxElementControl>();
                        control.DestroyElement();
                    }
                }
            }
        }
    }
Exemple #10
0
 public bool Equals(Coord2D other)
 {
     if (other == null)
     {
         return(false);
     }
     return((X == other.X) && (Y == other.Y));
 }
Exemple #11
0
 public int EuclideanDistance(Coord2D from, Coord2D to)
 {
     return((int)
            Math.Sqrt(
                Math.Pow(Math.Abs(from.x - to.x), 2) +
                Math.Pow(Math.Abs(from.y - to.y), 2)
                ));
 }
Exemple #12
0
        public static Coord2D WorldPositionToIsoCoord(Point point, int altitude)
        {
            Coord2D gridCoord      = WorldPositionToGridCoord(point);
            Coord2D isoCoord       = GridCoordToIsoCoord(gridCoord);
            Coord2D isoCoordoffset = IsoCoordOffset(WorldPositionToNormalizedGridPosition(point), point);

            return(GetIsoCoord(isoCoord, altitude) + isoCoordoffset);
        }
 void SetFixed()
 {
     m_CurCoord = m_TargetCoord;
     m_CurPos   = m_TargetPos;
     m_State    = BoxState.FIX;
     m_CurTime  = m_BG.m_FallingTime;
     m_BG.SetElementByCoord(m_CurCoord, gameObject);
 }
Exemple #14
0
        public void BuildWorldObject(Coord2D mouseIsoFlatCoord, Coord2D mouseIsoCoord)
        {
            Coord3D mouseIsoCoord3D = new Coord3D(mouseIsoCoord, Altitude);

            if (BuildMode == BuildMode.Cube)
            {
                // Create cube and add it to the layer map.
                var cube = CubeFactory.CreateCurrentCube(mouseIsoFlatCoord, mouseIsoCoord3D);
                if (!LayerMap.ContainsKey(mouseIsoCoord3D))
                {
                    LayerMap.Add(mouseIsoCoord3D, cube);
                }
                // Deal with the walkable tile table.
                foreach (var coord in mouseIsoCoord.AdjacentCoords())
                {
                    // If there are no solid objects above us,
                    if (!(LayerMap.ContainsKey(new Coord3D(mouseIsoCoord, Altitude + 1)) && LayerMap[new Coord3D(mouseIsoCoord, Altitude + 1)].IsSolid)) // not- contains key and sprite is solid
                    {
                        WalkableTileTable.Add(Altitude + 1, coord, mouseIsoCoord);
                    }
                    // Assuming the added cube is solid, the tile under us is no longer walkable.
                    if (cube.IsSolid)
                    {
                        WalkableTileTable.Remove(Altitude, coord, mouseIsoCoord);
                    }
                }
            }
            else if (BuildMode == BuildMode.Deco)
            {
                // Create deco and add it to the layer map.
                var deco = DecoFactory.CreateCurrentDeco(mouseIsoFlatCoord, mouseIsoCoord, Altitude);
                if (deco.OccupiedCoords.Any((c) => LayerMap.ContainsKey(c)) == false)
                {
                    LayerMap.Add(mouseIsoCoord3D, deco);
                    foreach (var coord in deco.OccupiedCoords)
                    {
                        if (coord != mouseIsoCoord3D)
                        {
                            LayerMap.Add(coord, new DecoReference(deco, mouseIsoCoord3D)
                            {
                                Coords = coord.To2D(), Altitude = coord.Z
                            });
                        }

                        foreach (var _coord in new Coord2D(coord.X, coord.Y).AdjacentCoords())
                        {
                            // Assuming the added deco is solid, the tiles under us are no longer walkable.
                            if (deco.IsSolid)
                            {
                                WalkableTileTable.Remove(Altitude, _coord, new Coord2D(coord.X, coord.Y));
                            }
                        }
                    }
                }
            }
        }
Exemple #15
0
    public Coord2D Add_Op(Coord2D c)
    {
        Coord2D ret = new Coord2D(VisionLabPINVOKE.Coord2D_Add_Op(swigCPtr, Coord2D.getCPtr(c)), true);

        if (VisionLabPINVOKE.SWIGPendingException.Pending)
        {
            throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
    public Coord3D ImageCToCamC(Coord2D imageC)
    {
        Coord3D ret = new Coord3D(VisionLabPINVOKE.CamCalibration_ImageCToCamC(swigCPtr, Coord2D.getCPtr(imageC)), true);

        if (VisionLabPINVOKE.SWIGPendingException.Pending)
        {
            throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
Exemple #17
0
    public bool Not(Coord2D c)
    {
        bool ret = VisionLabPINVOKE.Coord2D_Not(swigCPtr, Coord2D.getCPtr(c));

        if (VisionLabPINVOKE.SWIGPendingException.Pending)
        {
            throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
Exemple #18
0
    public bool SmallerThan(Coord2D arg0)
    {
        bool ret = VisionLabPINVOKE.Coord2D_SmallerThan(swigCPtr, Coord2D.getCPtr(arg0));

        if (VisionLabPINVOKE.SWIGPendingException.Pending)
        {
            throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
Exemple #19
0
    public Coord2D Divide(double f)
    {
        Coord2D ret = new Coord2D(VisionLabPINVOKE.Coord2D_Divide(swigCPtr, f), true);

        if (VisionLabPINVOKE.SWIGPendingException.Pending)
        {
            throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
Exemple #20
0
    public void TouchElement(Vector3 pos)
    {
        if (m_Pause)
        {
            return;
        }
        Coord2D coord = m_BG.PosToCoord(new Vector2(pos.x, pos.y));

        m_TouchElement = m_BG.GetElementByCoord(coord);
    }
 public void GoToCoord(Coord2D coord)
 {
     m_State       = BoxState.FALL;
     m_CurPos      = m_BG.CoordToPos(m_TargetCoord);
     m_TargetCoord = coord;
     m_CurTime     = 0;
     m_BG.SetElementByCoord(m_CurCoord, null);
     m_BG.SetElementByCoord(coord, gameObject);
     m_TargetPos = m_BG.CoordToPos(m_TargetCoord);
 }
 public void SetCoord(Coord2D coord)
 {
     m_CurCoord    = coord;
     m_TargetCoord = coord;
     m_CurTime     = m_BG.m_FallingTime;
     m_State       = BoxState.FALL;
     m_BG.SetElementByCoord(coord, gameObject);
     m_CurPos    = m_BG.CoordToPos(m_CurCoord);
     m_TargetPos = m_CurPos;
 }
    public Coord2D PixelCToUnCorrImageC(Coord2D pixelC)
    {
        Coord2D ret = new Coord2D(VisionLabPINVOKE.CamCalibration_PixelCToUnCorrImageC(swigCPtr, Coord2D.getCPtr(pixelC)), true);

        if (VisionLabPINVOKE.SWIGPendingException.Pending)
        {
            throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
Exemple #24
0
 public Vector2 CoordToPos(Coord2D coord)
 {
     if (coord.InRange(0, m_BoxNumW, 0, m_BoxNumH))
     {
         return(new Vector2(coord.x + m_Offset.x, coord.y + m_Offset.y));
     }
     else
     {
         return(new Vector2(float.NaN, float.NaN));
     }
 }
Exemple #25
0
 public GameObject GetElementByCoord(Coord2D coord)
 {
     if (coord.InRange(0, m_BoxNumW, 0, m_BoxNumH))
     {
         return(m_ElementArray[coord.y * m_BoxNumW + coord.x]);
     }
     else
     {
         return(null);
     }
 }
    // Use this for initialization
    void Start()
    {
        GameObject gc = GameObject.FindGameObjectWithTag("GameController");

        m_BG = gc.GetComponent <BoxGenerator>();

        Coord2D coord = m_BG.PosToCoord(new Vector2(transform.localPosition.x, transform.localPosition.y));

        if (coord.x != -1 && coord.y != -1)
        {
            GameObject element = m_BG.GetElementByCoord(coord);
            if (element != null)
            {
                var type = element.GetComponent <BoxElementControl>().m_Type;
                m_BG.AttachRandomSpecies(element);
                var count = 1;

                //尋找同類方塊,加上物種
                for (int y = 0; y < m_BG.m_BoxNumH; y++)
                {
                    for (int x = 0; x < m_BG.m_BoxNumW; x++)
                    {
                        Coord2D    targetCoord = new Coord2D(x, y);
                        GameObject target      = m_BG.GetElementByCoord(targetCoord);
                        if (target != null)
                        {
                            BoxElementControl bec = target.GetComponent <BoxElementControl>();
                            if (bec.m_Type == type && bec.GetSpecies() == null)
                            {
                                m_BG.AttachRandomSpecies(target);
                                count++;
                                if (count >= m_Count)
                                {
                                    return;
                                }
                            }
                        }
                    }
                }
            }

            /*int halfSize = m_Size >> 1;
             * for (int x = coord.x - halfSize; x < coord.x - halfSize + m_Size; x++){
             *  for (int y = coord.y - halfSize; y < coord.y - halfSize + m_Size; y++){
             *      Coord2D targetCoord = new Coord2D(x, y);
             *      GameObject element = m_BG.GetElementByCoord(targetCoord);
             *      if (element != null) {
             *          m_BG.AttachRandomSpecies(element);
             *      }
             *  }
             * }*/
        }
    }
    public void MarkEliminate(Coord2D coord)
    {
        GameObject obj = m_BG.GetElementByCoord(coord);

        if (obj == null)
        {
            return;
        }
        BoxElementControl objControl = obj.GetComponent <BoxElementControl>();

        objControl.MarkEliminate();
    }
Exemple #28
0
 public Region getRegionAt(Coord2D coord)
 {
     if (coord < Coord2D.Zero || coord >= size)
     {
         //Console.WriteLine("Region outside map!");
         return(null);
     }
     else
     {
         return(regions[coord.x, coord.y]);
     }
 }
    private Element GetVisibleElementAtPosition(Coord2D elementCoords)
    {
        if (elementCoords.X < 0 || elementCoords.X >= Config.ColumnCount)
        {
            return(null);
        }

        if (elementCoords.Y < 0 || elementCoords.Y >= Config.RawCount)
        {
            return(null);
        }

        return(_elementMatrix[elementCoords.X][elementCoords.Y]);
    }
    // Use this for initialization
    void Start()
    {
        GameObject gc = GameObject.FindGameObjectWithTag("GameController");

        m_BG = gc.GetComponent <BoxGenerator>();
        //寬度是偶數行時需shift,特效跟消融方塊的區域重疊位置才會一樣
        float offsetX = 0;

        if (m_Size % 2 == 0)
        {
            offsetX = 0.5f;
        }
        m_Coord            = m_BG.PosToCoord(new Vector2(transform.localPosition.x + offsetX, transform.localPosition.y));
        m_DestroyCountDown = m_DestroyTime;
    }
 public Coord2D CentreOfGravity() {
   Coord2D ret = new Coord2D(VisionLabPINVOKE.Blob_CentreOfGravity(swigCPtr), true);
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
 public static double Distance(Coord2D p1, Coord2D p2) {
   double ret = VisionLabPINVOKE.Distance__SWIG_3(Coord2D.getCPtr(p1), Coord2D.getCPtr(p2));
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
 public static bool FindSubEdgeOnLine(DoubleImage image, Coord2D start, Coord2D end, Coord2D edge) {
   bool ret = VisionLabPINVOKE.FindSubEdgeOnLine__SWIG_6(DoubleImage.getCPtr(image), Coord2D.getCPtr(start), Coord2D.getCPtr(end), Coord2D.getCPtr(edge));
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
 public static void CamDistortion(DoubleImage src, DoubleImage dest, Coord2D principlePoint, double sx, double dx, double dy, double k1, double k2, double k3) {
   VisionLabPINVOKE.CamDistortion__SWIG_6(DoubleImage.getCPtr(src), DoubleImage.getCPtr(dest), Coord2D.getCPtr(principlePoint), sx, dx, dy, k1, k2, k3);
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
 }
 public static bool CheckCoord2DInImage(Image image, Coord2D xy) {
   bool ret = VisionLabPINVOKE.CheckCoord2DInImage(Image.getCPtr(image), Coord2D.getCPtr(xy));
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
 public static Coord2D StrToCoord2D(string str) {
   Coord2D ret = new Coord2D(VisionLabPINVOKE.StrToCoord2D(str), true);
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
 public static void Warp(HSV888Image src, HSV888Image dest, TransformDirection dir, Coord2D leftTop, Coord2D rightTop, Coord2D leftBottom, Coord2D rightBottom, int height, int width, HSV888Pixel border) {
   VisionLabPINVOKE.Warp__SWIG_18(HSV888Image.getCPtr(src), HSV888Image.getCPtr(dest), (int)dir, Coord2D.getCPtr(leftTop), Coord2D.getCPtr(rightTop), Coord2D.getCPtr(leftBottom), Coord2D.getCPtr(rightBottom), height, width, HSV888Pixel.getCPtr(border));
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
 }
 public static void CircleRegression(vector_Coord2D tab, Coord2D center, ref double radius) {
   VisionLabPINVOKE.CircleRegression(vector_Coord2D.getCPtr(tab), Coord2D.getCPtr(center), ref radius);
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
 }
 public static Coord2D CorrectCoord2D(Coord2D xy, int height, int width, Coord2D principlePoint, double sx, double dx, double dy, double k1, double k2, double k3) {
   Coord2D ret = new Coord2D(VisionLabPINVOKE.CorrectCoord2D(Coord2D.getCPtr(xy), height, width, Coord2D.getCPtr(principlePoint), sx, dx, dy, k1, k2, k3), true);
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
 public static Coord2D PolarLinesIntersection(PolarCoord pc1, PolarCoord pc2) {
   Coord2D ret = new Coord2D(VisionLabPINVOKE.PolarLinesIntersection(PolarCoord.getCPtr(pc1), PolarCoord.getCPtr(pc2)), true);
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
 public static void RotateCoord(Coord2D xy, Coord2D centre, double phi) {
   VisionLabPINVOKE.RotateCoord__SWIG_2(Coord2D.getCPtr(xy), Coord2D.getCPtr(centre), phi);
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
 }
 public Coord2D ExCircleCentre() {
   Coord2D ret = new Coord2D(VisionLabPINVOKE.Blob_ExCircleCentre(swigCPtr), true);
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
 public Coord2D WeightedCoG() {
   Coord2D ret = new Coord2D(VisionLabPINVOKE.Blob_WeightedCoG(swigCPtr), true);
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
 public Coord2D UnCorrImageCToImageC(Coord2D unCorrImageC) {
   Coord2D ret = new Coord2D(VisionLabPINVOKE.CamCalibration_UnCorrImageCToImageC(swigCPtr, Coord2D.getCPtr(unCorrImageC)), true);
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
 public static string Coord2DToStr(Coord2D xy) {
   string ret = VisionLabPINVOKE.Coord2DToStr(Coord2D.getCPtr(xy));
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
 public static void Warp(YUV161616Image src, YUV161616Image dest, TransformDirection dir, Coord2D leftTop, Coord2D rightTop, Coord2D leftBottom, Coord2D rightBottom, int height, int width, YUV161616Pixel border, PixelInterpolation pi) {
   VisionLabPINVOKE.Warp__SWIG_25(YUV161616Image.getCPtr(src), YUV161616Image.getCPtr(dest), (int)dir, Coord2D.getCPtr(leftTop), Coord2D.getCPtr(rightTop), Coord2D.getCPtr(leftBottom), Coord2D.getCPtr(rightBottom), height, width, YUV161616Pixel.getCPtr(border), (int)pi);
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
 }
 public static Coord2D NearestPoint(Line2D line, Coord2D p) {
   Coord2D ret = new Coord2D(VisionLabPINVOKE.NearestPoint(Line2D.getCPtr(line), Coord2D.getCPtr(p)), true);
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
 public static void Warp(ComplexDoubleImage src, ComplexDoubleImage dest, TransformDirection dir, Coord2D leftTop, Coord2D rightTop, Coord2D leftBottom, Coord2D rightBottom, int height, int width, SWIGTYPE_p_std__complexT_double_t border, PixelInterpolation pi) {
   VisionLabPINVOKE.Warp__SWIG_29(ComplexDoubleImage.getCPtr(src), ComplexDoubleImage.getCPtr(dest), (int)dir, Coord2D.getCPtr(leftTop), Coord2D.getCPtr(rightTop), Coord2D.getCPtr(leftBottom), Coord2D.getCPtr(rightBottom), height, width, SWIGTYPE_p_std__complexT_double_t.getCPtr(border), (int)pi);
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
 }
 public static double Distance(Line2D line, Coord2D p) {
   double ret = VisionLabPINVOKE.Distance__SWIG_0(Line2D.getCPtr(line), Coord2D.getCPtr(p));
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
 public static XYCoord Coord2DToXYCoord(Coord2D c) {
   XYCoord ret = new XYCoord(VisionLabPINVOKE.Coord2DToXYCoord__SWIG_1(Coord2D.getCPtr(c)), true);
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
 public static int FindEdgeCircle(DoubleImage image, Coord2D middle, int nrSamples, double minR, double maxR, double outlierDistance, int nrIterations, Coord2D center, ref double radius) {
   int ret = VisionLabPINVOKE.FindEdgeCircle__SWIG_6(DoubleImage.getCPtr(image), Coord2D.getCPtr(middle), nrSamples, minR, maxR, outlierDistance, nrIterations, Coord2D.getCPtr(center), ref radius);
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
 public static void PolarStretch(DoubleImage src, DoubleImage dest, Coord2D centerPos, double beginAngle, double endAngle, int angleSteps, int maxRadius, double borderValue, PixelInterpolation pixelInterpolation) {
   VisionLabPINVOKE.PolarStretch__SWIG_6(DoubleImage.getCPtr(src), DoubleImage.getCPtr(dest), Coord2D.getCPtr(centerPos), beginAngle, endAngle, angleSteps, maxRadius, borderValue, (int)pixelInterpolation);
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
 }
 public static int FindSubEdgesOnLine(DoubleImage image, Coord2D start, Coord2D end, double minEdge, vector_Coord2D edges) {
   int ret = VisionLabPINVOKE.FindSubEdgesOnLine__SWIG_6(DoubleImage.getCPtr(image), Coord2D.getCPtr(start), Coord2D.getCPtr(end), minEdge, vector_Coord2D.getCPtr(edges));
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
 public static void ResampleLine(DoubleImage image, Coord2D start, Coord2D end, int nrPixels, vector_Coord2D cTab, vector_double pTab) {
   VisionLabPINVOKE.ResampleLine__SWIG_7(DoubleImage.getCPtr(image), Coord2D.getCPtr(start), Coord2D.getCPtr(end), nrPixels, vector_Coord2D.getCPtr(cTab), vector_double.getCPtr(pTab));
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
 }
 public static void ResampleLine(DoubleImage src, DoubleImage dest, Coord2D start, Coord2D end, int nrPixels, vector_Coord2D cTab) {
   VisionLabPINVOKE.ResampleLine__SWIG_13(DoubleImage.getCPtr(src), DoubleImage.getCPtr(dest), Coord2D.getCPtr(start), Coord2D.getCPtr(end), nrPixels, vector_Coord2D.getCPtr(cTab));
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
 }
 public static vector_Coord2D Line2DToCoords(Coord2D start, Coord2D end, int nrCoords) {
   vector_Coord2D ret = new vector_Coord2D(VisionLabPINVOKE.Line2DToCoords__SWIG_0(Coord2D.getCPtr(start), Coord2D.getCPtr(end), nrCoords), true);
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
Exemple #57
0
 public bool Equals(Coord2D other)
 {
     if(other == null) return false;
     return (X == other.X) && (Y == other.Y);
 }
 public static void Line2DToCoords(Coord2D start, Coord2D end, int nrCoords, vector_Coord2D res) {
   VisionLabPINVOKE.Line2DToCoords__SWIG_2(Coord2D.getCPtr(start), Coord2D.getCPtr(end), nrCoords, vector_Coord2D.getCPtr(res));
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
 }
 public Coord3D ImageCToCamC(Coord2D imageC) {
   Coord3D ret = new Coord3D(VisionLabPINVOKE.CamCalibration_ImageCToCamC(swigCPtr, Coord2D.getCPtr(imageC)), true);
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
 public Coord3D PixelCToWorldC(Coord2D pixelC) {
   Coord3D ret = new Coord3D(VisionLabPINVOKE.CamCalibration_PixelCToWorldC(swigCPtr, Coord2D.getCPtr(pixelC)), true);
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }