Exemplo n.º 1
0
        private void CastHorizontal()
        {
            LineFunction func = new LineFunction(from, to);

            for (int i = 0; i < lines.Count; i++)
            {
                Vector2 vecOut;
                if (lines[i].funct.CollidesWith(func, out vecOut))
                {
                    contacts.Add(vecOut);
                }
            }
        }
Exemplo n.º 2
0
        public override bool CollidesWith(LineFunction line, out Vector2 crossPoint)
        {
            if (m == line.m)
            {
                crossPoint = Vector2.Zero;
                return(false);
            }
            float x = (line.b - b) / (m - line.m);
            float y = line.ValueAt(x);

            crossPoint = new Vector2(x, y);
            return(Line.AreOrdered(from.X, x, to.X) && Line.AreOrdered(line.from.X, x, line.to.X));//(x >= from.X && x <= to.X) && (x >= line.from.X && x <= line.to.X);
            //x = (b2 - b1) / (m1 - m2)
        }
Exemplo n.º 3
0
 public override bool CollidesWith(LineFunction line, out Vector2 crossPoint)
 {
     return line.CollidesWith(this, out crossPoint);
 }
Exemplo n.º 4
0
 public abstract bool CollidesWith(LineFunction line, out Vector2 crossPoint);