public bool Intersects(Seg2d s, double t0) { Vector2d aa = s.a - a; double det = Vector2d.Cross(ab, s.ab); t0 = Vector2d.Cross(aa, s.ab) / det; if (t0 > 0 && t0 < 1) { double t1 = Vector2d.Cross(aa, ab) / det; return t1 > 0 && t1 < 1; } return false; }
/* * Returns true if this segment intersects the given segment. * * @param s a segment. */ public bool Intersects(Seg2d s) { Vector2d aa = s.a - a; double det = Vector2d.Cross(ab, s.ab); double t0 = Vector2d.Cross(aa, s.ab) / det; if (t0 > 0 && t0 < 1) { double t1 = Vector2d.Cross(aa, ab) / det; return(t1 > 0 && t1 < 1); } return(false); }
/* * Returns true if this segment intersects the given segment. * * @param s a segment. */ public bool Intersects(Seg2d s) { var aa = s.a - a; var det = Vector2d.Cross(ab, s.ab); var t0 = Vector2d.Cross(aa, s.ab) / det; if (t0 > 0 && t0 < 1) { var t1 = Vector2d.Cross(aa, ab) / det; return(t1 > 0 && t1 < 1); } return(false); }