Ejemplo n.º 1
0
        public Point2d(IPoint2 p)
        {
            ITuple2_Double _p = p.AsTupleDouble();

            this.X = _p.X;
            this.Y = _p.Y;
        }
Ejemplo n.º 2
0
 public FlowFieldComponent(bool setValid, IPoint2 size, float newColSize, float newRowSize)
 {
     isValid  = setValid;
     gridSize = size;
     colSize  = newColSize;
     rowSize  = newRowSize;
 }
Ejemplo n.º 3
0
        public void Lineal(IPoint2 p2, double alpha, double beta)
        {
            ITuple2_Double _p2 = p2.AsTupleDouble();

            this.Set(alpha * this.x + beta * _p2.X,
                     alpha * this.y + beta * _p2.Y);
        }
Ejemplo n.º 4
0
        public Point2i(IPoint2 p)
        {
            ITuple2_Integer _p = p.AsTupleInteger();

            this.X = _p.X;
            this.Y = _p.Y;
        }
Ejemplo n.º 5
0
        public void Sub(IPoint2 p1, IPoint2 p2)
        {
            ITuple2_Double _p1 = p1.AsTupleDouble();
            ITuple2_Double _p2 = p2.AsTupleDouble();

            this.Set(_p1.X - _p2.X, _p1.Y - _p2.Y);
        }
Ejemplo n.º 6
0
        public override void Transform(IPoint2 p, IOpPoint2 pout)
        {
            ITuple2_Double   _v    = p.AsTupleDouble();
            IOpTuple2_Double _vout = pout.AsOpTupleDouble();

            _vout.Set(_v.X, _v.Y);
        }
Ejemplo n.º 7
0
        public BuffPoint2d(IPoint2 other)
        {
            ITuple2_Double _other = other.AsTupleDouble();

            this.x = _other.X;
            this.y = _other.Y;
        }
Ejemplo n.º 8
0
        public IPoint2 Mul(IPoint2 p)
        {
            ITuple2_Double _v = p.AsTupleDouble();

            return(new Point2d(this.M00 * _v.X + this.M01 * _v.Y + this.M02,
                               this.M10 * _v.X + this.M11 * _v.Y + this.M12));
        }
Ejemplo n.º 9
0
        public void Sub(IPoint2 p, IVector2 v)
        {
            ITuple2_Double _p = p.AsTupleDouble();
            ITuple2_Double _v = v.AsTupleDouble();

            this.Set(_p.X - _v.X, _p.Y - _v.Y);
        }
Ejemplo n.º 10
0
 public static Point2i ToPoint2i(this IPoint2 p)
 {
     if (p is Point2i)
     {
         return((Point2i)p);
     }
     return(new Point2i(p));
 }
Ejemplo n.º 11
0
 public static Point2d ToPoint2d(this IPoint2 p)
 {
     if (p is Point2d)
     {
         return((Point2d)p);
     }
     return(new Point2d(p));
 }
Ejemplo n.º 12
0
        public virtual void Transform(IPoint2 p, IOpPoint2 pout)
        {
            IOpTuple2_Double _vout = pout.AsOpTupleDouble();

            Vector2d aux = this.Transform(p.ToPoint2d());

            _vout.Set(aux.X, aux.Y);
        }
Ejemplo n.º 13
0
        public void ProjectTo(IPoint2 p1, IVector2 where)
        {
            ITuple2_Double _p1 = p1.AsTupleDouble();
            BuffVector2d   aux = new BuffVector2d(where);

            aux.ProjV(new Vector2d(_p1.X, _p1.Y));
            this.Set(aux.X, aux.Y);
        }
Ejemplo n.º 14
0
        public void Lineal(IPoint2 p1, IPoint2 p2, double alpha, double beta)
        {
            ITuple2_Double _p1 = p1.AsTupleDouble();
            ITuple2_Double _p2 = p2.AsTupleDouble();

            this.Set(alpha * _p1.X + beta * _p2.X,
                     alpha * _p1.Y + beta * _p2.Y);
        }
Ejemplo n.º 15
0
        public void Mul(IPoint2 p, IOpPoint2 pout)
        {
            ITuple2_Double   _v    = p.AsTupleDouble();
            IOpTuple2_Double _vout = pout.AsOpTupleDouble();

            _vout.Set(this.M00 * _v.X + this.M01 * _v.Y + this.M02,
                      this.M10 * _v.X + this.M11 * _v.Y + this.M12);
        }
Ejemplo n.º 16
0
 public NodeComponent(IPoint2 newIdx, FPoint3 newPos, byte newCost, int newBestCost, IPoint2 newDir)
 {
     idx = newIdx;
     pos = newPos;
     //No unsigned char --> by
     travelCost     = newCost;
     bestTravelCost = newBestCost;
     direction      = newDir;
 }
Ejemplo n.º 17
0
        public static ITuple2_Integer AsTupleInteger(this IPoint2 v)
        {
            ITuple2_Integer ret = v as ITuple2_Integer;

            if (ret != null)
            {
                return(ret);
            }
            return(VectorUtils.Convert <ITuple2_Integer>(v));
        }
Ejemplo n.º 18
0
        public static ITuple2_Double AsTupleDouble(this IPoint2 v)
        {
            ITuple2_Double ret = v as ITuple2_Double;

            if (ret != null)
            {
                return(ret);
            }
            return(VectorUtils.Convert <ITuple2_Double>(v));
        }
Ejemplo n.º 19
0
        public double InvLerp(IPoint2 p2, IPoint2 pLerp)
        {
            BuffVector2d v12 = new BuffVector2d();

            v12.Sub(p2, this);
            BuffVector2d v1Lerp = new BuffVector2d();

            v1Lerp.Sub(pLerp, this);
            return(v12.Proj(v1Lerp));
        }
Ejemplo n.º 20
0
        public static bool IsAlmostEqualTo(this IPoint2 current, IPoint2 other, float epsilon)
        {
            if (Math.Abs(current.X - other.X) > epsilon)
            {
                return(false);
            }

            if (Math.Abs(current.Y - other.Y) > epsilon)
            {
                return(false);
            }

            return(true);
        }
    void EntityJobScheduling()
    {
        m_EntityCommandBuffer = m_EntityBufferSystem.CreateCommandBuffer();
        //Lambda doesnt run in normal C#, Unity converts it in a more performant job system construct and burst for better PC resource usage
        Entities.ForEach((Entity entity, in UserData userData, in UpdatedFFData updatedFFData) =>
        {
            m_EntityCommandBuffer.RemoveComponent <UpdatedFFData>(entity);
            DynamicBuffer <EBufferElement> eBuffer = updatedFFData.exists ? GetBuffer <EntityCommandBufferManagedComponentExtensions>(entity) : m_EntityCommandBuffer.AddBuffer <EBufferElement>(entity);
            DynamicBuffer <Entity> m_EntityBuffer  = eBuffer.Reinterpret <Entity>();

            InitGrid(updatedFFData);

            //From Elite framework
            IPoint2 idxInWorld = GetNodeIdxFromWorldPos(userData.GetClickedPos(), IPoint2(nrOfCols, nrOfRows), colSize, rowSize);
            EndNode endNode    = new EndNode(idxInWorld);
            if (!updatedFFData.exists)
            {
                m_EntityCommandBuffer.AddComponent <EndNode>(entity);
            }
            m_EntityCommandBuffer.SetComponent(entity, endNode);
            m_EntityCommandBuffer.AddComponent <TagObstacleCalc>(entity);
        }).Run();
Ejemplo n.º 22
0
        public bool Equals(IPoint2 other)
        {
            ITuple2_Integer _other = other.AsTupleInteger();

            return(this.Equals(_other.X, _other.Y));
        }
Ejemplo n.º 23
0
 public static float[] ToArraySwitched(this IPoint2 value)
 {
     return(new[] { value.X, 1.0f - value.Y });
 }
Ejemplo n.º 24
0
 public static float[] ToArray(this IPoint2 value)
 {
     return(new[] { value.X, value.Y });
 }
Ejemplo n.º 25
0
        public static bool IsAlmostEqualTo(this IPoint2 current, IPoint2 other, float epsilon)
        {
            if (Math.Abs(current.X - other.X) > epsilon)
            {
                return false;
            }

            if (Math.Abs(current.Y - other.Y) > epsilon)
            {
                return false;
            }

            return true;
        }
Ejemplo n.º 26
0
        bool IEpsilonEquatable <IPoint2> .EpsilonEquals(IPoint2 other, double epsilon)
        {
            ITuple2_Integer _other = other.AsTupleInteger();

            return(this.Equals(_other.X, _other.Y));
        }
Ejemplo n.º 27
0
 public FlowFieldControllerComponent(IPoint2 newGridSize, float newColSize, float newRowSize)
 {
     gridSize = newGridSize;
     colSize  = newColSize;
     rowSize  = newRowSize;
 }
Ejemplo n.º 28
0
 public double InvLerp(IPoint2 p2, IPoint2 pLerp)
 {
     return(this.InvLerp(p2.ToPoint2i(), pLerp.ToPoint2i()));
 }
Ejemplo n.º 29
0
 public EndNodeComponent(IPoint2 newIdx)
 {
     idx = newIdx;
 }
Ejemplo n.º 30
0
 public override IPoint2 Transform(IPoint2 v)
 {
     return(this.Matrix.Mul(v));
 }
Ejemplo n.º 31
0
 public override void Transform(IPoint2 p, IOpPoint2 pout)
 {
     this.Matrix.Mul(p, pout);
 }