internal bool BelongsToShortestRange(DirectionRange <TAlgebraicNumber> directions) { var determinant = directions.Start.Determinant(directions.End); if (_calculator.IsStrictlyPositive(determinant)) { return(_calculator.IsStrictlyPositive(directions.Start.Determinant(this)) && _calculator.IsStrictlyPositive(Determinant(directions.End))); } if (_calculator.IsNegative(determinant)) { return (_calculator.IsStrictlyNegative(directions.Start.Determinant(this)) && _calculator.IsStrictlyNegative(Determinant(directions.End))); } return(false); }
public static bool IsStrictlyGreaterThan <TAlgebraicNumber>( this IAlgebraicNumberCalculator <TAlgebraicNumber> calculator, TAlgebraicNumber number1, TAlgebraicNumber number2) { if (calculator is null) { throw new ArgumentNullException(nameof(calculator)); } return(calculator.IsStrictlyNegative(calculator.Subtract(number2, number1))); }
public static TAlgebraicNumber Abs <TAlgebraicNumber>( this IAlgebraicNumberCalculator <TAlgebraicNumber> calculator, TAlgebraicNumber number) { if (calculator is null) { throw new ArgumentNullException(nameof(calculator)); } return(calculator.IsStrictlyNegative(number) ? calculator.Opposite(number) : number); }