|
| 1 | +// Copyright 2020-2025 ONIXLabs |
| 2 | +// |
| 3 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +// you may not use this file except in compliance with the License. |
| 5 | +// You may obtain a copy of the License at |
| 6 | +// |
| 7 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +// |
| 9 | +// Unless required by applicable law or agreed to in writing, software |
| 10 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +// See the License for the specific language governing permissions and |
| 13 | +// limitations under the License. |
| 14 | + |
| 15 | +namespace OnixLabs.Units; |
| 16 | + |
| 17 | +// ReSharper disable MemberCanBePrivate.Global |
| 18 | +public readonly partial struct Distance<T> |
| 19 | +{ |
| 20 | + /// <summary> |
| 21 | + /// Computes the quotient of the specified <see cref="Distance{T}"/> values. |
| 22 | + /// </summary> |
| 23 | + /// <param name="left">The left-hand value to divide.</param> |
| 24 | + /// <param name="right">The right-hand value to divide by.</param> |
| 25 | + /// <returns>Returns the quotient of the specified <see cref="Distance{T}"/> values.</returns> |
| 26 | + public static Distance<T> Divide(Distance<T> left, Distance<T> right) => new(left.QuectoMeters / right.QuectoMeters); |
| 27 | + |
| 28 | + /// <summary> |
| 29 | + /// Computes the quotient of the specified <see cref="Distance{T}"/> values. |
| 30 | + /// </summary> |
| 31 | + /// <param name="left">The left-hand value to divide.</param> |
| 32 | + /// <param name="right">The right-hand value to divide by.</param> |
| 33 | + /// <returns>Returns the quotient of the specified <see cref="Distance{T}"/> values.</returns> |
| 34 | + public static Distance<T> operator /(Distance<T> left, Distance<T> right) => Divide(left, right); |
| 35 | + |
| 36 | + /// <summary> |
| 37 | + /// Computes the quotient of the current <see cref="Distance{T}"/> value, divided by the specified other <see cref="Distance{T}"/> value. |
| 38 | + /// </summary> |
| 39 | + /// <param name="other">The value to divide the current <see cref="Distance{T}"/> value by.</param> |
| 40 | + /// <returns>Returns the quotient of the current <see cref="Distance{T}"/> value, divided by the specified other <see cref="Distance{T}"/> value.</returns> |
| 41 | + public Distance<T> Divide(Distance<T> other) => Divide(this, other); |
| 42 | +} |
0 commit comments