Air_Hockey_Simulator.Physics.Line.Y C# (CSharp) Method

Y() public method

public Y ( double x ) : double?
x double
return double?
        public double? Y(double x)
        {
            return Slope == null ? null : Slope * (x - Point.X) + Point.Y;
        }

Usage Example

Beispiel #1
0
 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);
     }
 }
All Usage Examples Of Air_Hockey_Simulator.Physics.Line::Y