public IntersectionWith ( Line line ) : |
||
line | Line | |
return |
public PointD IntersectionWith(Line line)
{
if (this.Slope == line.Slope) return null;
else if (this.Slope == null) {
return new PointD(Point.X, line.Y(Point.X).Value);
}
else if (line.Slope == null) {
return line.IntersectionWith(this);
}
else {
double x = (this.Point.Y + (double)line.Slope * line.Point.X - (double)this.Slope * this.Point.X - line.Point.Y) / ((double)line.Slope - (double)this.Slope);
double y = (double)this.Slope * (x - this.Point.X) + this.Point.Y; //Basically just Y(x)
return new PointD(x, y);
}
}
Line::IntersectionWith ( Arc arc ) : Air_Hockey_Simulator.Physics.PointD[] |
public double DistanceTo(Line line) { Line perpendicular = line.Perpendicular(this); PointD intersection = line.IntersectionWith(perpendicular); return DistanceTo(intersection); }