/*!
 * Copyright (c) 2026 Vertex Software LLC. All rights reserved.
 */
import { Plane } from "@vertexvis/scene-view-protos/core/protos/geometry_pb";
import { MeasurementOutcome, MeasurementResult, MinimumDistanceResult, PlanarAngleResult, PlanarDistanceResult, PlanePair, SurfaceAreaResult, } from "@vertexvis/scene-view-protos/core/protos/measurement_pb";
import { MeasureResponse } from "@vertexvis/scene-view-protos/sceneview/protos/scene_view_api_pb";
import { toProtoTimestamp } from "@vertexvis/stream-api";
import { Timestamp } from "google-protobuf/google/protobuf/timestamp_pb";
import { makeVector3f } from "./geometry";
import { random } from "./random";
export function makeMeasureResponse(...result) {
    const response = new MeasureResponse();
    const outcome = new MeasurementOutcome();
    outcome.setResultsList(result);
    response.setOutcome(outcome);
    return response;
}
export function makePlanarDistanceResult() {
    const result = new MeasurementResult();
    const distance = new PlanarDistanceResult();
    distance.setDistance(random.floating());
    distance.setPlanes(makePlanes());
    result.setPlanarDistance(distance);
    return result;
}
export function makePlanarAngleResult() {
    const result = new MeasurementResult();
    const angle = new PlanarAngleResult();
    angle.setAngleInRadians(random.floating());
    angle.setPlanes(makePlanes());
    result.setPlanarAngle(angle);
    return result;
}
export function makeMinimumDistanceResult() {
    const result = new MeasurementResult();
    const distance = new MinimumDistanceResult();
    distance.setDistance(random.floating());
    distance.setClosestPoint1(makeVector3f());
    distance.setClosestPoint2(makeVector3f());
    result.setMinimumDistance(distance);
    return result;
}
export function makeSurfaceAreaResult() {
    const result = new MeasurementResult();
    const area = new SurfaceAreaResult();
    area.setArea(random.floating());
    result.setTotalSurfaceArea(area);
    return result;
}
export function makePlanes() {
    const plane1 = new Plane();
    plane1.setD(random.floating());
    plane1.setNormal(makeVector3f());
    const plane2 = new Plane();
    plane2.setD(random.floating());
    plane2.setNormal(makeVector3f());
    const planes = new PlanePair();
    planes.setStart(plane1);
    planes.setEnd(plane2);
    return planes;
}
export function makeTimestamp(date = new Date()) {
    const timestamp = toProtoTimestamp(date);
    const res = new Timestamp();
    if (typeof timestamp.seconds === 'number') {
        res.setSeconds(timestamp.seconds);
    }
    else {
        res.setSeconds(timestamp.seconds.toNumber());
    }
    res.setNanos(timestamp.nanos);
    return res;
}
//# sourceMappingURL=sceneView.js.map
