/*!
 * Copyright (c) 2026 Vertex Software LLC. All rights reserved.
 */
import { Vector3 } from "@vertexvis/geometry";
import { Color } from "@vertexvis/utils";
import { Drawable } from "./drawable";
export class MeshPoints {
    constructor(valid, world, screen, computeShortestDistance) {
        this.valid = valid;
        this.world = world;
        this.screen = screen;
        this.computeShortestDistance = computeShortestDistance;
    }
    shortestDistanceFrom(vector) {
        return this.computeShortestDistance != null
            ? this.computeShortestDistance(vector)
            : this.toWorldArray()
                .map((v) => Vector3.distance(v, vector))
                .sort((a, b) => a - b)[0];
    }
    toWorldArray() {
        return [...this.world, this.world[0]];
    }
    toArray() {
        return [...this.screen, this.screen[0]];
    }
}
export class Mesh extends Drawable {
    constructor(createShape, identifier, points, outlineColor = '#000000', fillColor = '#000000', shapeProps = {}) {
        super(createShape, identifier, points, typeof outlineColor === 'string'
            ? outlineColor
            : Color.toHexString(outlineColor), typeof fillColor === 'string' ? fillColor : Color.toHexString(fillColor), shapeProps);
    }
}
export class TriangleMeshPoints {
    constructor(valid, worldBase, worldLeft, worldRight, worldTip, base, left, right, tip) {
        this.valid = valid;
        this.worldBase = worldBase;
        this.worldLeft = worldLeft;
        this.worldRight = worldRight;
        this.worldTip = worldTip;
        this.base = base;
        this.left = left;
        this.right = right;
        this.tip = tip;
    }
    shortestDistanceFrom(vector) {
        return this.toWorldArray()
            .map((v) => Vector3.distance(v, vector))
            .sort((a, b) => a - b)[0];
    }
    toWorldArray() {
        return [this.worldBase, this.worldLeft, this.worldRight, this.worldTip];
    }
    toArray() {
        return [this.base, this.left, this.tip, this.right, this.base];
    }
}
export class TriangleMesh extends Drawable {
    constructor(createShape, identifier, points, outlineColor = '#000000', fillColor = '#000000', shapeProps = {}, disabled = false) {
        super(createShape, identifier, points, typeof outlineColor === 'string'
            ? outlineColor
            : Color.toHexString(outlineColor), typeof fillColor === 'string' ? fillColor : Color.toHexString(fillColor), shapeProps);
        this.disabled = disabled;
    }
    setDisabled(disabled) {
        this.disabled = disabled;
    }
    isDisabled() {
        return !!this.disabled;
    }
}
//# sourceMappingURL=mesh.js.map
