import { useMemo } from "react";
import * as THREE from "three";
import { Line as DreiLine } from "@react-three/drei";
import * as Constants from "../../../../types/world/worldConstants";

interface ReferenceLineProps {
    points: [Point, Point];
}

function ReferenceLine({ points }: Readonly<ReferenceLineProps>) {
    const positions = useMemo(() => points.map((p) => new THREE.Vector3(...p.position)), [points]);

    return <DreiLine points={positions} lineWidth={Constants.lineConfig.width} color={Constants.lineConfig.helperColor} />;
}

export default ReferenceLine;
