protected override bool meets(Particle p, PhysicsShape o, Particle oPos) { if (o.GetType() == typeof(Point)) { return(ContainsPoint(p, oPos)); } if (o.GetType() == typeof(Ellipse)) { Ellipse oth = o as Ellipse; return(new Ellipse(r + oth.r).ContainsPoint(p, oPos)); } return(o.Meets(oPos, this, p)); }
protected override bool meets(Particle p, PhysicsShape o, Particle oPos) { if (o.GetType() == typeof(Point)) { return(ContainsPoint(p, oPos)); } if (o.GetType() == typeof(Box)) { Box oth = o as Box; return(new Box(r + oth.r).ContainsPoint(p, oPos)); } if (o.GetType() == typeof(Ellipse)) { Ellipse oth = o as Ellipse; if (!Meets(p, oth.BoundingBox, oPos)) { return(false); } if (p.Dimension != r.Dimension || p.Dimension != oPos.Dimension) { return(false); } Vector <double> ocp = oPos.CurrentPosition; Vector <double> mcp = p.CurrentPosition; Vector <double> diff = ocp - mcp; diff = diff.Map(Math.Abs, diff); Vector <double> rp = r.CurrentPosition; rp.Map(Math.Abs, rp); for (int i = 0; i < p.Dimension; i++) { if (diff[i] < rp[i]) { return(true); } } return(o.ContainsPoint(diff, rp)); } return(o.Meets(oPos, this, p)); }
protected override bool meets(Particle p, PhysicsShape o, Particle oPos) { return(o.ContainsPoint(oPos, p)); }
protected abstract bool meets(Particle p, PhysicsShape o, Particle oPos);
public bool Meets(Particle p, PhysicsShape o, Particle oPos) { Time = p.Time; return(meets(p, o, oPos)); }