import '../../../assert/js/assert.js';
import '../../../globals.js';
// Copyright 2017-2024, University of Colorado Boulder
/**
 * An intersection between two different segments.
 *
 * @author Jonathan Olson <jonathan.olson@colorado.edu>
 */
import Utils from '../../../dot/js/Utils.js';
import { kite } from '../imports.js';
export default class SegmentIntersection {
    /**
     * @param point - The location of the intersection
     * @param aT - The parametric value for the first segment at the location of the intersection
     * @param bT - The parametric value for the second segment at the location of the intersection
     */
    constructor(point, aT, bT) {
        assert && assert(aT >= -1e-10 && aT <= 1 + 1e-10, 'aT out of range');
        assert && assert(bT >= -1e-10 && bT <= 1 + 1e-10, 'bT out of range');
        this.point = point;
        // Clamped in case it's slightly out-of-range
        this.aT = Utils.clamp(aT, 0, 1);
        this.bT = Utils.clamp(bT, 0, 1);
    }
    /**
     * Returns the intersection with a and b swapped.
     */
    getSwapped() {
        return new SegmentIntersection(this.point, this.bT, this.aT);
    }
}
kite.register('SegmentIntersection', SegmentIntersection);
//# sourceMappingURL=SegmentIntersection.js.map